private boolean saveTracking() { if(form.getLocalContext().getSelectedTriagePatient() == null) return false; TrackingForTriageVo tracking = populateTrackingWithTriage((TrackingForTriageVo) form.getLocalContext().getSelectedTriagePatient().clone()); if(tracking == null) return false; //wdev-15930 SeenByHCPVo allocNurseVo = populateAllocatedNurse(); //wdev-15930 //wdev-16816 form.getLocalContext().setAllocatedNurse(allocNurseVo) ; String[] errors = tracking.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { form.getLocalContext().setSelectedTriagePatient(domain.saveTracking(tracking,form.getLocalContext().getAllocatedNurse())); //wdev-15930 } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); } return true; }
private TrackingForTriageVo populateTrackingWithTriage(TrackingForTriageVo tracking) { if(tracking == null) return null; if(tracking.getTriageDetails() == null) { tracking.setTriageDetails(createNewTriage(tracking.getCurrentArea())); } return tracking; }
private void saveTrackingWithWaitingToBeSeenStatus() { if(form.getLocalContext().getSelectedTriagePatient() == null) return; form.getLocalContext().setSelectedTriagePatient(domain.getTrackingForTriage(form.getLocalContext().getSelectedTriagePatient())); TrackingForTriageVo tracking = populateTrackingWithWaitingToBeSeenStatus((TrackingForTriageVo) form.getLocalContext().getSelectedTriagePatient().clone()); if(tracking == null) return; String[] errors = tracking.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return; } try { form.getLocalContext().setSelectedTriagePatient(domain.saveTracking(tracking,null)); //wdev-15930 } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); } }
private TrackingForTriageVo populateTrackingWithWaitingToBeSeenStatus(TrackingForTriageVo tracking) { if(tracking == null) return null; tracking.setCurrentStatus(createTrackingStatus(TrackingStatus.WAITING_TO_BE_SEEN_BY_A_MEDIC)); return tracking; }
public TrackingForTriageVo getTrackingForTriage(TrackingRefVo trackingId) { if(trackingId == null || trackingId.getID_Tracking() == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Tracking Id."); return TrackingForTriageVoAssembler.create((Tracking) getDomainFactory().getDomainObject(Tracking.class, trackingId.getID_Tracking())); }
public TrackingForTriageVo saveTracking(TrackingForTriageVo tracking, SeenByHCPVo seenByHCP) throws StaleObjectException //wdev-15930 //WDEV-16816 { if(tracking == null) throw new CodingRuntimeException("Cannot save a null Tracking record."); if(!tracking.isValidated()) throw new CodingRuntimeException("Tracking record is not validated."); DomainFactory factory = getDomainFactory(); //wdev-15930 //WDEV-16816 SeenByHCP doSeenBy = null; if( seenByHCP != null ) { doSeenBy = SeenByHCPVoAssembler.extractSeenByHCP(factory, seenByHCP); if( doSeenBy != null ) { factory.save(doSeenBy); } } //-------------wdev-15930------------ Tracking doTracking = TrackingForTriageVoAssembler.extractTracking(factory, tracking); if( doSeenBy != null ) //wdev-15930 //WDEV-16816 { doTracking.setSeenBy(doSeenBy); //WDEV-16816 } factory.save(doTracking); return TrackingForTriageVoAssembler.create(doTracking); }
public TrackingForTriageVo geTrackingForTriageByAttendanceId(EmergencyAttendanceRefVo attendanceId) { if(attendanceId == null || attendanceId.getID_EmergencyAttendance() == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Attendance Id."); DomainFactory factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.attendance as att where att.id = :AttendanceId"; List<?> list = factory.find(query, new String[] {"AttendanceId"}, new Object[] {attendanceId.getID_EmergencyAttendance()}); if(list == null || list.size() == 0) return null; return TrackingForTriageVoAssembler.create((Tracking) list.get(0)); }
public TrackingForTriageVo getTrackingForTriageByCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Care Context Id."); DomainFactory factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.attendance as att left join att.careContext as cc where cc.id = :CareContextId"; List<?> trackingList = factory.find(query, new String[] {"CareContextId"}, new Object[] {careContext.getID_CareContext()}); if(trackingList == null || trackingList.size() == 0) return null; return TrackingForTriageVoAssembler.create((Tracking) trackingList.get(0)); }
public TrackingForTriageVo getTrackingForTriageByActiveCareContext(PatientRefVo patientRef) { if(patientRef == null) throw new CodingRuntimeException("Cannot get Tracking record for a null Patient Id."); DomainFactory factory = getDomainFactory(); String query = "select tr from Tracking as tr left join tr.attendance as att left join att.careContext as cc left join cc.episodeOfCare as EOC left join EOC.careSpell as CS left join CS.patient as PAT where cc.endDateTime is null and PAT.id = :PatientId"; List<?> trackingList = factory.find(query, new String[] {"PatientId"}, new Object[] {patientRef.getID_Patient()}); if(trackingList == null || trackingList.size() == 0) return null; return TrackingForTriageVoAssembler.create((Tracking) trackingList.get(0)); }
private void selectedInstance() { form.getLocalContext().setHistoryMode(false); form.getLocalContext().setSelectedTriagePatient(null); if(form.dyngrdPatients().getValue() instanceof TrackingRefVo) { form.getGlobalContext().Emergency.setTracking((TrackingRefVo) form.dyngrdPatients().getValue()); form.getLocalContext().setSelectedTriagePatient(domain.getTrackingForTriage((TrackingRefVo) form.dyngrdPatients().getValue())); } else if(form.getGlobalContext().Core.getCurrentCareContext() != null) { TrackingForTriageVo TrackingForTriage = domain.getTrackingForTriageByCareContext(form.getGlobalContext().Core.getCurrentCareContext()); //WDEV-15951 if (TrackingForTriage != null && TrackingForTriage.getAttendanceIsNotNull() && TrackingForTriage.getAttendance().getDischargeDateTimeIsNotNull()) { form.getLocalContext().setHistoryMode(true); //wdev-16064 } form.getLocalContext().setSelectedTriagePatient(TrackingForTriage); form.getGlobalContext().Emergency.setTracking(form.getLocalContext().getSelectedTriagePatient()); form.dyngrdPatients().setValue(form.getLocalContext().getSelectedTriagePatient()); } if(form.getLocalContext().getSelectedTriagePatient() != null) { form.getGlobalContext().Emergency.setTriage(form.getLocalContext().getSelectedTriagePatient().getTriageDetails()); if(form.getLocalContext().getSelectedTriagePatient().getEpisode() != null) { form.getLocalContext().setCurrentEpisode((EmergencyEpisodeForTriageLiteVo) form.getLocalContext().getSelectedTriagePatient().getEpisode().clone()); } if(form.getLocalContext().getSelectedTriagePatient().getAttendance() != null && form.getLocalContext().getSelectedTriagePatient().getAttendance().getDischargeDateTime() == null) { form.getLocalContext().setCurrentAttendance((EmergencyAttendanceForTriageLiteVo) form.getLocalContext().getSelectedTriagePatient().getAttendance().clone()); } } populateScreenFromData(); }