public SocialHistoryVo getSocialHistoryByCareContext(CareContextRefVo voCareContextRef) { if(voCareContextRef == null) throw new CodingRuntimeException("Contact not Provided"); DomainFactory factory = getDomainFactory(); //the following query retrievs the one and only contact of type spinalmedicaladmission if it has been instantiated List socialHistory = factory.find(" from SocialHistory sc where sc.careContext.id = :idCareContext order by sc.systemInformation.creationDateTime desc )", new String[]{"idCareContext" }, new Object[]{ voCareContextRef.getID_CareContext()}); SocialHistoryVoCollection voCollSocialHistory = SocialHistoryVoAssembler.createSocialHistoryVoCollectionFromSocialHistory(socialHistory); if(voCollSocialHistory.size()>0) return voCollSocialHistory.get(0); else return null; }
public SocialHistoryVoCollection getSocialHistoryByCareContextCollection( CareContextRefVo voCareContextRef) { if(voCareContextRef == null) throw new CodingRuntimeException("Contact not Provided"); DomainFactory factory = getDomainFactory(); //the following query retrievs the one and only contact of type spinalmedicaladmission if it has been instantiated List socialHistory = factory.find(" from SocialHistory sc where sc.careContext.id = :idCareContext ", new String[]{"idCareContext" }, new Object[]{ voCareContextRef.getID_CareContext()}); SocialHistoryVoCollection voCollSocialHistory = SocialHistoryVoAssembler.createSocialHistoryVoCollectionFromSocialHistory(socialHistory); if(voCollSocialHistory.size()>0) return voCollSocialHistory; else return null; }
public SocialHistoryVo getSocialHistoryById(SocialHistoryRefVo socialhostoryref) { if(socialhostoryref == null || !socialhostoryref.getID_SocialHistoryIsNotNull()) return null; DomainFactory factory = getDomainFactory(); List socialHistory = factory.find(" from SocialHistory sc where sc.id = :idSocialHistory ", new String[]{"idSocialHistory" }, new Object[]{ socialhostoryref.getID_SocialHistory()}); SocialHistoryVoCollection voCollSocialHistory = SocialHistoryVoAssembler.createSocialHistoryVoCollectionFromSocialHistory(socialHistory); if(voCollSocialHistory.size()>0) return voCollSocialHistory.get(0); else return null; }
public SocialHistoryVo getMedSocialHistory(ClinicalContactShortVo voClinicalContactShort) { SocialHistoryVoCollection voCollSocHist = new SocialHistoryVoCollection(); DomainFactory factory = getDomainFactory(); String hql = " from SocialHistory socHist "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if (voClinicalContactShort.getID_ClinicalContactIsNotNull()) { condStr.append(andStr + " socHist.clinicalContact.id = :id_ClinicalContact"); markers.add("id_ClinicalContact"); values.add(voClinicalContactShort.getID_ClinicalContact().toString()); andStr = " and "; } if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); voCollSocHist = SocialHistoryVoAssembler.createSocialHistoryVoCollectionFromSocialHistory(factory.find(hql, markers, values)); if (voCollSocHist.size() > 0) return voCollSocHist.get(0); else return null; }
public SocialHistoryVo getMedSocialHistoryByCareContext(CareContextLiteVo voCareContext) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = " from SocialHistory socHist "; ArrayList markers= new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if(voCareContext.getEpisodeOfCareIsNotNull()) { hql.append(andStr + " socHist.careContext.id = :ec"); markers.add("ec"); values.add(voCareContext.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); query += " and socHist.isRIE is null"; java.util.List socHistList = factory.find(query,markers,values); SocialHistoryVoCollection voCollSocHist = SocialHistoryVoAssembler.createSocialHistoryVoCollectionFromSocialHistory(socHistList); if(voCollSocHist.size()>0) return voCollSocHist.get(0); else return null; }