public void open() throws ims.framework.exceptions.PresentationLogicException { clearControls(); setCurrentClinicalNote(); if (form.getGlobalContext().Core.getCurrentCareContextIsNotNull()) { //WDEV-1037 - Notes created on this form need to have notetype set to SUMMARYATADMISSION( -882) and have discipline set to MEDICAL ( -59) form.getLocalContext().setSelectedRecord(domain.get(null, ClinicalNoteType.SUMMARYATADMISSION, HcpDisType.MEDICAL ,form.getGlobalContext().Core.getCurrentCareContext())); if (form.getLocalContext().getSelectedRecordIsNotNull()) { ClinicalNotesVo admissionNotes = form.getLocalContext().getSelectedRecord().getAdmissionNotes(); if (admissionNotes != null) { if (admissionNotes.getAuthoringInfoIsNotNull()) form.customControlAuthoringInfo().setValue(admissionNotes.getAuthoringInfo()); form.txtSummary().setValue(admissionNotes.getClinicalNote()); } } } form.setMode(FormMode.VIEW); }
public ClinicalNotesLiteVoCollection listClinicalNotesByCareContextAndNoteType(CareContextRefVo careContext, ClinicalNoteType noteType) { ClinicalNotesList impl = (ClinicalNotesList) getDomainImpl(ClinicalNotesListImpl.class); ClinicalNotesFilterVo voFilter = new ClinicalNotesFilterVo(); voFilter.setNoteType(noteType); voFilter.setCareContext(careContext); return impl.listClinicalNoteLite(voFilter); }
private void checkForExistingClinicalNotes(ClinicalNotesVo voNote) throws FormOpenException { if ((voNote !=null && voNote.getSourceOfNoteIsNotNull() && ! voNote.getSourceOfNote().equals(SourceOfNote.THERAPYSOAPNOTE)) || (voNote != null && voNote.getNoteTypeIsNotNull() &&//wdev-4952 !(voNote.getNoteType().equals(ClinicalNoteType.DISCHARGENOTE) || voNote.getNoteType().equals(ClinicalNoteType.SUMMARYATADMISSION)) && voNote.getIsDerivedNoteIsNotNull() && !voNote.getIsDerivedNote().booleanValue())) throw new FormOpenException("There is a clinical note of a different type already recorded on the system for this clincal contact"); }
private void checkForDiscipline(ClinicalNotesShortVo voClinNote) { MemberOfStaffShortVo mos = null; if (getDisciplineForLoggedInUser(form.getGlobalContext().Clinical.getCurrentClinicalNote()) != null) mos = getDisciplineForLoggedInUser(domain.getClinicalNote((ClinicalNotesShortVo)form.dyngrdNotes().getValue())); else engine.showMessage("No discipline for logged in user"); Hcp voHcp = (Hcp) domain.getHcpUser(); if (form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull() ) { if (form.getGlobalContext().Clinical.getCurrentClinicalNote().getCurrentStatusIsNotNull() && form.getGlobalContext().Clinical.getCurrentClinicalNote().getDisciplineIsNotNull() && mos != null && mos.getHcpIsNotNull()) { if (!domain.getClinicalNote(voClinNote).getDiscipline().equals(mos.getHcp().getHcpType())) { form.getContextMenus().getClinicalNotingEDITItem().setVisible(false); } if (rulesForValidationContexMenus(voClinNote, voHcp)) { form.getContextMenus().getClinicalNotingEDITItem().setVisible(false); } if (ClinicalNoteType.DISCHARGENOTE.equals(form.getGlobalContext().Clinical.getCurrentClinicalNote().getNoteType()) || ClinicalNoteType.SUMMARYATADMISSION.equals(form.getGlobalContext().Clinical.getCurrentClinicalNote().getNoteType())) { form.getContextMenus().getClinicalNotingEDITItem().setVisible(false); } } } }
private void checkForExistingClinicalNotes(ClinicalNotesVo voNote) throws FormOpenException { if ((voNote !=null && voNote.getSourceOfNoteIsNotNull() && ! voNote.getSourceOfNote().equals(SourceOfNote.TLT_NOTE)) || (voNote != null && voNote.getNoteTypeIsNotNull() &&//wdev-4952 !(voNote.getNoteType().equals(ClinicalNoteType.DISCHARGENOTE) || voNote.getNoteType().equals(ClinicalNoteType.SUMMARYATADMISSION)) && voNote.getIsDerivedNoteIsNotNull() && !voNote.getIsDerivedNote().booleanValue())) throw new FormOpenException("There is a clinical note of a different type already recorded on the system for this clincal contact"); }
private void openTherapiesSOAP() throws PresentationLogicException { clearDetails(); setCurrentClinicalNote(); form.setMode(FormMode.VIEW); showHideCustomComponent(form.customControlAuthoring(), Boolean.FALSE, false); if (form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull()) { checkCurrentClinicalNote(); populateScreenControls(form.getGlobalContext().Clinical.getCurrentClinicalNote()); if (form.getGlobalContext().Clinical.getReturnToFormModeIsNotNull() && form.getGlobalContext().Clinical.getReturnToFormMode().equals(FormMode.EDIT)) { openAsDialog(); } else { ClinicalNotesVo note = form.getGlobalContext().Clinical.getCurrentClinicalNote(); boolean isDraft = note.getCurrentStatusIsNotNull() && ClinicalNotesStatus.DRAFT.equals(note.getCurrentStatus().getStatus()); boolean myNote = note.getAuthoringInfoIsNotNull() && note.getAuthoringInfo().getAuthoringHcpIsNotNull() && note.getAuthoringInfo().getAuthoringHcp().equals(domain.getHcpLiteUser()); showBtnEdit((isDraft && myNote) || !isDraft); showBtnNew(false); } } 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().Core.getCurrentClinicalContactIsNotNull()) { ClinicalNotesVo voNote = domain.getClinicalNotes(form.getGlobalContext().Core.getCurrentClinicalContact()); checkForExistingClinicalNotes(voNote); if (voNote != null && voNote.getNoteTypeIsNotNull() &&//wdev-4952 voNote.getNoteType().equals(ClinicalNoteType.THERAPYNOTE)) { populateScreenControls(voNote); showBtnEdit(true); showBtnNew(false); } else { showBtnNew(true); showBtnEdit(false); } } else { showBtnEdit(false); showBtnNew(false); } } if(engine.isDialog() && form.getGlobalContext().Clinical.getReturnToFormMode().equals(FormMode.VIEW)) showBtnEdit(false); }
private void updateControlsState() { clearContextMenu(); if (form.dyngrdNotes().getSelectedRow() != null && form.dyngrdNotes().getSelectedRow().getValue() != null) { form.getContextMenus().getClinicalNotingEDITItem().setVisible(true); //If its a transcribed record, a non-HCP user and has been moved on in status make the screen R/O fo the logged in use. if (form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull() && form.getGlobalContext().Clinical.getCurrentClinicalNote().getIsTranscribedIsNotNull() // && form.getGlobalContext().Clinical.getCurrentClinicalNote().getIsTranscribed().booleanValue() && domain.getHcpLiteUser() == null) { if (form.getGlobalContext().Clinical.getCurrentClinicalNote().getCurrentStatusIsNotNull() && ! form.getGlobalContext().Clinical.getCurrentClinicalNote().getCurrentStatus().getStatus().equals(ClinicalNotesStatus.DRAFT) && ! form.getGlobalContext().Clinical.getCurrentClinicalNote().getCurrentStatus().getStatus().equals(ClinicalNotesStatus.PREVALIDATION) ) { form.getContextMenus().getClinicalNotingEDITItem().setVisible(false); } } //form.getContextMenus().getClinicalNotingEDITItem().setVisible(true); form.getContextMenus().getClinicalNotingVIEWItem().setVisible(true); if (form.dyngrdNotes().getSelectedRow().getValue() instanceof ClinicalNotesShortVo) { ClinicalNotesShortVo voNote = (ClinicalNotesShortVo)form.dyngrdNotes().getSelectedRow().getValue(); Hcp voHcp = (Hcp) domain.getHcpUser(); if (voNote.getNoteTypeIsNotNull() && !(voNote.getNoteType().equals(ClinicalNoteType.DISCHARGENOTE) || voNote.getNoteType().equals(ClinicalNoteType.SUMMARYATADMISSION))) { if (rulesForReviewContexMenus(voNote, voHcp)) form.getContextMenus().getClinicalNotingREVIEWItem().setVisible(true); if (voNote.getReviewingDateTimeIsNotNull() || voNote.getReviewingHCPIsNotNull()) form.getContextMenus().getClinicalNotingREVIEWItem().setVisible(false); if (rulesForValidationContexMenus(voNote, voHcp)) { form.getContextMenus().getClinicalNotingVALIDATEItem().setVisible(true); form.getContextMenus().getClinicalNotingEDITItem().setVisible(false); } if (rulesForCorrectContexMenus(voNote)) form.getContextMenus().getClinicalNotingEDITItem().setText("Correct"); else form.getContextMenus().getClinicalNotingEDITItem().setText("Edit"); } else { form.getContextMenus().hideAllClinicalNotingMenuItems(); } } } }
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); } } }
public ClinicalNotesVo saveClinicalNotesAndClinicalContact(ClinicalNotesVo clinicalNote, ClinicalContactShortVo clinicalContact) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException { if (clinicalNote == null) throw new DomainRuntimeException("Clinical Notes is null"); // Ensure the value object has been validated if (!clinicalNote.isValidated()) throw new DomainRuntimeException("Clinical Notes has not been validated"); DomainFactory factory = getDomainFactory(); //is new clinical note and is created for a clinical contact if (!clinicalNote.getID_ClinicalNotesIsNotNull() && clinicalNote.getClinicalContactIsNotNull()) { if (!clinicalNote.getClinicalContact().getID_ClinicalContactIsNotNull()) throw new DomainRuntimeException("The clinical contact from the clinical notes has no valid id"); if (clinicalContact == null) throw new DomainRuntimeException("The clinical contact you provided should not be null "); if (!clinicalNote.getClinicalContact().getID_ClinicalContact().equals(clinicalContact.getID_ClinicalContact())) throw new DomainRuntimeException("The clinical contact you provided should be the same with the clinical contact from the clinical note "); String query = "select distinct cn.sourceOfNote.id from ClinicalNotes as cn where " + "(cn.clinicalContact.id = :ClinicalContact_id and " + "cn.noteType.id not in ("+ ClinicalNoteType.SUMMARYATADMISSION.getID()+","+ClinicalNoteType.DISCHARGENOTE.getID()+") and cn.isRIE is null )"; List<?> nodeTypes = factory.find(query, "ClinicalContact_id", clinicalNote.getClinicalContact().getID_ClinicalContact()); if (nodeTypes != null && nodeTypes.size() > 0) { if (SourceOfNote.CLINICALCLINICALNOTE.getID() == ((Integer)nodeTypes.get(0)).intValue()) { throw new CodingRuntimeException("A clinical note has been created by another user, the screen will be refreshed"); } throw new CodingRuntimeException("ANOTHER_NOTE_FOR_CLINICAL_CONTACT"); } //save clinicalcontact ClinicalContact extractClinicalContact = ClinicalContactShortVoAssembler.extractClinicalContact(factory,clinicalContact); // It is possible that somebody changed the clinical contact . So, as this is a background operation //we should get latest version to avoid stale. factory.refresh(extractClinicalContact); extractClinicalContact.setIsClinicalNoteCreated(Boolean.TRUE); factory.save(extractClinicalContact); clinicalContact = ClinicalContactShortVoAssembler.create(extractClinicalContact); clinicalNote.setClinicalContact(clinicalContact); } ClinicalNotes doClinNotes = ClinicalNotesVoAssembler.extractClinicalNotes(factory, clinicalNote); factory.save(doClinNotes); return ClinicalNotesVoAssembler.create(doClinNotes); }
/** * get admission recod fo a context */ public OnAdmissionSummaryVo get(ClinicalContactRefVo clinicalContactRefVo, ClinicalNoteType noteType, HcpDisType disciplineType, CareContextRefVo careContextRefVo) { if(careContextRefVo == null) throw new DomainRuntimeException("Cannot get OnAdmissionSummaryVo for null CareContextRefVo "); ArrayList<Serializable> values = new ArrayList<Serializable>(); ArrayList<String> params = new ArrayList<String>(); StringBuffer hql = new StringBuffer(); hql.append("from OnAdmissionSummary oas"); String clause = " where "; if(clinicalContactRefVo != null) { hql.append(clause); hql.append("oas.clinicalContact.id = :clinicalContactId"); params.add("clinicalContactId"); values.add(clinicalContactRefVo.getID_ClinicalContact()); clause = " and "; } hql.append(clause); hql.append("oas.careContext.id = :careContextId"); params.add("careContextId"); values.add(careContextRefVo.getID_CareContext()); clause = " and "; if(noteType != null) { hql.append(clause); hql.append("oas.admissionNotes.noteType = :noteType"); params.add("noteType"); values.add(getDomLookup(noteType)); clause = " and "; } if(disciplineType != null) { hql.append(clause); hql.append("oas.admissionNotes.discipline = :discType"); params.add("discType"); values.add(getDomLookup(disciplineType)); clause = " and "; } DomainFactory factory = getDomainFactory(); java.util.List assSumList = factory.find(hql.toString(), params, values); if ((assSumList != null) && (assSumList.size()>0)) { //wdev-7165 - assSumList contains records RIE, but col will not. OnAdmissionSummaryVoCollection col = OnAdmissionSummaryVoAssembler.createOnAdmissionSummaryVoCollectionFromOnAdmissionSummary(assSumList); return col.size() > 0 ? col.get(0) : null; } else return null; }
private void openTherapiesSOAP() throws PresentationLogicException { clearDetails(); setCurrentClinicalNote(); form.setMode(FormMode.VIEW); showHideCustomComponent(form.customControlAuthoring(), Boolean.FALSE, false); if (form.getGlobalContext().Clinical.getCurrentClinicalNoteIsNotNull()) { checkCurrentClinicalNote(); populateScreenControls(form.getGlobalContext().Clinical.getCurrentClinicalNote()); if (form.getGlobalContext().Clinical.getReturnToFormModeIsNotNull() && form.getGlobalContext().Clinical.getReturnToFormMode().equals(FormMode.EDIT)) { openAsDialog(); } else { ClinicalNotesVo note = form.getGlobalContext().Clinical.getCurrentClinicalNote(); boolean isDraft = note.getCurrentStatusIsNotNull() && ClinicalNotesStatus.DRAFT.equals(note.getCurrentStatus().getStatus()); boolean myNote = note.getAuthoringInfoIsNotNull() && note.getAuthoringInfo().getAuthoringHcpIsNotNull() && note.getAuthoringInfo().getAuthoringHcp().equals(domain.getHcpLiteUser()); showBtnEdit((isDraft && myNote) || !isDraft); showBtnNew(false); } } 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().Core.getCurrentClinicalContactIsNotNull()) { ClinicalNotesVo voNote = domain.getClinicalNotes(form.getGlobalContext().Core.getCurrentClinicalContact()); checkForExistingClinicalNotes(voNote); if (voNote != null && voNote.getNoteTypeIsNotNull() &&//wdev-4952 voNote.getNoteType().equals(ClinicalNoteType.THERAPYNOTE)) { populateScreenControls(voNote); showBtnEdit(true); showBtnNew(false); } else { showBtnNew(true); showBtnEdit(false); } } else if (form.getGlobalContext().Core.getCurrentCareContextIsNotNull()) // WDEV-20525 Enable buttons for CareContext { showBtnNew(true); showBtnEdit(false); } else { showBtnEdit(false); showBtnNew(false); } } if(engine.isDialog() && form.getGlobalContext().Clinical.getReturnToFormMode().equals(FormMode.VIEW)) showBtnEdit(false); }