private boolean save() { MedicNotesVo note = populateDatafromScreen(); String[] errors = note.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { form.getGlobalContext().Emergency.setMedicNote(domain.saveNote(note)); } catch (StaleObjectException e) { e.printStackTrace(); engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); engine.close(DialogResult.ABORT); return false; } return true; }
private void populateScreenFromData() { form.grdNotes().getRows().clear(); MedicNotesVoCollection notes = domain.listMedicNotes(form.getLocalContext().getPatient(), form.getLocalContext().getEpisodeOfCare(), form.getLocalContext().getCareContext()); for(MedicNotesVo note : notes) { if(note == null) continue; addNoteRow(note); } }
private void addNoteRow(MedicNotesVo note) { if(note == null) return; grdNotesRow row = form.grdNotes().getRows().newRow(); StringBuffer sb = new StringBuffer(); if(note.getAuthoringInformationIsNotNull()) { sb.append("<b>" + note.getAuthoringInformation().getAuthoringDateTime()); if(note.getAuthoringInformation().getAuthoringHcpIsNotNull()) { if(sb.length() > 0) sb.append(" - "); sb.append(note.getAuthoringInformation().getAuthoringHcp().getIHcpName()); } sb.append("</b>"); } sb.append("<br><br>"); sb.append(note.getMedicNote()); row.setColNote(sb.toString()); row.setValue(note); }
private void newMedicNote() { MedicNotesVo note = new MedicNotesVo(); note.setPatient(form.getLocalContext().getPatient()); note.setEpisode(form.getLocalContext().getEpisodeOfCare()); note.setAttendance(form.getLocalContext().getCareContext()); note.setPresentingProblem(form.getLocalContext().getClinicalProblem()); form.getGlobalContext().Emergency.setMedicNote(note); engine.open(form.getForms().Emergency.MedicNoteDialog); }