private InvestigationAttendenceDetailVo createInvestigationAttendanceDetails(OrderInvestigationForAttendenceNotesCcVo inv) { InvestigationAttendenceDetailVo newInvAtt = new InvestigationAttendenceDetailVo(); newInvAtt.setActive(true); AuthoringInformationVo auth = new AuthoringInformationVo(); auth.setAuthoringHcp(form.getLocalContext().getHcpUser()); auth.setAuthoringDateTime(new DateTime()); newInvAtt.setAuthoringInformation(auth); if (form.getLocalContext().getHcpUser() == null) newInvAtt.setAddedDuringCoding(form.getLocalContext().getAddedDuringCoding()); newInvAtt.setOCSInvestigation(inv); return newInvAtt; }
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; }