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; }
public PatientMedsVoCollection getAllPatientMeds(PatientRefVo patientRef)//WDEV-17602 { DomainFactory factory = getDomainFactory(); if (patientRef == null || patientRef.getID_Patient() == null) { throw new CodingRuntimeException("Cannot get patientRefVo on null Id "); } StringBuffer hql = new StringBuffer(); hql.append("select patMed from PatientMedicationOnAttendance as patMed left join patMed.patient as pat where pat.id = :patientID "); hql.append(" order by patMed.attendance.startDateTime desc"); List<?> list = factory.find(hql.toString(), new String[] {"patientID"}, new Object[] {patientRef.getID_Patient()}); return PatientMedsVoAssembler.createPatientMedsVoCollectionFromPatientMedicationOnAttendance(list); }
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); }
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); }