public Boolean isStale(PatientMedsVo patientMedsToSave) { if (patientMedsToSave == null || patientMedsToSave.getID_PatientMedicationOnAttendance() == null) { throw new CodingRuntimeException("Cannot get PatientMedsVo on null Id "); } DomainFactory factory = getDomainFactory(); PatientMedicationOnAttendance domainPatientMeds = (PatientMedicationOnAttendance) factory.getDomainObject(PatientMedicationOnAttendance.class, patientMedsToSave.getID_PatientMedicationOnAttendance()); if(domainPatientMeds==null) { return true; } if (domainPatientMeds.getVersion() > patientMedsToSave.getVersion_PatientMedicationOnAttendance()) { return true; } return false; }
public PatientMedsVo getPatientMedsForCareContext(CareContextRefVo careContextRef) { DomainFactory factory = getDomainFactory(); if (careContextRef == null || careContextRef.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get patientMedicationOnAttendance on null Id "); } StringBuffer hql = new StringBuffer(); hql.append("select patmed from PatientMedicationOnAttendance as patmed left join patmed.attendance as att where att.id = :careContextID "); List<?> list = factory.find(hql.toString(), new String[] {"careContextID"}, new Object[] {careContextRef.getID_CareContext()}); if (list!=null && list.size()>0) return PatientMedsVoAssembler.createPatientMedsVoCollectionFromPatientMedicationOnAttendance(list).get(0); return null; }
private boolean saveTracking( PatientMedsVo patmedVo) { if(form.getLocalContext().getSelectedWaitingPatient() == null) return false; TrackingForClinicianWorklistAndTriageVo tracking = populateTrackingWithTriage((TrackingForClinicianWorklistAndTriageVo) form.getLocalContext().getSelectedWaitingPatient().clone()); if(tracking == null) return false; //wdev-15930 SeenByHCPVo allocNurseVo = populateAllocatedNurse(); //wdev-15930 //WDEV-16816 form.getLocalContext().setAllocatedNurse(allocNurseVo) ;//WDEV-16816 String[] errors = tracking.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { form.getLocalContext().setSelectedWaitingPatient(domain.saveTracking(tracking,form.getLocalContext().getAllocatedNurse(),patmedVo)); //wdev-15930 //WDEV-16816,wdev-17825 } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); //open(); } return true; }
private void getSelectedInstance() { if (form.recbrPatientMed().getValue() == null) return; form.getLocalContext().setselectedCareContext(form.recbrPatientMed().getValue()); PatientMedsVo patientMeds = domain.getPatientMedsForCareContext(form.getLocalContext().getselectedCareContext()); form.getLocalContext().setselectedPatientMeds(patientMeds); populateInstanceControls(patientMeds); }
private void populateInstanceControls(PatientMedsVo patientMeds) { clearInstanceControls(); if (patientMeds == null) { return; } if (patientMeds.getCurrentMedicationDetailsIsNotNull()) { //form.richTextPatMedDescription().setValue(patientMeds.getCurrentMedicationDetails()); form.txtPatMedDescription().setValue(patientMeds.getCurrentMedicationDetails()); //wdev-15932 } }
public PatientMedsVo save(PatientMedsVo patientMedsToSave) throws StaleObjectException, UniqueKeyViolationException { if (patientMedsToSave == null) throw new CodingRuntimeException("Cannot save null PatientMeds "); if (!patientMedsToSave.isValidated()) throw new DomainRuntimeException("PatientMedsVo Not Validated."); DomainFactory factory = getDomainFactory(); PatientMedicationOnAttendance domainPatientMeds = PatientMedsVoAssembler.extractPatientMedicationOnAttendance(factory, patientMedsToSave); factory.save(domainPatientMeds); return PatientMedsVoAssembler.create(domainPatientMeds); }
public PatientMedsVo getPatientMeds(PatientMedicationOnAttendanceRefVo patientMeds) { if (patientMeds == null || patientMeds.getID_PatientMedicationOnAttendance() == null) { throw new CodingRuntimeException("Cannot get PatientMedsVo on null Id "); } DomainFactory factory = getDomainFactory(); PatientMedicationOnAttendance domainPatientMeds = (PatientMedicationOnAttendance) factory.getDomainObject(PatientMedicationOnAttendance.class, patientMeds.getID_PatientMedicationOnAttendance()); return PatientMedsVoAssembler.create(domainPatientMeds); }
private boolean saveTracking( PatientMedsVo patmedVo) { if(form.getLocalContext().getSelectedWaitingPatient() == null) return false; TrackingForClinicianWorklistAndTriageVo tracking = populateTrackingWithTriage((TrackingForClinicianWorklistAndTriageVo) form.getLocalContext().getSelectedWaitingPatient().clone()); if(tracking == null) return false; //wdev-15930 SeenByHCPVo allocHCPVo = populateAllocatedHCP(); //wdev-15930 //WDEV-16816 //form.getLocalContext().setAllocatedNurse(allocNurseVo) ;//WDEV-16816 String[] errors = tracking.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { form.getLocalContext().setSelectedWaitingPatient(domain.saveTracking(tracking, allocHCPVo, patmedVo)); //wdev-15930 //WDEV-16816,wdev-17825 } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); //open(); } return true; }
private void populateRecordBrowser()//WDEV-17602 { form.recbrPatientMed().clear(); PatientMedsVoCollection collTriagePatientMeds = domain.getAllPatientMeds(form.getLocalContext().getPatientRef()); if (collTriagePatientMeds == null) return; for (int i = 0; i < collTriagePatientMeds.size(); i++) { PatientMedsVo patientMeds = collTriagePatientMeds.get(i); if (patientMeds == null) continue; StringBuffer recordBrowserText = new StringBuffer(); TriageForPatientMedsVo triage = domain.getTriageByCareContext(patientMeds.getAttendance()); PatientProblemForPatientMedsVo problem = (triage!=null ? triage.getMainPresentingProblem() : null); recordBrowserText.append(getTextToDisplayFromEmergencyAttendance(patientMeds.getAttendance())); if (problem != null) { if (problem.getPatientProblemIsNotNull()) { recordBrowserText.append(" - "+problem.getPatientProblem()); } } if (form.getLocalContext().getCareContextRef().equals(patientMeds.getAttendance())) { form.recbrPatientMed().newRow(patientMeds.getAttendance(), recordBrowserText.toString(), Color.Green); continue; } form.recbrPatientMed().newRow(patientMeds.getAttendance(), recordBrowserText.toString()); } ArrayList collRecBrowser = form.recbrPatientMed().getValues(); if (!collRecBrowser.contains(form.getLocalContext().getCareContextRef())) { form.recbrPatientMed().newRow(form.getLocalContext().getCareContextRef(), getTextToDisplayFromEmergencyAttendance(form.getLocalContext().getCareContextRef()).toString(), Color.Green); } form.recbrPatientMed().setValue(form.getLocalContext().getCareContextRef()); }
public TrackingForClinicianWorklistAndTriageVo saveTracking(TrackingForClinicianWorklistAndTriageVo tracking, SeenByHCPVo seenByHcp, PatientMedsVo patmed) throws StaleObjectException { 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 SeenByHCP doSeenBy = null; if( seenByHcp != null ) { doSeenBy = SeenByHCPVoAssembler.extractSeenByHCP(factory, seenByHcp); if( doSeenBy != null ) { factory.save(doSeenBy); } } //-------------wdev-15930------------ TriageForClinicianWorklistVo triagedetails = tracking.getTriageDetails(); ims.emergency.domain.objects.Triage doTriage = TriageForClinicianWorklistVoAssembler.extractTriage(factory, triagedetails); if( doTriage != null ) { factory.save(doTriage); } Tracking doTracking = TrackingForClinicianWorklistAndTriageVoAssembler.extractTracking(factory, tracking); if( doSeenBy != null ) { doTracking.setSeenBy(doSeenBy); } else if (seenByHcp == null && patmed==null && tracking.getCurrentStatusIsNotNull() && TrackingStatus.WAITING_TO_BE_SEEN_BY_A_MEDIC.equals(tracking.getCurrentStatus().getStatus()))//WDEV-18278 { //on Move,when setting the status to WAITING_TO_BE_SEEN_BY_A_MEDIC, mark currentSeenByAsCompleted and set SeenBy from Tracking to null SeenByHCP doSeenByHcp = doTracking.getSeenBy(); if (doSeenByHcp!=null) { doSeenByHcp.setCompletedDateTime(new Date()); factory.save(doSeenByHcp); doTracking.setSeenBy(null); } } if( doTriage != null) { doTracking.setTriageDetails(doTriage); } factory.save(doTracking); //wdev-17825 if( patmed != null) { PatientMedicationOnAttendance doPatientMedicationOnAttendance = PatientMedsVoAssembler.extractPatientMedicationOnAttendance(factory, patmed); if( doPatientMedicationOnAttendance != null ) factory.save(doPatientMedicationOnAttendance); } return TrackingForClinicianWorklistAndTriageVoAssembler.create(doTracking); }