public PatientSummaryNoteByHcpShortVo getLastSummaryNote(PatientRefVo patient) { if (patient == null || !patient.getID_PatientIsNotNull()) throw new DomainRuntimeException("Can not search after null patient"); String query = " from PatientSummaryNoteByHCP as sumNote where sumNote.patient.id = :ID order by sumNote.authoringInformation.authoringDateTime desc"; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID"); paramValues.add(patient.getID_Patient()); List summarynotes = getDomainFactory().find(query, paramNames, paramValues); if(summarynotes != null && summarynotes.size() > 0) { PatientSummaryNoteByHcpShortVoCollection coll = PatientSummaryNoteByHcpShortVoAssembler.createPatientSummaryNoteByHcpShortVoCollectionFromPatientSummaryNoteByHCP(summarynotes); if(coll != null && coll.size() > 0) return coll.get(0); } return null; }
public PatientSummaryNoteByHcpShortVoCollection listSummaryNotes(PatientRefVo patient) { if (patient == null || !patient.getID_PatientIsNotNull()) throw new DomainRuntimeException("Can not search after null patient"); String query = " from PatientSummaryNoteByHCP as sumNote where sumNote.patient.id = :ID order by sumNote.authoringInformation.authoringDateTime desc"; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID"); paramValues.add(patient.getID_Patient()); return PatientSummaryNoteByHcpShortVoAssembler.createPatientSummaryNoteByHcpShortVoCollectionFromPatientSummaryNoteByHCP(getDomainFactory().find(query, paramNames, paramValues)); }
public PatientSummaryNoteByHcpShortVo getSummaryNote(PatientSummaryNoteByHCPRefVo summaryNote) { if (summaryNote == null || !summaryNote.getID_PatientSummaryNoteByHCPIsNotNull()) return null; return PatientSummaryNoteByHcpShortVoAssembler.create((PatientSummaryNoteByHCP) getDomainFactory().getDomainObject(PatientSummaryNoteByHCP.class, summaryNote.getID_PatientSummaryNoteByHCP())); }
public PatientSummaryNoteByHcpShortVo saveSummaryNote(PatientSummaryNoteByHcpShortVo summaryNote) throws DomainInterfaceException, StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException { if (summaryNote == null) throw new DomainRuntimeException("Can not save null object"); if (!summaryNote.isValidated()) throw new DomainRuntimeException("Can not save not validated object"); DomainFactory factory = getDomainFactory(); if (!summaryNote.getID_PatientSummaryNoteByHCPIsNotNull()) { // Check for previously saved notes by the same HCP for the same patient String query = " from PatientSummaryNoteByHCP as sumNote where sumNote.patient.id = :ID_PAT and sumNote.authoringInformation.authoringHcp.id = :ID_HCP and sumNote.isRIE is null"; ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID_PAT"); paramValues.add(summaryNote.getPatient().getID_Patient()); paramNames.add("ID_HCP"); paramValues.add(summaryNote.getAuthoringInformation().getAuthoringHcp().getID_Hcp()); PatientSummaryNoteByHcpShortVo existingNote = PatientSummaryNoteByHcpShortVoAssembler.create((PatientSummaryNoteByHCP) factory.findFirst(query, paramNames, paramValues)); if (existingNote != null) throw new DomainInterfaceException("A record for current patient and selected HCP already exists"); } // Get domain object PatientSummaryNoteByHCP domObj = PatientSummaryNoteByHcpShortVoAssembler.extractPatientSummaryNoteByHCP(factory, summaryNote); // Attempt save factory.save(domObj); // Return saved object VO return PatientSummaryNoteByHcpShortVoAssembler.create(domObj); }