public PatientDiagnosisAtConsultationVoCollection saveDiagnosis(PatientDiagnosisAtConsultationVoCollection diagnosis) throws StaleObjectException { if(diagnosis == null) throw new CodingRuntimeException("Cannot save a null PatientDiagnosisAtConsultationVoCollection."); if(!diagnosis.isValidated()) throw new CodingRuntimeException("PatientDiagnosisAtConsultationVoCollection is not validated."); DomainFactory factory = getDomainFactory(); PatientDiagnosisAtConsultationVoCollection coll = new PatientDiagnosisAtConsultationVoCollection(); for(PatientDiagnosisAtConsultationVo diagnose : diagnosis) { if(diagnose == null) continue; PatientDiagnosis doDiagnose = PatientDiagnosisAtConsultationVoAssembler.extractPatientDiagnosis(factory, diagnose); factory.save(doDiagnose); coll.add(PatientDiagnosisAtConsultationVoAssembler.create(doDiagnose)); } return coll; }
public PatientDiagnosisAtConsultationVoCollection listPatientDiagnosis(CareContextRefVo attendance) { if(attendance == null || attendance.getID_CareContext() == null) return null; DomainFactory factory = getDomainFactory(); String query = "select pd from PatientDiagnosis as pd left join pd.careContext as cc where cc.id = :AttendenceId order by UPPER(pd.diagnosisDescription) asc"; List<?> list = factory.find(query, new String[] {"AttendenceId"}, new Object[] {attendance.getID_CareContext()}); return PatientDiagnosisAtConsultationVoAssembler.createPatientDiagnosisAtConsultationVoCollectionFromPatientDiagnosis(list); }
public PatientDiagnosisAtConsultationVo getPatientDiagnosis(PatientDiagnosisRefVo patDiagnosis) { if(patDiagnosis == null || patDiagnosis.getID_PatientDiagnosis() == null) return null; DomainFactory factory = getDomainFactory(); PatientDiagnosis doPatDiagnosis = (PatientDiagnosis) factory.getDomainObject(PatientDiagnosis.class, patDiagnosis.getID_PatientDiagnosis()); return PatientDiagnosisAtConsultationVoAssembler.create(doPatDiagnosis); }
public PatientDiagnosisAtConsultationVoCollection saveDiagnosis(PatientDiagnosisAtConsultationVoCollection diagnosis, CareContextRefVo careContext) throws StaleObjectException { if(diagnosis == null) throw new CodingRuntimeException("Cannot save a null PatientDiagnosisAtConsultationVoCollection."); if(!diagnosis.isValidated()) throw new CodingRuntimeException("PatientDiagnosisAtConsultationVoCollection is not validated."); DomainFactory factory = getDomainFactory(); PatientDiagnosisAtConsultationVoCollection coll = new PatientDiagnosisAtConsultationVoCollection(); //WDEV-19239 boolean isPatientDiagPrimary=false; CareContextRefVo careContextRef = null; for(PatientDiagnosisAtConsultationVo diagnose : diagnosis) { if(diagnose == null) continue; careContextRef=diagnose.getCareContext(); if (isPrimary(diagnose)) isPatientDiagPrimary=true; PatientDiagnosis doDiagnose = PatientDiagnosisAtConsultationVoAssembler.extractPatientDiagnosis(factory, diagnose); factory.save(doDiagnose); coll.add(PatientDiagnosisAtConsultationVoAssembler.create(doDiagnose)); } CodedDiagnosesForAttendanceVoCollection collCodedDiag = listCodedDiagnosesForAttendance(careContextRef, true); if (isPatientDiagPrimary && collCodedDiag!=null && collCodedDiag.size()>0) { for (CodedDiagnosesForAttendanceVo codedDiag : collCodedDiag) { codedDiag.setIsMain(false); CodedDiagForAttendance doCodedDiag = CodedDiagnosesForAttendanceVoAssembler.extractCodedDiagForAttendance(factory, codedDiag); factory.save(doCodedDiag); } } if(careContext != null) { AttendDiagInvTreatStatusVo attendDiagInvTreatStatus = getAttendDiagInvTreatStatus(careContext); if(attendDiagInvTreatStatus != null) { attendDiagInvTreatStatus.setNoDiagnoses(null); attendDiagInvTreatStatus.setDiagnosesNotRecorded(null); AttendDiagInvTreatStatus doAttendDiagInvTreatStatus = AttendDiagInvTreatStatusVoAssembler.extractAttendDiagInvTreatStatus(factory, attendDiagInvTreatStatus); factory.save(doAttendDiagInvTreatStatus); } } return coll; }