public InvestigationAttendenceDetailVoCollection listInvestigationAttendence(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) return null; DomainFactory factory = getDomainFactory(); String query = "select ia from InvestigationAttendenceDetail as ia left join ia.attendance as at left join ia.attendenceInvestigation as ai where at.id = :AttendenceId and ia.active = 1 order by UPPER(ai.text) asc"; List<?> list = factory.find(query, new String[] {"AttendenceId"}, new Object[] {careContext.getID_CareContext()}); return InvestigationAttendenceDetailVoAssembler.createInvestigationAttendenceDetailVoCollectionFromInvestigationAttendenceDetail(list); }
private boolean createAndSaveInvestigationsAttendenceDetail(OrderInvestigationForAttendenceNotesCcVoCollection orderInvestigations) { if(orderInvestigations == null || orderInvestigations.size() == 0) return false; InvestigationsForAttendVo invForAtt = form.getLocalContext().getSelectedInvestigationsForAttend(); if(invForAtt == null) { invForAtt = new InvestigationsForAttendVo(); invForAtt.setPatient(form.getLocalContext().getPatient()); invForAtt.setEpisode(form.getLocalContext().getEpisodeOfCare()); invForAtt.setAttendance(form.getLocalContext().getCareContext()); } if(invForAtt.getInvestigations() == null) { invForAtt.setInvestigations(new InvestigationAttendenceDetailVoCollection()); } for(OrderInvestigationForAttendenceNotesCcVo inv : orderInvestigations) { invForAtt.getInvestigations().add(createInvestigationAttendanceDetails(inv)); } String[] errors = invForAtt.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { form.getLocalContext().setSelectedInvestigationsForAttend(domain.save(invForAtt)); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); refresh(); return false; } return true; }
public ims.emergency.vo.InvestigationAttendenceDetailVo save(ims.emergency.vo.InvestigationAttendenceDetailVo record, InvestigationsForAttendVo investigationsForAttend) throws ims.domain.exceptions.StaleObjectException { if(record == null) throw new CodingRuntimeException("Cannot save a null InvestigationAttendenceDetailVo."); if(!record.isValidated()) throw new CodingRuntimeException("InvestigationAttendenceDetailVo is not validated."); DomainFactory factory = getDomainFactory(); InvestigationAttendenceDetail doRecord = InvestigationAttendenceDetailVoAssembler.extractInvestigationAttendenceDetail(factory, record); factory.save(doRecord); InvestigationAttendenceDetailVo newRecord = InvestigationAttendenceDetailVoAssembler.create(doRecord); if(investigationsForAttend != null) { if(record.getID_InvestigationAttendenceDetail() == null) { if(investigationsForAttend.getInvestigations() == null) { investigationsForAttend.setInvestigations(new InvestigationAttendenceDetailVoCollection()); } investigationsForAttend.getInvestigations().add(newRecord); InvestigationsForAttend doInvestigationsForAttend = InvestigationsForAttendVoAssembler.extractInvestigationsForAttend(factory, investigationsForAttend); factory.save(doInvestigationsForAttend); } //WDEV-19057 if(!Boolean.TRUE.equals(record.getAddedDuringCoding())) { AttendDiagInvTreatStatusVo attendDiagInvTreatStatus = getAttendDiagInvTreatStatus(investigationsForAttend.getAttendance()); if (attendDiagInvTreatStatus != null && (Boolean.TRUE.equals(attendDiagInvTreatStatus.getNoInvestigations()) || Boolean.TRUE.equals(attendDiagInvTreatStatus.getInvestigationNotRecorded()))) { attendDiagInvTreatStatus.setNoInvestigations(null); attendDiagInvTreatStatus.setInvestigationNotRecorded(null); AttendDiagInvTreatStatus doAttendDiagInvTreatStatus = AttendDiagInvTreatStatusVoAssembler.extractAttendDiagInvTreatStatus(factory, attendDiagInvTreatStatus); factory.save(doAttendDiagInvTreatStatus); } } } return newRecord; }