@Override protected void onGrdDisplaySelectionChanged() throws PresentationLogicException { if (form.grdDisplay().getSelectedRow().getValue() != null && form.grdDisplay().getSelectedRow().getValue() instanceof EpisodeDetailsVo) { AttendanceDetailsVoCollection voCollAttendanceDetails = domain.listAttendanceByEpisodeDetails((EpisodeDetailsVo) form.grdDisplay().getSelectedRow().getValue()); if (voCollAttendanceDetails != null) { form.grdDisplay().getSelectedRow().setExpanded(true); for (int j = 0; j < voCollAttendanceDetails.size(); j++) { AttendanceDetailsVo voEmergencyAttendances = voCollAttendanceDetails.get(j); grdDisplayRow episodeDetailsRow = form.grdDisplay().getSelectedRow().getRows().newRow(); episodeDetailsRow.setcolDateTime(voEmergencyAttendances.getArrivalDateTime()); episodeDetailsRow.setcolPatCategory(voEmergencyAttendances.getOutcome() != null ? voEmergencyAttendances.getOutcome().getText() : null); episodeDetailsRow.setcolEpisodeNo(voEmergencyAttendances.getID_EmergencyAttendance().toString()); } } } }
public int compare(Object ob1, Object ob2) { DateTime date1 = null; DateTime date2 = null; if(ob1 instanceof AttendanceDetailsVo ) { AttendanceDetailsVo ps1 = (AttendanceDetailsVo)ob1; date1 = ps1.getArrivalDateTime(); } if(ob2 instanceof AttendanceDetailsVo) { AttendanceDetailsVo ps2 = (AttendanceDetailsVo)ob2; date2 = ps2.getArrivalDateTime(); } if(date1 != null ) return date1.compareTo(date2)*direction; if(date2 != null) return (-1)*direction; return 0; }
private void updateControlsState() { boolean isEpisodeSelected = form.grdPrevious().getValue() instanceof EpisodeDetailsVo; form.btnOK().setEnabled(isEpisodeSelected); form.btnOK().setVisible(!isAttendanceHistory()); form.btnCancel().setEnabled(true); form.btnCancel().setVisible(!isAttendanceHistory()); form.btnClose().setEnabled(true); form.btnClose().setVisible(isAttendanceHistory()); boolean isAttendanceSelected = form.grdPrevious().getValue() instanceof AttendanceDetailsVo; form.btnPrintCASCard().setEnabled(isAttendanceSelected); form.btnPrintSmallLabels().setEnabled(isAttendanceSelected); form.btnPrintLargeLabels().setEnabled(isAttendanceSelected); form.btnPrintGPLetters().setEnabled(isAttendanceSelected); }
public AttendanceDetailsVo getLastAttendance(PatientRefVo patientRef) { if(patientRef == null) throw new CodingRuntimeException("Patient not provided"); DomainFactory factory = getDomainFactory(); String hsql = "select e3_1 from EmergencyEpisode as e1_1 left join e1_1.episodeOfCare as e2_1 left join e2_1.careSpell as c1_1 left join c1_1.patient as p1_1 left join e1_1.emergencyAttendances as e3_1 where (e3_1.arrivalDateTime = " + "(select max (xe3_1.arrivalDateTime) from EmergencyEpisode as xe1_1 left join xe1_1.episodeOfCare as xe2_1 left join xe2_1.careSpell as xc1_1 left join xc1_1.patient as xp1_1 left join xe1_1.emergencyAttendances as xe3_1 " + "where (xc1_1.patient.id =:idPatient )) and c1_1.patient.id =:idPatient1 )"; List attendances = factory.find(hsql, new String[] {"idPatient","idPatient1"}, new Object[] {patientRef.getID_Patient(),patientRef.getID_Patient()}); if(attendances != null && attendances.size() > 0) { AttendanceDetailsVoCollection attColl = AttendanceDetailsVoAssembler.createAttendanceDetailsVoCollectionFromEmergencyAttendance(attendances); if( attColl != null && attColl.size() > 0) return attColl.get(0); } return null; }
public int compare(AttendanceDetailsVo ob1, AttendanceDetailsVo ob2) { DateTime date1 = null; DateTime date2 = null; if(ob1 instanceof AttendanceDetailsVo ) { AttendanceDetailsVo ps1 = (AttendanceDetailsVo)ob1; date1 = ps1.getArrivalDateTime(); } if(ob2 instanceof AttendanceDetailsVo) { AttendanceDetailsVo ps2 = (AttendanceDetailsVo)ob2; date2 = ps2.getArrivalDateTime(); } if(date1 != null ) return date1.compareTo(date2)*direction; if(date2 != null) return (-1)*direction; return 0; }
public AttendanceDetailsVo getLastAttendance(PatientRefVo patientRef) { if (patientRef == null) throw new CodingRuntimeException("Patient not provided"); DomainFactory factory = getDomainFactory(); // Query to list back the latest StringBuilder query = new StringBuilder("SELECT erAttend "); query.append("FROM EmergencyEpisode AS erEp LEFT JOIN erEp.patient AS pat LEFT JOIN erEp.emergencyAttendances AS erAttend "); query.append("WHERE (erAttend.isRIE is null OR erAttend.isRIE = 0) AND pat.id = :PATIENT_ID AND "); query.append("(erAttend.arrivalDateTime = "); query.append("(SELECT MAX(erAttend2.arrivalDateTime) FROM EmergencyEpisode AS erEp2 LEFT JOIN erEp2.patient AS patient2 LEFT JOIN erEp2.emergencyAttendances AS erAttend2 "); query.append(" WHERE patient2.id = :PATIENT_ID)) "); return AttendanceDetailsVoAssembler.create((EmergencyAttendance) factory.findFirst(query.toString(), "PATIENT_ID", patientRef.getID_Patient())); }
private void createCareContextForAttendance(EpisodeDetailsVo voEpisodeDetails, AttendanceDetailsVo voAttendanceDetails) { EpisodeofCareVo episodeOfCare = domain.getEpisodeOfCare(voEpisodeDetails.getEpisodeOfCare().getID_EpisodeOfCare()); CareSpellVo careSpell = domain.getCareSpellByEpisodeOfCare(voEpisodeDetails.getEpisodeOfCare().getID_EpisodeOfCare()); EpisodeofCareVoCollection episodeOfCareColl = careSpell.getEpisodes(); episodeOfCare.setCareContexts(createNewCareContext(episodeOfCare)); episodeOfCareColl.add(episodeOfCare); form.getLocalContext().setCurrentEpisodeOfCare(episodeOfCare); careSpell.setEpisodes(episodeOfCareColl); voAttendanceDetails.setCareContext(form.getLocalContext().getCurrentCareContext()); }
public void setValue(ValueObject rowValue) { form.getLocalContext().setSelectedRow(rowValue); if (rowValue instanceof AttendanceDetailsVo) { getAndDisplayRecord(rowValue); form.getLocalContext().setSelectedRecord((AttendanceDetailsVo) rowValue); form.getLocalContext().setSelectedEmergencyEpisode(domain.getEmergencyEpisode(form.getLocalContext().getSelectedRecord().getEmergencyEpisode())); // form.getLocalContext().setSelectedEmergencyEpisode((EpisodeDetailsVo) selectedRow.getParentRow().getValue()); // form.getLocalContext().setSelectedRecord((AttendanceDetailsVo) selectedRow.getValue()); form.getGlobalContext().Core.setCurrentCareContext(form.getLocalContext().getSelectedRecord().getCareContext()); form.getGlobalContext().Emergency.setCurrentEmergencyAttendance((AttendanceDetailsVo) rowValue); if (form.getLocalContext().getSelectedEmergencyEpisodeIsNotNull() && form.getLocalContext().getSelectedEmergencyEpisode().getReferringGPIsNotNull()) { GpShortVo gp = new GpShortVo(); gp.setID_Gp(form.getLocalContext().getSelectedEmergencyEpisode().getReferringGP().getID_Gp()); // form.getGlobalContext().Core.setGPDetails(gp); form.getLocalContext().setSelectedGp(gp); // wdev-14420 } } else if (rowValue instanceof EpisodeDetailsVo) { getAndDisplayRecord(rowValue); form.getLocalContext().setSelectedEmergencyEpisode((EpisodeDetailsVo) rowValue); } updateControlState(); }
public void editInstance() { ValueObject rowValue = form.getLocalContext().getSelectedRow(); if (rowValue != null) { if (rowValue instanceof AttendanceDetailsVo) { editAttendance(rowValue); } } // wdev-14420 if (form.getLocalContext().getSelectedEmergencyEpisodeIsNotNull()) { form.getLocalContext().setTIIG(form.getLocalContext().getSelectedEmergencyEpisode().getTiig()); form.getLocalContext().setRTA(form.getLocalContext().getSelectedEmergencyEpisode().getRTADetails()); } form.GroupCategory().setEnabled(GroupCategoryEnumeration.rdoFirstVisit, false); form.GroupCategory().setEnabled(GroupCategoryEnumeration.rdoScheduledReturn, false); form.GroupCategory().setEnabled(GroupCategoryEnumeration.rdoUnscheduledReturn, false); // wdev-16070 if (domain.getMosUser() instanceof MemberOfStaffLiteVo) { MemberOfStaffLiteVo tempVo = (MemberOfStaffLiteVo) domain.getMosUser(); if (tempVo != null) { form.lblLastUpdatedBy1().setValue(tempVo.getNameIsNotNull() ? tempVo.getName().toString() : ""); } } form.setMode(FormMode.EDIT); form.getLocalContext().setSelectedEvent(EmergencyAttendanceEvent.EDIT); form.fireCustomControlValueChanged(); }
private AttendanceDetailsVo getLastAttendanceFromLastEpisode(EpisodeDetailsVo emergencyEpisode) { if(emergencyEpisode == null ) return null; emergencyEpisode.getEmergencyAttendances().sort(new ArrivalDateComparator(SortOrder.DESCENDING)); if(emergencyEpisode.getEmergencyAttendancesIsNotNull() && emergencyEpisode.getEmergencyAttendances().size() > 0) { return emergencyEpisode.getEmergencyAttendances().get(0); } return null; }
@Override //WDEV-16673 protected void onlyrEmergencyAttendanceTabChanged(LayerBridge tab) { if (FormMode.VIEW.equals(form.getMode())) { grdPreviousHistoryRow selectedRow = form.grdPreviousHistory().getSelectedRow(); if (selectedRow != null && selectedRow.getValue() != null && selectedRow.getValue() instanceof AttendanceDetailsVo) { form.getGlobalContext().Core.setCurrentCareContext(selectedRow.getValue()!=null ? ((AttendanceDetailsVo) selectedRow.getValue()).getCareContext():null); form.getGlobalContext().Emergency.setCurrentEmergencyAttendance(domain.getAttendanceDetails((AttendanceDetailsVo) selectedRow.getValue())); AttendanceDetailsVo selectedAttendance = form.getGlobalContext().Emergency.getCurrentEmergencyAttendance(); CareContextShortVo careContext = form.getGlobalContext().Core.getCurrentCareContext(); EpisodeofCareLiteVo episodeOfCare = careContext.getEpisodeOfCare(); PatientShort patient = form.getGlobalContext().Core.getPatientShort(); if (tab.equals(form.lyrEmergencyAttendance().tabAttDet())) { form.lyrEmergencyAttendance().tabAttDet().ccAttendanceDetails().setValue(selectedRow.getValue()); } else if (tab.equals(form.lyrEmergencyAttendance().tabChart()) && selectedRow.getValue() instanceof AttendanceDetailsVo) { form.lyrEmergencyAttendance().tabChart().ccChatRequested().initialize(selectedAttendance, patient, careContext, episodeOfCare); form.lyrEmergencyAttendance().tabChart().ccChatRequested().setValue(domain.getChartRequestedByEmergencyAttendance(selectedAttendance)); } else if (tab.equals(form.lyrEmergencyAttendance().tabInvoices()) && selectedRow.getValue() instanceof AttendanceDetailsVo) { form.lyrEmergencyAttendance().tabInvoices().ccInvoicesBilling().initialize(selectedAttendance, patient, episodeOfCare, careContext); form.lyrEmergencyAttendance().tabInvoices().ccInvoicesBilling().setValue(domain.getAttendanceBillingByEmergencyAttendance(selectedAttendance)); } } } updateControlState(); }
@Override protected void onBtnPrintCASCardClick() throws PresentationLogicException { if(!(form.grdPrevious().getValue() instanceof AttendanceDetailsVo)) return; form.getGlobalContext().Core.setImsReportId(EMERGENCY_CAS_CARD_REPORT_IMSID); engine.open(form.getForms().Core.PrintReportByIMSId, new Object[] {CARE_CONTEXT_SEED, ((AttendanceDetailsVo) form.grdPrevious().getValue()).getCareContext().getID_CareContext()}); }
@Override protected void onBtnPrintSmallLabelsClick() throws PresentationLogicException { if(!(form.grdPrevious().getValue() instanceof AttendanceDetailsVo)) return; form.getGlobalContext().Core.setImsReportId(EMERGENCY_SMALL_LABELS_IMSID); engine.open(form.getForms().Core.PrintReportByIMSId, new Object[] {CARE_CONTEXT_SEED, ((AttendanceDetailsVo) form.grdPrevious().getValue()).getCareContext().getID_CareContext()}); }
@Override protected void onBtnPrintLargeLabelsClick() throws PresentationLogicException { if(!(form.grdPrevious().getValue() instanceof AttendanceDetailsVo)) return; form.getGlobalContext().Core.setImsReportId(EMERGENCY_LARGE_LABELS_REPORT_IMSID); engine.open(form.getForms().Core.PrintReportByIMSId, new Object[] {CARE_CONTEXT_SEED, ((AttendanceDetailsVo) form.grdPrevious().getValue()).getCareContext().getID_CareContext()}); }
@Override protected void onBtnPrintGPLettersClick() throws PresentationLogicException { if(!(form.grdPrevious().getValue() instanceof AttendanceDetailsVo)) return; form.getGlobalContext().Core.setImsReportId(EMERGENCY_GP_LETTER_REPORT_IMSID); engine.open(form.getForms().Core.PrintReportByIMSId, new Object[] {CARE_CONTEXT_SEED, ((AttendanceDetailsVo) form.grdPrevious().getValue()).getCareContext().getID_CareContext()}); }
public AttendanceDetailsVo getAttendanceDetails(EmergencyAttendanceRefVo attendanceDetailsRef) { if (attendanceDetailsRef == null || attendanceDetailsRef.getID_EmergencyAttendance() == null) { throw new CodingRuntimeException("Cannot get AttendanceDetailsVo on null Id "); } DomainFactory factory = getDomainFactory(); EmergencyAttendance domainEmergAttDet = (EmergencyAttendance) factory.getDomainObject(EmergencyAttendance.class, attendanceDetailsRef.getID_EmergencyAttendance()); return AttendanceDetailsVoAssembler.create(domainEmergAttDet); }
public AttendanceDetailsVo getEmergencyAttendance(EmergencyAttendanceRefVo emergencyAttendanceRef) { if(emergencyAttendanceRef == null || emergencyAttendanceRef.getID_EmergencyAttendance() == null) throw new CodingRuntimeException("The emergencyAttendanceRef paramater cannot be null !"); DomainFactory domainFactory = getDomainFactory(); return AttendanceDetailsVoAssembler.create((EmergencyAttendance)domainFactory.loadDomainObject(EmergencyAttendance.class, emergencyAttendanceRef.getID_EmergencyAttendance())); }
private TrackingForQuickRegistrationVo populateTracking() { TrackingForQuickRegistrationVo trackingVo = new TrackingForQuickRegistrationVo(); trackingVo.setPatient(form.getLocalContext().getpatientToSave()); trackingVo.setAttendance(new AttendanceDetailsVo()); trackingVo.setEpisode(form.getLocalContext().getemergencyEpisodeToSave()); trackingVo.setEDLocation(getLocation()); trackingVo.setCurrentArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); if (QuickRegistrationType.UNC_UNK_PATIENT.equals(form.cmbRegistrationType().getValue()))//WDEV-15959 { trackingVo.setIsUnknownPatient(true); } TrackingAttendanceStatusVo trStatusVo = new TrackingAttendanceStatusVo(); trStatusVo.setPatient(form.getLocalContext().getpatientToSave()); trStatusVo.setAttendance(form.getLocalContext().getcareContextToSave()); trStatusVo.setEpisode(form.getLocalContext().getepisodeToSave()); trStatusVo.setTrackingArea(form.getGlobalContext().Emergency.getTrackingAreaForSendToAreaVo()); trStatusVo.setStatusDatetime(new DateTime()); MemberOfStaffShortVo memberVo = null; if (domain.getMosUser() instanceof MemberOfStaffShortVo) { memberVo = (MemberOfStaffShortVo) domain.getMosUser(); } trStatusVo.setCreatedBy(memberVo); trStatusVo.setStatus(TrackingStatus.WAITING_TO_BE_TRIAGED); trStatusVo.setPrevStatus(null); //WDEV-16777 trackingVo.setCurrentStatus(trStatusVo); trackingVo.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS); //wdev-17110 return trackingVo; }
private void editAttendance(ValueObject rowValue) { form.getLocalContext().setSelectedRecord((AttendanceDetailsVo) rowValue); form.getLocalContext().setSelectedEmergencyEpisode(domain.getEmergencyEpisode(form.getLocalContext().getSelectedRecord().getEmergencyEpisode())); AmbulanceDetailsVo ambulanceDetails = new AmbulanceDetailsVo(); ambulanceDetails.setAmbulanceArrivalDateTime(form.getLocalContext().getSelectedRecord().getAmbulanceArrivalDateTime()); ambulanceDetails.setAmbulanceJobNo(form.getLocalContext().getSelectedRecord().getAmbulanceJobNo()); ambulanceDetails.setAmbulanceHandoverDateTime(form.getLocalContext().getSelectedRecord().getAmbulanceHandoverDateTime()); ambulanceDetails.setAmbulanceDelayReason(form.getLocalContext().getSelectedRecord().getAmbulanceDelayReason()); ambulanceDetails.setAmbulanceDelayReasonComment(form.getLocalContext().getSelectedRecord().getAmbulanceDelayReasonComment()); //WDEV-19284 form.getLocalContext().setAmbulanceDetails(ambulanceDetails); }