public ims.emergency.vo.TriageNotesVo save(ims.emergency.vo.TriageNotesVo note) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if(note == null) throw new CodingRuntimeException("Cannot save a null TriageNote."); if(!note.isValidated()) throw new CodingRuntimeException("TriageNote is not validated."); DomainFactory factory = getDomainFactory(); TriageNotes doNote = TriageNotesVoAssembler.extractTriageNotes(factory, note); factory.save(doNote); return TriageNotesVoAssembler.create(doNote); }
public ims.emergency.vo.TriageNotesVoCollection listNotes(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 TriageNotes for a null Patient Id."); String query = "from TriageNotes as tn where "; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); if(careContext != null) { query += " tn.attendance.id = :CareContextId "; paramNames.add("CareContextId"); paramValues.add(careContext.getID_CareContext()); } else if(episodeOfCare != null) { query += " tn.episode.id = :EpisodeOfCareId "; paramNames.add("EpisodeOfCareId"); paramValues.add(episodeOfCare.getID_EpisodeOfCare()); } else { query += " tn.patient.id = :PatientId "; paramNames.add("PatientId"); paramValues.add(patient.getID_Patient()); } query += " order by tn.authoringInformation.authoringDateTime asc "; List<?> notes = getDomainFactory().find(query, paramNames, paramValues); return TriageNotesVoAssembler.createTriageNotesVoCollectionFromTriageNotes(notes); }