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 void saveMedSocialHistory(SocialHistoryVo voSocialHistory) throws StaleObjectException { // Ensure the value object has been validated if (!voSocialHistory.isValidated()) throw new DomainRuntimeException("Social History has not been validated"); DomainFactory factory = getDomainFactory(); SocialHistory doSocHist = SocialHistoryVoAssembler.extractSocialHistory(factory, voSocialHistory); factory.save(doSocHist); return; }
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; }
public SocialHistoryVo saveSocialHistory(SocialHistoryVo voSocialHistory) throws StaleObjectException { if(voSocialHistory == null || !voSocialHistory.isValidated()) throw new CodingRuntimeException("Social History Value Object is null or has not been validated"); if (voSocialHistory.getID_SocialHistory() == null && getSocialHistoryByCareContext(voSocialHistory.getCareContext()) != null) throw new StaleObjectException(null, "A Social History record already exists for this Care Context, the screen will be refreshed."); DomainFactory factory = getDomainFactory(); SocialHistory domSocialHistory = SocialHistoryVoAssembler.extractSocialHistory(factory,voSocialHistory); factory.save(domSocialHistory); return SocialHistoryVoAssembler.create(domSocialHistory); }
public SocialHistoryVo getSocialHistoryByPatient(PatientRefVo patient) { if(patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException("Patient not Provided to retrive Core Clinical - Social History record"); DomainFactory factory = getDomainFactory(); String hql = "from SocialHistory socHist where socHist.careContext.episodeOfCare.careSpell.patient.id = :idPatient order by socHist.systemInformation.creationDateTime desc"; List socialHistory = factory.find(hql, new String[] {"idPatient"}, new Object[] {patient.getID_Patient()}); if (socialHistory != null && socialHistory.size() > 0) return SocialHistoryVoAssembler.create((SocialHistory) socialHistory.get(0)); return null; }