public ClinicalNotesVo getClinicalNotesForCareContext(CareContextRefVo careContextRefVo) { if(careContextRefVo != null) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from ClinicalNotes clinnote where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " clinnote.careContext.id = :careContextId"); markers.add("careContextId"); values.add(careContextRefVo.getID_CareContext()); andStr = " and "; List listNotes = factory.find(hql.toString(), markers,values); if(listNotes != null && listNotes.size() > 0) { ClinicalNotesVoCollection voColl = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(listNotes); if(voColl != null && voColl.size() > 0) return voColl.get(0); } } return null; }
/** * getClinicalNotes */ public ims.core.vo.ClinicalNotesVo getClinicalNotes(ims.core.admin.vo.ClinicalContactRefVo contactVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from ClinicalNotes clinnote where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Integer> values = new ArrayList<Integer>(); hql.append(andStr + " clinnote.clinicalContact.id = :ccId"); markers.add("ccId"); values.add(contactVo.getID_ClinicalContact()); andStr = " and "; List<?> listNotes = factory.find(hql.toString(), markers,values); if(listNotes != null && listNotes.size() > 0) { ClinicalNotesVoCollection voColl = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(listNotes); if(voColl != null && voColl.size() > 0) return voColl.get(0); } return null; }
public ClinicalNotesVoCollection getAllClinicalNotesForCareContext(CareContextRefVo careContextRefVo) { DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer hql = new StringBuffer(); hql.append(" select notes from ClinicalNotes as notes left join notes.careContext as cc where (cc.id=:ID and notes.isDerivedNote = 1)"); hql.append(" order by notes.id desc"); markers.add("ID"); values.add(careContextRefVo.getID_CareContext()); return ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(factory.find(hql.toString(), markers, values)); }
/** * Gets the Clinical Notes Details for the given Clinical Note ID */ public ims.core.vo.ClinicalNotesVo getClinicalNotes(ims.core.vo.ClinicalNotesVo clinicalNote) { DomainFactory factory = getDomainFactory(); ClinicalNotes notes = (ClinicalNotes)factory.getDomainObject(ClinicalNotes.class, clinicalNote.getID_ClinicalNotes()); ClinicalNotesVo voNote = ClinicalNotesVoAssembler.create(notes); return voNote; }
public ClinicalNotesVo getClinicalNoteById(Integer idClinicalNote) { if(idClinicalNote == null) throw new CodingRuntimeException("idClinicalNote cannot be null in method getClinicalNoteById"); return ClinicalNotesVoAssembler.create((ClinicalNotes) getDomainFactory().getDomainObject(ClinicalNotes.class, idClinicalNote)); }
/** * getClinicalNotes */ public ims.core.vo.ClinicalNotesVo getClinicalNotes(Integer nId) { if(nId != null) { DomainFactory factory = getDomainFactory(); ClinicalNotes doClinicalNotes = (ClinicalNotes)factory.getDomainObject(ClinicalNotes.class, nId); return ClinicalNotesVoAssembler.create(doClinicalNotes); } return null; }
/** * getClinicalNotes */ public ClinicalNotesVoCollection getClinicalNotes(ims.core.admin.vo.ClinicalContactRefVo contactVo) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from ClinicalNotes clinnote where "); String andStr = " "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Integer> values = new ArrayList<Integer>(); hql.append(andStr + " clinnote.clinicalContact.id = :ccId"); markers.add("ccId"); values.add(contactVo.getID_ClinicalContact()); hql.append(" ORDER BY recordingDateTime desc"); //WDEV-15382 andStr = " and "; List<?> listNotes = factory.find(hql.toString(), markers,values); if(listNotes != null && listNotes.size() > 0) { return ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(listNotes); //WDEV-15382 } return null; }
public ims.core.vo.ClinicalNotesVo getClinicalNotes(Integer notesId) { if(notesId != null) { DomainFactory factory = getDomainFactory(); ClinicalNotes doClinicalNotes = (ClinicalNotes)factory.getDomainObject(ClinicalNotes.class, notesId); return ClinicalNotesVoAssembler.create(doClinicalNotes); } return null; }
public ims.core.vo.ClinicalNotesVo saveClinicalNotes(ims.core.vo.ClinicalNotesVo voClinicalNotes, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException { if (voClinicalNotes == null) throw new RuntimeException("Cannot save null value for voClinicalNotes"); if(!voClinicalNotes.isValidated()) throw new CodingRuntimeException("ClinicalNotesVo has not been validated"); DomainFactory factory = getDomainFactory(); if (voClinicalNotes.getID_ClinicalNotes() == null)//Inserting a record { ClinicalNotesVo voCN = getClinicalContactNote(voClinicalNotes.getClinicalContact()); if(voCN != null) throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed"); } ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes); factory.save(doNote); if(voClinicalNotesAdditional != null) { if(!voClinicalNotesAdditional.isValidated()) throw new CodingRuntimeException("ClinicalNotesAdditionalVo has not been validated"); ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional); doClinNotesAdditional.setClinialNotes(doNote); factory.save(doClinNotesAdditional); } return ClinicalNotesVoAssembler.create(doNote); }
public ClinicalNotesVo getClinicalContactNote(ClinicalContactRefVo refClinicalContact) { if (refClinicalContact == null) throw new RuntimeException("Cannot get ClinicalNotesVo for null ClinicalContactRefVo"); DomainFactory factory = getDomainFactory(); String hql = " from ClinicalNotes note "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if (refClinicalContact != null) { condStr.append(andStr + " (note.clinicalContact.id = :contactId )"); markers.add("contactId"); values.add(refClinicalContact.getID_ClinicalContact()); andStr = " and "; } condStr.append(andStr); condStr.append(" note.noteType = :noteType"); markers.add("noteType"); values.add(getDomLookup(ims.core.vo.lookups.ClinicalNoteType.CLINICALNOTE)); andStr = " and "; if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); ClinicalNotesVoCollection collClinicalNotesVo = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(factory.find(hql,markers,values)); if(collClinicalNotesVo!=null && collClinicalNotesVo.size() > 0) return collClinicalNotesVo.get(0); return null; }
private ClinicalNotesVo saveClinicalNoteAtCareContextLevel(ClinicalNotesVo clinicalNotesVo) throws StaleObjectException { DomainFactory factory = getDomainFactory(); ims.core.clinical.domain.objects.ClinicalNotes domClinicalNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, clinicalNotesVo); factory.save(domClinicalNote); return ClinicalNotesVoAssembler.create(domClinicalNote); }
public ClinicalNotesVo getClinicalNotesForCareContext(CareContextRefVo careContext) { if(careContext != null) { DomainFactory factory = getDomainFactory(); //WDEV-20525 StringBuffer hql = new StringBuffer(" from ClinicalNotes clinnote where "); //WDEV-20525 String andStr = " "; StringBuffer hql = new StringBuffer("select clinnote from ClinicalNotes as clinnote left join clinnote.sourceOfNote as source where source.id=-1161"); String andStr = " and "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " clinnote.careContext.id = :careContextId"); markers.add("careContextId"); values.add(careContext.getID_CareContext()); andStr = " and "; hql.append(andStr).append(" clinnote.clinicalContact is null "); // We only want to see the carecontext level record List listNotes = factory.find(hql.toString(), markers,values); if(listNotes != null && listNotes.size() > 0) { ClinicalNotesVoCollection voColl = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(listNotes); if(voColl != null && voColl.size() > 0) return voColl.get(0); } } return null; }
/** * Return Clinical Notes for the Current Care Context */ public ims.core.vo.ClinicalNotesVo getClinicalNotesForCareContext(ims.core.admin.vo.CareContextRefVo careContext) { if(careContext != null) { DomainFactory factory = getDomainFactory(); //WDEV-20525 StringBuffer hql = new StringBuffer(" from ClinicalNotes clinnote where "); //WDEV-20525 String andStr = " "; StringBuffer hql = new StringBuffer("select clinnote from ClinicalNotes as clinnote left join clinnote.sourceOfNote as source where source.id=-1161"); String andStr = " and "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Serializable> values = new ArrayList<Serializable>(); hql.append(andStr + " clinnote.careContext.id = :careContextId"); markers.add("careContextId"); values.add(careContext.getID_CareContext()); andStr = " and "; hql.append(andStr).append(" clinnote.clinicalContact is null "); // We only want to see the carecontext level record List listNotes = factory.find(hql.toString(), markers,values); if(listNotes != null && listNotes.size() > 0) { ClinicalNotesVoCollection voColl = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(listNotes); if(voColl != null && voColl.size() > 0) return voColl.get(0); } } return null; }
public ClinicalNotesVoCollection listContacts(Hcp hcpFilterVo, HcpDisType disciplineFilterVo, CareContextShortVo careContextShortVo, Boolean activeOnly) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from ClinicalNotes cn "; String andStr = " "; ArrayList<String> markerNames = new ArrayList<String>(); ArrayList<Object> markerValues = new ArrayList<Object>(); if (hcpFilterVo != null) { hql.append(" cn.authoringInformation.authoringHcp.id = :authoringHCP "); markerNames.add("authoringHCP"); markerValues.add(hcpFilterVo.getID_Hcp()); andStr = " and "; } if (disciplineFilterVo != null) { hql.append(andStr + " cn.discipline = :discipline"); markerNames.add("discipline"); markerValues.add(getDomLookup(disciplineFilterVo)); andStr = " and "; } if (careContextShortVo != null) { hql.append(andStr + " cn.careContext.id = :rcc"); markerNames.add("rcc"); markerValues.add(careContextShortVo.getID_CareContext()); andStr = " and "; } if (activeOnly != null && activeOnly) { hql.append(andStr + " cn.isCorrected <> 1"); andStr = " and "; } if(markerNames.size()>0) query += " where "; query += hql.toString(); List<?> clinicalNotes = factory.find(query, markerNames, markerValues); return ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(clinicalNotes).sort(SortOrder.DESCENDING); }
/** * saveClinicalNotes */ public ClinicalNotesVo saveClinicalNotes(ClinicalNotesVo voClinicalNotes, ClinicalContactShortVo voClinicalContactShort, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException //WDEV-19027 { if(voClinicalNotes.isValidated() == false) throw new DomainRuntimeException("ClinicalNotesVo has not been validated"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1"); if(voClinicalNotes.getID_ClinicalNotes()== null) { hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.clinicalContact.id = " + voClinicalNotes.getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " + voClinicalNotes.getID_ClinicalNotes() +")"); //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } List list = (factory.find(hql.toString())); if(list.size() > 0) { ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list); if (doClinNotes.get(0).getSourceOfNote() != null && !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId()))) { return null; } else { throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed"); } } ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes); ClinicalContact doClinicalContact = getCurrentClinicalContact(voClinicalNotes.getClinicalContact()); doNote.setClinicalContact(doClinicalContact); factory.save(doNote); if(voClinicalNotesAdditional != null) { ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional); doClinNotesAdditional.setClinialNotes(doNote); factory.save(doClinNotesAdditional); } return ClinicalNotesVoAssembler.create(doNote); }
public ClinicalNotesVo saveClinicalNotesOnly(ClinicalNotesVo voClinicaNotes) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { // Ensure the value object has been validated if (!voClinicaNotes.isValidated()) throw new DomainRuntimeException("Clinical Notes has not been validated"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1"); if(voClinicaNotes.getID_ClinicalNotes()== null) { hql.append(" where (p.clinicalContact.id = " + voClinicaNotes.getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.clinicalContact.id = " + voClinicaNotes.getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " + voClinicaNotes.getID_ClinicalNotes() +")"); //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } List list = (factory.find(hql.toString())); ClinicalNotesVoCollection listClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list); if(listClinNotes != null && listClinNotes.size() > 0) { if (listClinNotes.get(0).getSourceOfNote() != null && !(listClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId())) && !(listClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.THERAPYSOAPNOTE).getId())))//WDEV-9793 { return null; } else { throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed"); } } ClinicalNotes doClinNotes = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicaNotes); ClinicalContact doClinicalContact = getCurrentClinicalContact(voClinicaNotes.getClinicalContact()); doClinNotes.setClinicalContact(doClinicalContact); factory.save(doClinNotes); return ClinicalNotesVoAssembler.create(doClinNotes); }
public OutpatientNotesOutcomeVo saveOutpatientNotesOutcome(OutpatientNotesOutcomeVo record) throws StaleObjectException { if(record == null) throw new CodingRuntimeException("null record passed to saveClinicalCorrespondence() !"); if(!record.isValidated()) throw new CodingRuntimeException("OutpatientNotesOutcome not validated !"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1"); if(record.getClinicalNote().getClinicalNote().getID_ClinicalNotes()== null) { hql.append(" where (p.clinicalContact.id = " + record.getClinicalNote().getClinicalNote().getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.clinicalContact.id = " + record.getClinicalNote().getClinicalNote().getClinicalContact().getID_ClinicalContact() + "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " + record.getClinicalNote().getClinicalNote().getID_ClinicalNotes() +")"); //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } List list = (factory.find(hql.toString())); if(list.size() > 0) { ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list); if (doClinNotes.get(0).getSourceOfNote() != null && !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId()))) { return null; } else { throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed"); } } OutpatientNotesOutcome boOutpatientNotesOutcome = OutpatientNotesOutcomeVoAssembler.extractOutpatientNotesOutcome(factory, record); CareContext doCareContext = getCurrentCareContext(record.getCareContext());//WDEV-19027 boOutpatientNotesOutcome.setCareContext(doCareContext);//WDEV-19027 factory.save(boOutpatientNotesOutcome); return OutpatientNotesOutcomeVoAssembler.create(boOutpatientNotesOutcome); }
public ClinicalNotesVo saveClinicalNotesForCareContext(ClinicalNotesVo voClinicalNotes, CareContextRefVo voCareContext, ClinicalNotesAdditionalVo voClinicalNotesAdditional) throws DomainInterfaceException, StaleObjectException { if(voClinicalNotes.isValidated() == false) throw new DomainRuntimeException("ClinicalNotesVo has not been validated"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("select p from ClinicalNotes p left join p.noteType as l1_1"); if(voClinicalNotes.getID_ClinicalNotes()== null) { hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() + //WDEV-19027 "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.careContext.id = " + voClinicalNotes.getCareContext().getID_CareContext() + //WDEV-19027 "and l1_1.id <> -882 and l1_1 <> -883 and p.id <> " + voClinicalNotes.getID_ClinicalNotes() +")"); //clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } List list = (factory.find(hql.toString())); if(list.size() > 0) { ClinicalNotesVoCollection doClinNotes = ClinicalNotesVoAssembler.createClinicalNotesVoCollectionFromClinicalNotes(list); if (doClinNotes.get(0).getSourceOfNote() != null && !(doClinNotes.get(0).getSourceOfNote().getId() == (getDomLookup(SourceOfNote.CLINICALCLINICALNOTE).getId()))) { return null; } else { throw new DomainRuntimeException("A record exists for this Care Context, the screen will be refreshed"); } } ClinicalNotes doNote = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicalNotes); CareContext doCareContext = getCurrentCareContext(voClinicalNotes.getCareContext()); //WDEV-19027 doNote.setCareContext(doCareContext);//WDEV-19027 factory.save(doNote); if(voClinicalNotesAdditional != null) { ClinicalNotesAdditional doClinNotesAdditional = ClinicalNotesAdditionalVoAssembler.extractClinicalNotesAdditional(factory, voClinicalNotesAdditional); doClinNotesAdditional.setClinialNotes(doNote); factory.save(doClinNotesAdditional); } return ClinicalNotesVoAssembler.create(doNote); }