private void listContacts() { form.getLocalContext().setDateTimeSortOrder(SortOrder.NONE); if (form.cmbDiscipline().getValue() == null) { engine.showErrors(new String[]{"Discipline is mandatory"}); return; } // ims.core.vo.ClinicalEpisode voClinicalEpisode = form.getGlobalContext().Core.getClinicalEpisode(); ClinicalNotesVoCollection voListContacts = domain.listContacts(form.qcbHCP().getValue(), form.cmbDiscipline().getValue(), form.getGlobalContext().Core.getCurrentCareContext(),form.chkActiveOnly().getValue()); form.grdContacts().getRows().clear(); form.getLocalContext().setselectedRecord(null); //wdev-10799 if (voListContacts == null || voListContacts.size() == 0 ) { engine.showMessage("No Contact records were found for your search criteria."); form.getGlobalContext().Nursing.setContactFilter(null); //wdev-10791 return; } populateGridFromData(voListContacts); form.grdContacts().setValue(null); form.btnNoteCorrection().setEnabled(false); RefreshFilterSearchCriteria();//wdev-10791 }
@Override protected void onGrdContactsGridHeaderClicked(int column) throws PresentationLogicException { if (DATE_TIME_COL_INDEX == column) { ClinicalNotesVo selectedValue = form.grdContacts().getValue(); ClinicalNotesVoCollection data = new ClinicalNotesVoCollection(); for (int i = 0 ; i < form.grdContacts().getRows().size() ; i ++) { data.add(form.grdContacts().getRows().get(i).getValue()); } form.getLocalContext().setDateTimeSortOrder(getNextOrder(form.getLocalContext().getDateTimeSortOrder())); data.sort(new DateTimeClinicalNotesComparator(form.getLocalContext().getDateTimeSortOrder())); form.grdContacts().getRows().clear(); populateGridFromData(data); form.grdContacts().setValue(selectedValue); if (form.grdContacts().getValue()!= null) onGrdContactsSelectionChanged(); } }
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)); }
private void populateGridFromData(ClinicalNotesVoCollection voListContacts) { GenForm.grdContactsRow row; ClinicalNotesVo voContactRecord; for (int i=0; i< voListContacts.size(); i++) { voContactRecord = voListContacts.get(i); row = form.grdContacts().getRows().newRow(); row.setcolDate(voContactRecord.getRecordingDateTime().toString()); if (voContactRecord.getAuthoringInfoIsNotNull()) { if (voContactRecord.getAuthoringInfo().getAuthoringHcpIsNotNull()) row.setcolBy(voContactRecord.getAuthoringInfo().getAuthoringHcp().getName().toString()); } if (voContactRecord.getDiscipline() != null) row.setColDiscipline(voContactRecord.getDiscipline().getText()); if (voContactRecord.getIsCorrectedIsNotNull()) { if (voContactRecord.getIsCorrected().booleanValue() == true) // Correction has been added row.setcolNote(voContactRecord.getClinicalNote() + "\nCorrected By: " + voContactRecord.getCurrentStatus().getCorrectedBy() + " on " + voContactRecord.getCurrentStatus().getDateTime().getDate() + " at " + voContactRecord.getCurrentStatus().getDateTime().getTime() + " for the following reason:\n" + voContactRecord.getCurrentStatus().getCorrectionReason()); else row.setcolNote(voContactRecord.getClinicalNote()); } if (voContactRecord.getIsCorrectedIsNotNull()) { if (voContactRecord.getIsCorrected().booleanValue()) row.setcolIsActive(form.getImages().Core.AnswerBox_No); else row.setcolIsActive(form.getImages().Core.AnswerBox_Yes); } row.setValue(voContactRecord); } }
/** * 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 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; }
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); }
private void openTherapiesSOAP() throws PresentationLogicException { clearDetails(); form.setMode(FormMode.VIEW); showHideCustomComponent(form.customControlAuthoring(), Boolean.FALSE, false); //WDEV-13939 ClinicalNotesVoCollection allSoapNotes = domain.getAllClinicalNotesForCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if (engine.isRIEMode()) { populateScreenControls(allSoapNotes.get(0)); } // for RIE if (form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull() && !engine.isRIEMode())//WDEV-13939 { form.getGlobalContext().Clinical.setCurrentClinicalNote(domain.getClinicalNote(form.getGlobalContext().Clinical.getCurrentClinicalNote())); if(!form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull()) { form.getLocalContext().setclinicalNotesVo(null); } } if (form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull() && !engine.isRIEMode()) { //checkCurrentClinicalNote(); populateScreenControls(form.getGlobalContext().Clinical.getCurrentClinicalNote()); if (form.getGlobalContext().Clinical.getReturnToFormModeIsNotNull() && form.getGlobalContext().Clinical.getReturnToFormMode().equals(FormMode.EDIT)) { openAsDialog(); } else { showBtnNew(true); } } else if (form.getGlobalContext().Clinical.getCurrentClinicalNote() == null && form.getGlobalContext().Clinical.getReturnToFormModeIsNotNull() && form.getGlobalContext().Clinical.getReturnToFormMode().equals(FormMode.EDIT) ) { newInstance(); form.getGlobalContext().Clinical.setReturnToFormMode(null); form.getGlobalContext().Clinical.setCurrentClinicalNote(null); } else { if (form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull() && !engine.isRIEMode()) { ClinicalNotesVo voNote = form.getGlobalContext().Clinical.getCurrentClinicalNote(); checkForExistingClinicalNotes(voNote); if (voNote != null && voNote.getNoteTypeIsNotNull() && voNote.getNoteType().equals(ClinicalNoteType.THERAPYNOTE)) { populateScreenControls(voNote); showBtnNew(true); } else { showBtnNew(true); } } else { showBtnNew(true); } } }
/** * 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); }
public ClinicalNotesVo saveClinicalNotesOnlyForCareContext(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.careContext.id = " + voClinicaNotes.getCareContext().getID_CareContext() + "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.careContext.id = " + voClinicaNotes.getCareContext().getID_CareContext() + "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 Care Context, the screen will be refreshed"); } } ClinicalNotes doClinNotes = ClinicalNotesVoAssembler.extractClinicalNotes(factory, voClinicaNotes); CareContext doCareContext = getCurrentCareContext(voClinicaNotes.getCareContext()); //WDEV-19027 doClinNotes.setCareContext(doCareContext);//WDEV-19027 factory.save(doClinNotes); return ClinicalNotesVoAssembler.create(doClinNotes); }
public OutpatientNotesOutcomeVo saveOutpatientNotesOutcomePerCareContext(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.careContext.id = " + record.getClinicalNote().getClinicalNote().getCareContext().getID_CareContext() + "and l1_1.id <> -882 and l1_1 <> -883)"); // clinicalNote.noteType != ( SUMARIONADMISION(-882) and DISCHARGENOTE(-883)) } else { hql.append(" where (p.careContext.id = " + record.getClinicalNote().getClinicalNote().getCareContext().getID_CareContext() + "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 Care context, 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); }