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; }
private void populateInstanceControls(PatientSummaryNoteByHcpShortVo summaryNote) { // Clear instance controls clearInstanceControls(); // Terminate function if summary note is null if (summaryNote == null) return; // Set instance controls value form.ccAuthoringInfo().setValue(summaryNote.getAuthoringInformation()); form.richNote().setValue(summaryNote.getSummaryNote()); }
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); }
private void populateRecordBrowser(PatientSummaryNoteByHcpShortVoCollection summaryNotes) { // Clear record browser form.recbrNotes().clear(); form.getLocalContext().setHcpRecordExists(Boolean.FALSE); // Terminate function if notes collection is null if (summaryNotes == null) return; // Iterate notes collection for (PatientSummaryNoteByHcpShortVo note : summaryNotes) { // Skip null notes if (note == null) continue; // Build string to be displayed StringBuilder displayText = new StringBuilder(); displayText.append(note.getAuthoringInformation().getAuthoringHcpIsNotNull() ? note.getAuthoringInformation().getAuthoringHcp().toString() : ""); displayText.append(" - " + note.getAuthoringInformation().getAuthoringDateTime().toString()); if (note.getSystemInformationIsNotNull() && note.getSystemInformation().getLastupdateDateTime() != null) displayText.append(" - " + note.getSystemInformation().getLastupdateDateTime().toString()); // Add note to record browser form.recbrNotes().newRow(note, displayText.toString()); if (note.getAuthoringInformation().getAuthoringHcpIsNotNull() && note.getAuthoringInformation().getAuthoringHcp().equals(domain.getHcpLiteUser())) form.getLocalContext().setHcpRecordExists(Boolean.TRUE); } // Selected last recorded note (if any) if (summaryNotes.size() > 0) form.recbrNotes().setValue(summaryNotes.get(0)); // Reselect previously saved note (or last selected note) if (form.getLocalContext().getSelectedSummaryNoteIsNotNull()) form.recbrNotes().setValue(form.getLocalContext().getSelectedSummaryNote()); }