private boolean isPrimary(PatientDiagnosisAtConsultationVo diagnose) { if(diagnose == null || diagnose.getPrimaryForCareSpells() == null || diagnose.getPrimaryForCareSpells().size() == 0) return false; for(CSPrimaryDiagnosisShortVo primary : diagnose.getPrimaryForCareSpells()) { if(primary == null || primary.getCareContext() == null) continue; if(primary.getCareContext().equals(form.getLocalContext().getCareContext()) && Boolean.TRUE.equals(primary.getIsActive()))//WDEV-17356 return true; } return false; }
public PatientDiagnosisAtConsultationVoCollection saveDiagnosis(PatientDiagnosisAtConsultationVoCollection diagnosis) throws StaleObjectException { if(diagnosis == null) throw new CodingRuntimeException("Cannot save a null PatientDiagnosisAtConsultationVoCollection."); if(!diagnosis.isValidated()) throw new CodingRuntimeException("PatientDiagnosisAtConsultationVoCollection is not validated."); DomainFactory factory = getDomainFactory(); PatientDiagnosisAtConsultationVoCollection coll = new PatientDiagnosisAtConsultationVoCollection(); for(PatientDiagnosisAtConsultationVo diagnose : diagnosis) { if(diagnose == null) continue; PatientDiagnosis doDiagnose = PatientDiagnosisAtConsultationVoAssembler.extractPatientDiagnosis(factory, diagnose); factory.save(doDiagnose); coll.add(PatientDiagnosisAtConsultationVoAssembler.create(doDiagnose)); } return coll; }
@Override protected void onFormDialogClosed(ims.framework.FormName formName, ims.framework.enumerations.DialogResult result) throws ims.framework.exceptions.PresentationLogicException { if (formName.equals(form.getForms().Clinical.DiagnosisDialog)) { if (form.getGlobalContext().Core.getPatientDiagnosisAtConsultationListIsNotNull() && result.equals(DialogResult.OK)) { form.getGlobalContext().Core.setPatientDiagnosisAtConsultationList(orderGridByDate(form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList())); form.grdDiagnosis().getRows().clear(); for (PatientDiagnosisAtConsultationVo item : form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList()) { grdDiagnosisRow aRow=form.grdDiagnosis().getRows().newRow(); aRow.setcolDate(item.getDiagnosedDate()); aRow.setcolDiagnosisReadOnly(true); aRow.setcolStatus(item.getCurrentStatus().getStatus().getIItemText()); aRow.setcolDiagnosis(item.getDiagnosisDescription()); aRow.setValue(item); } } } updateControlsState(); }
private void addPatientDiagRow(PatientDiagnosisAtConsultationVo diagnose) { if(diagnose == null) return; String status = diagnose.getCurrentStatusIsNotNull() ? diagnose.getCurrentStatus().getStatus().getText()+", " : "" ;//WDEV-22906 ims.emergency.forms.interventionsdiagnosisinvestigationscc.GenForm.grdDiagnosisRow row = form.grdDiagnosis().getRows().newRow(); row.setColDiagnose(status + diagnose.getDiagnosisDescription()); boolean isPrimary = isPrimary(diagnose); row.setBold(isPrimary); row.setTooltipForColDiagnose(getTooltipForPatientDiagnose(diagnose,isPrimary)); //WDEV-21881 if(isPrimary) { row.setColImage(form.getImages().Core.Pin); row.setTooltipForColImage("Main Diagnosis"); form.getLocalContext().setPrimaryDiagnosis(diagnose);//WDEV-17320 } row.setValue(diagnose); }
private String getTooltipForPatientDiagnose(PatientDiagnosisAtConsultationVo diagnose, boolean isPrimary) { if (diagnose==null) return ""; StringBuffer tooltip= new StringBuffer(); tooltip.append(diagnose.getDiagnosisDescriptionIsNotNull() ? "<b>Description: </b>" + diagnose.getDiagnosisDescription() : ""); if (diagnose.getAuthoringInfoIsNotNull()) { tooltip.append(diagnose.getAuthoringInfo().getAuthoringHcpIsNotNull() && diagnose.getAuthoringInfo().getAuthoringHcp().getMosIsNotNull() ? "<br><b>Authoring HCP: </b>" + diagnose.getAuthoringInfo().getAuthoringHcp().getMos().getName() : ""); tooltip.append(diagnose.getAuthoringInfo().getAuthoringHcpIsNotNull() && diagnose.getAuthoringInfo().getAuthoringDateTimeIsNotNull() ? "<br><b>Authoring Date/Time: </b>" + diagnose.getAuthoringInfo().getAuthoringDateTime() : ""); } tooltip.append(diagnose.getDiagLateralityIsNotNull() ? "<br><b>Laterality: </b>" + diagnose.getDiagLaterality().getText() : ""); tooltip.append(diagnose.getCurrentStatusIsNotNull() && diagnose.getCurrentStatus().getStatusIsNotNull() ? "<br><b>Status: </b>" + diagnose.getCurrentStatus().getStatus().getText() : ""); tooltip.append(isPrimary ? "<br><b>Main Diagnosis </b>" : ""); return tooltip!=null ? tooltip.toString() : null; }
private boolean isPrimary(PatientDiagnosisAtConsultationVo diagnose) { if(diagnose == null || diagnose.getPrimaryForCareSpells() == null || diagnose.getPrimaryForCareSpells().size() == 0) return false; for(CSPrimaryDiagnosisShortVo primary : diagnose.getPrimaryForCareSpells()) { if(primary == null || primary.getCareContext() == null) continue; if(primary.getCareContext().equals(diagnose.getCareContext()) && Boolean.TRUE.equals(primary.getIsActive())) return true; } return false; }
public Boolean isStaleOnDiagnosis(ValueObject diagnosis) //WDEV-19239 { if(diagnosis == null) return false; DomainFactory factory = getDomainFactory(); List<?> appts=null; if(diagnosis instanceof PatientDiagnosisAtConsultationVo) { PatientDiagnosisAtConsultationVo patDiag = (PatientDiagnosisAtConsultationVo) diagnosis; appts = factory.find("select a.id from PatientDiagnosis as a where a.id = :DiagnosisId and a.version > :DiagnosisVersion", new String[] {"DiagnosisId", "DiagnosisVersion"}, new Object[] {patDiag.getID_PatientDiagnosis(), patDiag.getVersion_PatientDiagnosis()}); } else if(diagnosis instanceof CodedDiagnosesForAttendanceVo) { CodedDiagnosesForAttendanceVo codedDiag = (CodedDiagnosesForAttendanceVo) diagnosis; appts = factory.find("select a.id from CodedDiagForAttendance as a where a.id = :DiagnosisId and a.version > :DiagnosisVersion", new String[] {"DiagnosisId", "DiagnosisVersion"}, new Object[] {codedDiag.getID_CodedDiagForAttendance(), codedDiag.getVersion_CodedDiagForAttendance()}); } if(appts != null && appts.size() > 0) return true; return false; }
private void populatePatientDiagnosisGrid(PatientDiagnosisAtConsultationVoCollection patientDiagnosisAtConsultationVoCollection) { form.grdDiagnosis().getRows().clear(); if(patientDiagnosisAtConsultationVoCollection == null || patientDiagnosisAtConsultationVoCollection.size() == 0) return; if(Boolean.TRUE.equals(form.getLocalContext().getAddedDuringCoding())) patientDiagnosisAtConsultationVoCollection.sort(); for(PatientDiagnosisAtConsultationVo diagnose : patientDiagnosisAtConsultationVoCollection) { if(diagnose == null) continue; ims.emergency.forms.interventionsdiagnosisinvestigationscc.GenForm.grdDiagnosisRow row = form.grdDiagnosis().getRows().newRow(); row.setColDiagnose(diagnose.getDiagnosisDescription()); boolean isPrimary = isPrimary(diagnose); row.setBold(isPrimary); if(isPrimary) { row.setColImage(form.getImages().Core.Pin); row.setTooltipForColImage("Main Diagnosis"); form.getLocalContext().setPrimaryDiagnosis(diagnose);//WDEV-17320 } row.setValue(diagnose); } }
private void doRIE() { boolean isStale = false; if(form.getLocalContext().getRIERecord() instanceof PatientDiagnosisAtConsultationVo) { if(domain.isStaleOnDiagnosis(form.getLocalContext().getRIERecord())) { isStale = true; } } if(isStale) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return; } try { domain.markAsRie(form.getLocalContext().getRIERecord(), engine.getFormName(), form.getLocalContext().getPatient().getID_Patient(), null, form.getLocalContext().getCareContext().getID_CareContext(), form.getGlobalContext().Core.getRieMessage()); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return; } }
private void saveDiagnosisSequence() { PatientDiagnosisAtConsultationVoCollection diagnosisList = form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList(); for (int gridIndex = 0 ; gridIndex < form.grdDiagnosis().getRows().size() ; gridIndex++) { PatientDiagnosisAtConsultationVo diagnosisVo = (PatientDiagnosisAtConsultationVo)form.grdDiagnosis().getRows().get(gridIndex).getValue(); diagnosisVo.setCodingSequence(gridIndex); diagnosisList.set(diagnosisList.indexOf(diagnosisVo), diagnosisVo); } String[] errors = diagnosisList.validate(); if(errors != null && errors.length >0) { engine.showErrors(errors); return; } try { form.getGlobalContext().Core.setPatientDiagnosisAtConsultationList(domain.saveDiagnosis(diagnosisList)); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getGlobalContext().Core.setPatientDiagnosisAtConsultationList(domain.listPatientDiagnosis(form.getLocalContext().getCareContext())); populatePatientDiagnosisGrid(form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList()); } }
public PatientDiagnosisAtConsultationVo getPatientDiagnosis(PatientDiagnosisRefVo patDiagnosis) { if(patDiagnosis == null || patDiagnosis.getID_PatientDiagnosis() == null) return null; DomainFactory factory = getDomainFactory(); PatientDiagnosis doPatDiagnosis = (PatientDiagnosis) factory.getDomainObject(PatientDiagnosis.class, patDiagnosis.getID_PatientDiagnosis()); return PatientDiagnosisAtConsultationVoAssembler.create(doPatDiagnosis); }
private boolean isPrimaryDiagnosisActive(PatientDiagnosisAtConsultationVo voPatDiag) { if (voPatDiag == null || voPatDiag.getPrimaryForCareSpells() == null) return false; return isPrimaryDiagnosisActive(voPatDiag, voPatDiag.getPrimaryForCareSpells()); }
private PatientDiagnosisAtConsultationVoCollection orderGridByDate(PatientDiagnosisAtConsultationVoCollection diagnosises) { Vector<PatientDiagnosisAtConsultationVo> v=new Vector<PatientDiagnosisAtConsultationVo>(); for (int i=0;i<diagnosises.size();i++) { if (v.size()==0) v.add(diagnosises.get(i)); else { PatientDiagnosisAtConsultationVo diagnosis = diagnosises.get(i); if (diagnosis.getAuthoringInfoIsNotNull()&&diagnosis.getAuthoringInfo().getAuthoringDateTimeIsNotNull()) { int n=v.size(); for (int j=0;j<n;j++) { if (v.get(j).getAuthoringInfoIsNotNull()&&v.get(j).getAuthoringInfo().getAuthoringDateTimeIsNotNull()) { if (diagnosis.getAuthoringInfo().getAuthoringDateTime().compareTo(v.get(j).getAuthoringInfo().getAuthoringDateTime())<0) v.add(j, diagnosis); else v.add(diagnosis); } } } } } diagnosises.clear(); for (int x=0;x<v.size();x++) { diagnosises.add(v.get(x)); } return diagnosises; }
private void populateScreenFromData(PatientDiagnosisAtConsultationVo patDiagnosis) { if (patDiagnosis.getAuthoringInfoIsNotNull()) form.ccAuthoringInfo().setValue(patDiagnosis.getAuthoringInfo()); form.getLocalContext().setDiagnosisDescription(patDiagnosis.getDiagnosisDescription()); if(patDiagnosis.getDiagnosis() != null) { form.qmbDiagnosis().newRow(patDiagnosis.getDiagnosis(), patDiagnosis.getDiagnosisDescription()); form.qmbDiagnosis().setValue(patDiagnosis.getDiagnosis()); } else { DiagLiteVo d = new DiagLiteVo(); d.setDiagnosisName(patDiagnosis.getDiagnosisDescription()); form.qmbDiagnosis().newRow(d, d.getDiagnosisName()); form.qmbDiagnosis().setValue(d); } form.qmbDiagnosis().setEnabled(true); CSPrimaryDiagnosisShortVoCollection voColl = patDiagnosis.getPrimaryForCareSpells(); form.chkMain().setValue(false); for (int i = 0 ; voColl != null && i < voColl.size() ; i++) { if (voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()) && Boolean.TRUE.equals(voColl.get(i).getIsActive()))//WDEV-17356 form.chkMain().setValue(true); } if (patDiagnosis.getCurrentStatusIsNotNull()) if (patDiagnosis.getCurrentStatus().getStatusIsNotNull()) form.cmbStatus().setValue(patDiagnosis.getCurrentStatus().getStatus()); form.ccAuthoringInfo().setMode(FormMode.VIEW); }
private void clearPreviousPrimaryDiagnosis(PatientDiagnosisAtConsultationVo diagnosisVo) { if(diagnosisVo == null) return; if(form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList() == null || form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList().size() == 0) return; if(!form.chkMain().getValue()) return; for(PatientDiagnosisAtConsultationVo diag : form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList()) { if(diag == null || diag.equals(diagnosisVo)) continue; CSPrimaryDiagnosisShortVoCollection primaryColl = diag.getPrimaryForCareSpells(); if(primaryColl == null || primaryColl.size() == 0) continue; for(CSPrimaryDiagnosisShortVo primary : primaryColl) { if(primary == null) continue; if(primary.getCareContextIsNotNull() && primary.getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext())) { primaryColl.remove(primary); diag.setPrimaryForCareSpells(primaryColl); break; } } } }
private void editDiagnose() //WDEV-19239 { if(form.grdDiagnosis().getValue() != null && form.grdDiagnosis().getValue() instanceof PatientDiagnosisAtConsultationVo) { form.getGlobalContext().Core.setPatientDiagnosisAtConsultation(domain.getPatientDiagnosis((PatientDiagnosisAtConsultationVo)form.grdDiagnosis().getValue())); if(form.getGlobalContext().Core.getPatientDiagnosisAtConsultation() == null) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getGlobalContext().Core.setPatientDiagnosisAtConsultationList(domain.listPatientDiagnosis(form.getLocalContext().getCareContext())); populatePatientDiagnosisGrid(form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList()); resetPIDBarText();//WDEV-17334 updateControlsState();//WDEV-17334 return; } engine.open(form.getForms().Clinical.DiagnosisDialog, new Object[] {null,Boolean.FALSE}); //WDEV-21039 } else if(form.grdDiagnosis().getValue() != null && form.grdDiagnosis().getValue() instanceof CodedDiagnosesForAttendanceVo) { form.getGlobalContext().Core.setCodedDiagnosesForAttendance(domain.getCodedDiagForAttendance((CodedDiagnosesForAttendanceVo)form.grdDiagnosis().getValue())); if(form.getGlobalContext().Core.getCodedDiagnosesForAttendance() == null) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); form.getGlobalContext().Core.setCodedDiagnosisForAttendanceList(domain.listCodedDiagnosesForAttendance(form.getLocalContext().getCareContext(),false)); populatePatientDiagnosisGrid(form.getGlobalContext().Core.getPatientDiagnosisAtConsultationList()); resetPIDBarText();//WDEV-17334 updateControlsState();//WDEV-17334 return; } engine.open(form.getForms().Clinical.CodedDiagnosisForAttendanceDialog, new Object[] {null,Boolean.FALSE}); //WDEV-21039 } }
public int compare(Object ob1, Object ob2) { Integer seq1 = null; Integer seq2 = null; if(ob1 instanceof PatientDiagnosisAtConsultationVo ) { PatientDiagnosisAtConsultationVo patDiag1 = (PatientDiagnosisAtConsultationVo)ob1; seq1 = patDiag1 != null && patDiag1.getCodingSequence()!=null ? patDiag1.getCodingSequence():-1; } else if(ob1 instanceof CodedDiagnosesForAttendanceVo ) { CodedDiagnosesForAttendanceVo codedDiag1 = (CodedDiagnosesForAttendanceVo)ob1; seq1 = codedDiag1 != null && codedDiag1.getCodingSequence()!=null ? codedDiag1.getCodingSequence():-1; } if(ob2 instanceof PatientDiagnosisAtConsultationVo ) { PatientDiagnosisAtConsultationVo patDiag2 = (PatientDiagnosisAtConsultationVo)ob2; seq2 = patDiag2 != null && patDiag2.getCodingSequence()!=null ? patDiag2.getCodingSequence() : -1; } else if(ob2 instanceof CodedDiagnosesForAttendanceVo ) { CodedDiagnosesForAttendanceVo codedDiag2 = (CodedDiagnosesForAttendanceVo)ob2; seq2 = codedDiag2 != null && codedDiag2.getCodingSequence()!=null ? codedDiag2.getCodingSequence():-1; } if(seq1 != null ) return seq1.compareTo(seq2)*direction; if(seq2 != null) return (-1)*direction; return 0; }
private void populateScreenFromData(PatientDiagnosisAtConsultationVo patDiagnosis) { if (patDiagnosis.getAuthoringInfoIsNotNull()) form.ccAuthoringInfo().setValue(patDiagnosis.getAuthoringInfo()); form.getLocalContext().setDiagnosisDescription(patDiagnosis.getDiagnosisDescription()); if(patDiagnosis.getDiagnosis() != null) { form.qmbDiagnosis().newRow(patDiagnosis.getDiagnosis(), patDiagnosis.getDiagnosisDescription()); form.qmbDiagnosis().setValue(patDiagnosis.getDiagnosis()); } else { DiagLiteVo d = new DiagLiteVo(); d.setDiagnosisName(patDiagnosis.getDiagnosisDescription()); form.qmbDiagnosis().newRow(d, d.getDiagnosisName()); form.qmbDiagnosis().setValue(d); } form.qmbDiagnosis().setEnabled(true); CSPrimaryDiagnosisShortVoCollection voColl = patDiagnosis.getPrimaryForCareSpells(); form.chkMain().setValue(false); for (int i = 0 ; voColl != null && i < voColl.size() ; i++) { if (voColl.get(i).getCareContextIsNotNull() && voColl.get(i).getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext()) && Boolean.TRUE.equals(voColl.get(i).getIsActive()))//WDEV-17356 form.chkMain().setValue(true); } if (patDiagnosis.getCurrentStatusIsNotNull()) if (patDiagnosis.getCurrentStatus().getStatusIsNotNull()) form.cmbStatus().setValue(patDiagnosis.getCurrentStatus().getStatus()); form.cmbLaterality().setValue(patDiagnosis.getDiagLateralityIsNotNull() ? patDiagnosis.getDiagLaterality() : null);//WDEV-19056 form.ccAuthoringInfo().setMode(FormMode.VIEW); }