public ims.emergency.vo.MedicNotesVoCollection listMedicNotes(ims.core.patient.vo.PatientRefVo patient, ims.core.admin.vo.EpisodeOfCareRefVo episodeOfCare, ims.core.admin.vo.CareContextRefVo careContext) { if(patient == null) throw new CodingRuntimeException("Cannot list MedicNotes for a null Patient Id."); String query = "from MedicNotes as mn where "; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); if(careContext != null) { query += " mn.attendance.id = :CareContextId "; paramNames.add("CareContextId"); paramValues.add(careContext.getID_CareContext()); } else if(episodeOfCare != null) { query += " mn.episode.id = :EpisodeOfCareId "; paramNames.add("EpisodeOfCareId"); paramValues.add(episodeOfCare.getID_EpisodeOfCare()); } else { query += " mn.patient.id = :PatientId "; paramNames.add("PatientId"); paramValues.add(patient.getID_Patient()); } query += " order by mn.authoringInformation.authoringDateTime desc "; List<?> notes = getDomainFactory().find(query, paramNames, paramValues); return MedicNotesVoAssembler.createMedicNotesVoCollectionFromMedicNotes(notes); }
public ims.emergency.vo.MedicNotesVo saveNote(ims.emergency.vo.MedicNotesVo note) throws ims.domain.exceptions.StaleObjectException { if(note == null) throw new CodingRuntimeException("Cannot save a null MedicNote."); if(!note.isValidated()) throw new CodingRuntimeException("MedicNote is not validated."); DomainFactory factory = getDomainFactory(); MedicNotes doNote = MedicNotesVoAssembler.extractMedicNotes(factory, note); factory.save(doNote); return MedicNotesVoAssembler.create(doNote); }