private String getIdentifier(TrackingVo trackingPatient, PatIdType identifierType) { if(trackingPatient == null || identifierType == null) return null; String chartNumber = null; if(trackingPatient.getPatientIsNotNull() && trackingPatient.getPatient().getIdentifiersIsNotNull()) { for(int j=0; j<trackingPatient.getPatient().getIdentifiers().size(); j++) { if(identifierType.equals(trackingPatient.getPatient().getIdentifiers().get(j).getType())) { chartNumber = trackingPatient.getPatient().getIdentifiers().get(j).getValue(); } } } return chartNumber; }
private int compareByLOS(TrackingVo o1, TrackingVo o2) { if(o1 != null && o1.getAttendance() != null && o1.getAttendance().getLengthOfStay() != null && o2 != null && o2.getAttendance() != null && o2.getAttendance().getLengthOfStay() != null) { int orderByLOS = -1 * o1.getAttendance().getLengthOfStay().compareTo(o2.getAttendance().getLengthOfStay()); if(orderByLOS == 0) { return compareByName(o1, o2); } return orderByLOS; } if (o1 == null || o1.getAttendance() == null || o1.getAttendance().getLengthOfStay() == null) return -1; if (o2 == null || o2.getAttendance() == null || o2.getAttendance().getLengthOfStay() == null) return 1; return 0; }
@Override protected void onBtnTransferClick() throws PresentationLogicException { //wdev-16867 TrackingWithPartialAdmissionVo trackingWithDNW = domain.getTrackingWithEDPartialAdmission((TrackingVo) form.dyngrdTrack().getValue()); if( trackingWithDNW != null ) form.getGlobalContext().Emergency.setEDTransferVo(trackingWithDNW.getCurrentTransferRecord()); if( trackingWithDNW.getCurrentPartialAdmissionIsNotNull() && !AllocationStatus.CANCELLED_ADMISSION.equals(trackingWithDNW.getCurrentPartialAdmission().getAllocatedStatus())) { form.getLocalContext().setPartialAdmissionForTrackingVo(trackingWithDNW.getCurrentPartialAdmission()); form.getLocalContext().setDTAWithTransferMessageId(engine.showMessage("A decision to admit record exists for this patient. If you proceed to Transfer the patient, the record will be cancelled on the ED system and the PAS system. Are you sure you want to continue?","Confirm Transfer" ,MessageButtons.YESNO, MessageIcon.QUESTION)); } else engine.open(form.getForms().Emergency.TransferDialog); //------------ }
private void incrementPriority(TrackingVo trackingPatient) { String priority = ((trackingPatient.getTriageDetails() != null && trackingPatient.getTriageDetails().getCurrentTriagePriority() != null) ? trackingPatient.getTriageDetails().getCurrentTriagePriority().getText(): null); //WDEV-17259 if (trackingPatient.getCurrentStatus() != null && TrackingStatus.SKIPPED_TRIAGE.equals(trackingPatient.getCurrentStatus().getStatus())) { form.getLocalContext().setNoPatientsSkippedTriage(form.getLocalContext().getNoPatientsSkippedTriage()+1); } if (priority==null) return; if (priority.equals("P1")) { form.getLocalContext().setNoPatientsPriority1(form.getLocalContext().getNoPatientsPriority1()+1); } else if (priority.equals("P2")) { form.getLocalContext().setNoPatientsPriority2(form.getLocalContext().getNoPatientsPriority2()+1); } else if (priority.equals("P3")) { form.getLocalContext().setNoPatientsPriority3(form.getLocalContext().getNoPatientsPriority3()+1); } else if (priority.equals("P4")) { form.getLocalContext().setNoPatientsPriority4(form.getLocalContext().getNoPatientsPriority4()+1); } else if (priority.equals("P5")) { form.getLocalContext().setNoPatientsPriority5(form.getLocalContext().getNoPatientsPriority5()+1); } }
private void setContext(TrackingVo tracking) { clearContext(); if(tracking == null) return; form.getGlobalContext().Emergency.setTracking(tracking); if(tracking.getPatient() != null) { PatientShort patientShort = new PatientShort(tracking.getPatient().getID_Patient(), tracking.getPatient().getVersion_Patient()); form.getGlobalContext().Core.setPatientShort(patientShort); } if(tracking.getEpisode() != null && tracking.getEpisode().getEpisodeOfCare() != null) { form.getGlobalContext().Core.setEpisodeofCareShort(domain.getEpisodeOfCare(tracking.getEpisode().getEpisodeOfCare())); } if(tracking.getAttendance() != null && tracking.getAttendance().getCareContext() != null) { form.getGlobalContext().Core.setCurrentCareContext(domain.getCareContext(tracking.getAttendance().getCareContext())); } refreshPIDBarText();//WDEV-17332 }
public int compare(TrackingVo o1, TrackingVo o2) { if (o1 != null && o1.getTriageDetails() != null && o1.getTriageDetails().getCurrentTriagePriority() != null && o2!=null && o2.getTriageDetails() != null && o2.getTriageDetails().getCurrentTriagePriority() != null) { Integer priorityOrder1 = getOrderByIndex(o1.getTriageDetails().getCurrentTriagePriority()); Integer priorityOrder2 = getOrderByIndex(o2.getTriageDetails().getCurrentTriagePriority()); int orderByPriority = 0; //wdev-17215 - the code was crashed here when priorityOrder1 == null or priorityOrder2 == null if( priorityOrder1 != null && priorityOrder2 != null ) //wdev-17215 orderByPriority = priorityOrder1.compareTo(priorityOrder2); if(orderByPriority == 0) { return compareByLOS(o1, o2); } return orderByPriority; } if((o1 == null || o1.getTriageDetails() == null || o1.getTriageDetails().getCurrentTriagePriority() == null) && (o2 == null || o2.getTriageDetails() == null || o2.getTriageDetails().getCurrentTriagePriority() == null)) return compareByLOS(o1, o2); if (o1 == null || o1.getTriageDetails() == null || o1.getTriageDetails().getCurrentTriagePriority() == null) return 1; if (o2 == null || o2.getTriageDetails() == null || o2.getTriageDetails().getCurrentTriagePriority() == null) return -1; return 0; }
private int compareByName(TrackingVo o1, TrackingVo o2) { if(o1 != null && o1.getPatient() != null && o1.getPatient().getName() != null && o2 != null && o2.getPatient() != null && o2.getPatient().getName() != null) { return o1.getPatient().getName().compareTo(o2.getPatient().getName(), true); } if (o1 == null || o1.getPatient() == null || o1.getPatient().getName() == null) return -1; if (o2 == null || o2.getPatient() == null || o2.getPatient().getName() == null) return 1; return 0; }
private void populateRecordsToGrid(TrackingVoCollection trackingPatients) { form.dyngrdTrack().getRows().clear(); for(TrackingVo trackingPatient : trackingPatients) { addTrackingPatientRow(trackingPatient); } form.dyngrdTrack().setValue(form.getLocalContext().getSelectedTrackingPatient()); trackingSelectionChanged(); }
public TrackingVo getTrackingVo(TrackingRefVo trackingRef) { if(trackingRef == null ) throw new CodingRuntimeException("TrackingRefVo cannot be null"); return TrackingVoAssembler.create((Tracking) getDomainFactory().getDomainObject(Tracking.class, trackingRef.getID_Tracking())); }
private boolean isNotValidMRN(TrackingVo trackingPatient, PatIdType identifierType) { if( trackingPatient == null || identifierType == null) return false; if(trackingPatient.getPatient() != null && (MRNStatus.NONE.equals(trackingPatient.getPatient().getMRNStatus()) || MRNStatus.WAITING.equals(trackingPatient.getPatient().getMRNStatus()))) return true; String mrNumber = null; if(trackingPatient.getPatientIsNotNull() && trackingPatient.getPatient().getIdentifiersIsNotNull()) { for(int j=0; j<trackingPatient.getPatient().getIdentifiers().size(); j++) { if(identifierType.equals(trackingPatient.getPatient().getIdentifiers().get(j).getType())) { mrNumber = trackingPatient.getPatient().getIdentifiers().get(j).getValue(); } } } if( mrNumber != null && mrNumber.length() > 0) { mrNumber = mrNumber.trim(); if(mrNumber.length() > 0 && mrNumber.charAt(0) == '9') return true; } return false; }
@Override protected void onBtnTransferClick() throws PresentationLogicException { if(!(form.dyngrdTrack().getValue() instanceof TrackingVo)) return; //wdev-16867 TrackingWithPartialAdmissionVo trackingWithPatialAdmission = domain.getTrackingWithEDPartialAdmission((TrackingVo) form.dyngrdTrack().getValue()); if (trackingWithPatialAdmission == null) return; form.getGlobalContext().Emergency.setEDTransferVo(trackingWithPatialAdmission.getCurrentTransferRecord()); if( trackingWithPatialAdmission.getCurrentPartialAdmissionIsNotNull() && AllocationStatus.ACTIVE.equals(trackingWithPatialAdmission.getCurrentPartialAdmission().getAllocatedStatus()) && (!trackingWithPatialAdmission.getCurrentTransferRecordIsNotNull() || (trackingWithPatialAdmission.getCurrentTransferRecordIsNotNull() && (trackingWithPatialAdmission.getCurrentTransferRecord().getAcceptedDateTimeIsNotNull() || Boolean.TRUE.equals(trackingWithPatialAdmission.getCurrentTransferRecord().getNotAccepted())) ))) { form.getLocalContext().setPartialAdmissionForTrackingVo(trackingWithPatialAdmission); form.getLocalContext().setDTAWithTransferMessageId(engine.showMessage("A decision to admit record exists for this patient. If you proceed to Transfer the patient, the record will be cancelled on the ED system and the PAS system. Are you sure you want to continue?","Confirm Transfer" ,MessageButtons.YESNO, MessageIcon.QUESTION)); } else { form.getLocalContext().setPartialAdmissionForTrackingVo(null); engine.open(form.getForms().Emergency.TransferDialog); } //------------ }
private void populateTrackingGrid() { initializeTrackingGrid(); clearContext(); //WDEV-15971 clearPriorityLocalContexts(); if(!(form.grdTrackingCount().getValue() instanceof TrackingAreaForTrackingVo)) return; boolean isViewMyAllocated = false; if(GroupViewEnumeration.rdoViewMyAllocated.equals(form.GroupView().getValue()))//WDEV-16987 { isViewMyAllocated = true; if(form.getLocalContext().getLoggedHcpRef() == null) return; } TrackingAreaForTrackingVo trackingArea = (TrackingAreaForTrackingVo) form.grdTrackingCount().getValue(); //WDEV-17259 Boolean wasPatientStatusColumnAdded = Boolean.FALSE; for (int x = 0; x < trackingArea.getColumns().size(); x++) { if (TrackingAreaColumn.PATIENT_CURRENT_STATUS.equals(trackingArea.getColumns().get(x).getColumn())) wasPatientStatusColumnAdded = Boolean.TRUE; } //create a dummy column so the the domain will return values for the CurrentStatus.Status field if (Boolean.FALSE.equals(wasPatientStatusColumnAdded)) { ColumnDetailVo dummyColumn = new ColumnDetailVo(); dummyColumn.setColumn(TrackingAreaColumn.PATIENT_CURRENT_STATUS); trackingArea.getColumns().add(dummyColumn); } TrackingVoCollection trackingPatients = domain.listTrackingPatients(trackingArea, Boolean.TRUE.equals(isViewMyAllocated) ? form.getLocalContext().getLoggedHcpRef() : null, null, GroupViewEnumeration.rdoViewUnallocated.equals(form.GroupView().getValue()), GroupDisplayEnumeration.rdoCurrentlyInDept.equals(form.GroupDisplay().getValue()),GroupDisplayEnumeration.rdoDeparted.equals(form.GroupDisplay().getValue()),GroupDisplayEnumeration.rdoCurrentAndDeparted.equals(form.GroupDisplay().getValue()));//WDEV-16987 form.getLocalContext().setTrackingPatients(trackingPatients); if(trackingPatients == null) return; //WDEV-16534 if (form.getLocalContext().getSortOrder() != null) { trackingPatients.sort(new TrackingPatientsComparator((TrackingAreaColumn) form.getLocalContext().getSortOrder().getColumnType(), form.getLocalContext().getSortOrder().getSortOrder())); } else trackingPatients.sort(new TrackingComparator()); for(TrackingVo trackingPatient : trackingPatients) { addTrackingPatientRow(trackingPatient); } form.dyngrdTrack().setValue(form.getLocalContext().getSelectedTrackingPatient()); trackingSelectionChanged(); populatePriorityLabels();//WDEV-15971 }
private void setLOSColorCell(TableCellOptions cellOptions, TrackingVo trackingPatient) { if(cellOptions == null || trackingPatient == null) return; Color losFontColor = null; Color losBackgroudColor = null; Color losFlashingTextColour = null; boolean losBreachWarning = false; boolean losBreached = false; Integer LOS = trackingPatient.getAttendance().getLengthOfStay(); if(LOS != null && form.getLocalContext().getAttendanceKPIConfig() != null) { if(form.getLocalContext().getAttendanceKPIConfig().getLosBreachWarningKPI() != null && form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPI() != null) { if(LOS >= form.getLocalContext().getAttendanceKPIConfig().getLosBreachWarningKPI() && LOS < form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPI()) { losFontColor = form.getLocalContext().getAttendanceKPIConfig().getLosBreachWarningKPITextColour(); losBackgroudColor = form.getLocalContext().getAttendanceKPIConfig().getLosBreachWarningKPIBackgroundColour(); losFlashingTextColour = form.getLocalContext().getAttendanceKPIConfig().getLosBreachWarningKPIFlashingTextColour(); losBreachWarning = true; } else if(LOS >= form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPI()) { losFontColor = form.getLocalContext().getAttendanceKPIConfig().getLosBreachKPITextColour(); losBackgroudColor = form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPIBackgroundColour(); losFlashingTextColour = form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPIFlashingTextColour(); losBreached = true; } } } if((losBreachWarning && YesNo.YES.equals(form.getLocalContext().getAttendanceKPIConfig().getLosBreachWarningKPIFlashingText())) || (losBreached && YesNo.YES.equals(form.getLocalContext().getAttendanceKPIConfig().getLosBreachedKPIFlashingText()))) { if(losFontColor != null && losFlashingTextColour != null && losBackgroudColor != null) cellOptions.setTextAndBackgroundBlink(losFontColor ,losFlashingTextColour ,losBackgroudColor, losBackgroudColor); } if(losBackgroudColor != null) cellOptions.setBackgroundColor(losBackgroudColor); if(losFontColor != null) cellOptions.setTextColor(losFontColor); }
private void setPriorityCellColor(TableCellOptions cellOptions, TrackingVo tracking) { if(cellOptions == null) return; Color priorityFontColor = null; Color priorityBackgroudColor = null; Color priorityFlashingTextColour = null; boolean priorityBreachWarning = false; boolean priorityBreached = false; YesNo priorityBreachWarningFlashing = null; YesNo priorityBreachedFlashing = null; if(tracking != null && tracking.getTriageDetails() != null) { if(tracking.getTriageDetails().getMedicInterventionStartDateTime() != null && tracking.getTriageDetails().getCurrentTriagePriority() != null) { if(tracking.getTriageDetails().getCurrentTriagePriority().getColor() != null) priorityFontColor = tracking.getTriageDetails().getCurrentTriagePriority().getColor(); } else { TriagePriorityKpConfigVo triagePriorityKpConfig = getTriagePriorityKpConfig(tracking.getTriageDetails().getCurrentTriagePriority()); if(triagePriorityKpConfig != null) { if(triagePriorityKpConfig.getDefaultFontColour() != null) priorityFontColor = triagePriorityKpConfig.getDefaultFontColour(); if(triagePriorityKpConfig.getDefaultRowColour()!= null) priorityBackgroudColor = triagePriorityKpConfig.getDefaultRowColour(); } if(tracking.getTriageDetails().getTriageStartDateTime() != null) { int timeSinceTriage = calculateDateDiffInMinutes(new DateTime(), tracking.getTriageDetails().getTriageStartDateTime()); if(triagePriorityKpConfig != null) { if(triagePriorityKpConfig.getPriorityBreachWarningKPI() != null && triagePriorityKpConfig.getPriorityBreachedKPI() != null) { if(timeSinceTriage >= triagePriorityKpConfig.getPriorityBreachWarningKPI() && timeSinceTriage < triagePriorityKpConfig.getPriorityBreachedKPI()) { priorityFontColor = triagePriorityKpConfig.getPriorityBreachWarningKPITextColour(); priorityBackgroudColor = triagePriorityKpConfig.getPriorityBreachWarningKPIBackgroundColour(); priorityFlashingTextColour = triagePriorityKpConfig.getPriorityBreachWarningKPIFlashingTextColour(); priorityBreachWarning = true; priorityBreachWarningFlashing = triagePriorityKpConfig.getPriorityBreachWarningKPIFlashingText(); } else if(timeSinceTriage >= triagePriorityKpConfig.getPriorityBreachedKPI()) { priorityFontColor = triagePriorityKpConfig.getPriorityBreachKPITextColour(); priorityBackgroudColor = triagePriorityKpConfig.getPriorityBreachedKPIBackgroundColour(); priorityFlashingTextColour = triagePriorityKpConfig.getPriorityBreachedKPIFlashingTextColour(); priorityBreached = true; priorityBreachedFlashing = triagePriorityKpConfig.getPriorityBreachedKPIFlashingText(); } } } } } } if((priorityBreachWarning && YesNo.YES.equals(priorityBreachWarningFlashing)) || (priorityBreached && YesNo.YES.equals(priorityBreachedFlashing))) { if(priorityFontColor != null && priorityFlashingTextColour != null && priorityBackgroudColor != null) cellOptions.setTextAndBackgroundBlink(priorityFontColor ,priorityFlashingTextColour ,priorityBackgroudColor, priorityBackgroudColor); } if(priorityBackgroudColor != null) cellOptions.setBackgroundColor(priorityBackgroudColor); if(priorityFontColor != null) cellOptions.setTextColor(priorityFontColor); }
private TrackingVo assembleTracking(Object[] items, AtomicReference<Object> recordIndexRef) { int recordIndex = (Integer) recordIndexRef.get(); Integer trackingId = (Integer) items[recordIndex++]; Integer trackingVersion = (Integer) items[recordIndex++]; Boolean trackingIsDischarged = (Boolean) items[recordIndex++]; TrackingVo tracking = new TrackingVo(trackingId, trackingVersion); tracking.setIsDischarged(trackingIsDischarged); Integer patientId = (Integer) items[recordIndex++]; Integer patientVersion = (Integer) items[recordIndex++]; tracking.setPatient(assemblePatient(tracking.getPatient(), patientId, patientVersion, null, null, null, null, null, null, null, null, null, null, null,null,null, null, null, null));//WDEV-16987 Integer episodeOfCareId = (Integer) items[recordIndex++]; Integer episodeOfCareVersion = (Integer) items[recordIndex++]; tracking.setEpisode(assembleEmergencyEpisode(tracking.getEpisode(), null, null, null, episodeOfCareId, episodeOfCareVersion)); Integer careContextId = (Integer) items[recordIndex++]; Integer careContextVersion = (Integer) items[recordIndex++]; tracking.setAttendance(assembleEmergencyAttendance(tracking.getAttendance(), null, null, null, null, null, null, null, careContextId, careContextVersion, null)); Integer calledAmount = (Integer) items[recordIndex++]; tracking.setCurrentDNW(assembleDNW(tracking.getCurrentDNW(), calledAmount)); Date triageStartDate = (Date) items[recordIndex++]; tracking.setTriageDetails(assembleTriage(tracking.getTriageDetails(), triageStartDate, null, null, null)); Date medicStartDate = (Date) items[recordIndex++]; tracking.setTriageDetails(assembleTriage(tracking.getTriageDetails(), null, null, null, medicStartDate)); Date registrationDate = (Date) items[recordIndex++]; tracking.setAttendance(assembleEmergencyAttendance(tracking.getAttendance(), null, null, registrationDate, null, null, null, null, null, null, null)); ims.domain.lookups.LookupInstance triagePriority = (ims.domain.lookups.LookupInstance) items[recordIndex++]; tracking.setTriageDetails(assembleTriage(tracking.getTriageDetails(), null, null, triagePriority, null)); //wdev-17593 Date dischargeDate = (Date) items[recordIndex++]; tracking.getAttendance().setDischargeDateTime(dischargeDate != null ? new DateTime(dischargeDate) : null); recordIndexRef.set(recordIndex); return tracking; }