/** * Save a ProcedureVo */ public PatientProcedureChecklistVo savePatienProcedureChecklist(PatientProcedureChecklistVo procedureChecklist) throws StaleObjectException { if (!procedureChecklist.isValidated()) throw new DomainRuntimeException("Procedure Checklist has not been validated"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from PatientProcedureChecklist p "); if(procedureChecklist.getID_PatientProcedureChecklist() == null) hql.append(" where (p.clinicalContact.id = " + procedureChecklist.getClinicalContact().getID_ClinicalContact() + ")"); else hql.append(" where (p.clinicalContact.id = " + procedureChecklist.getClinicalContact().getID_ClinicalContact() + ") and p.id <> " + procedureChecklist.getID_PatientProcedureChecklist()); List list = (factory.find(hql.toString())); if(list.size() > 0) throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed"); PatientProcedureChecklist domChecklist = PatientProcedureChecklistVoAssembler.extractPatientProcedureChecklist(factory, procedureChecklist); factory.save(domChecklist); return PatientProcedureChecklistVoAssembler.create(domChecklist); }
private void open() { resetContextVariables(); clearControls(); PatientProcedureChecklistVo patientProcedureChecklistVo = domain.getPatientProcedureChecklistVo(form.getGlobalContext().Core.getCurrentClinicalContact()); populateInstanceControls(patientProcedureChecklistVo); form.setMode(FormMode.VIEW); if(engine.getFormName().equals(form.getForms().Clinical.PatientProcedureChecklistDialog)) form.btnClose().setVisible(true); else form.btnClose().setVisible(false); }
private void populateInstanceControls(PatientProcedureChecklistVo patientProcedureChecklistVo) { if (patientProcedureChecklistVo == null) return; form.getLocalContext().setPatientProcedureChecklistVo(patientProcedureChecklistVo); if (patientProcedureChecklistVo.getAuthoringInformationIsNotNull()) form.customControlAuthoringInfo().setValue(patientProcedureChecklistVo.getAuthoringInformation()); if (patientProcedureChecklistVo.getPresentProceduresIsNotNull()) populatePresentProceduresControls(patientProcedureChecklistVo.getPresentProcedures()); if (patientProcedureChecklistVo.getOtherProceduresIsNotNull()) populateOtherProceduresControls(patientProcedureChecklistVo.getOtherProcedures()); }
public PatientProcedureChecklistVo getPatientProcedureChecklistVo(ClinicalContactRefVo clinicalContact) { if(clinicalContact == null) throw new DomainRuntimeException("Invalid Search criteria. ClinicalContact must be supplied."); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from PatientProcedureChecklist p "); hql.append(" where (p.clinicalContact.id = " + clinicalContact.getID_ClinicalContact() + ")"); PatientProcedureChecklistVoCollection collPatientProcedureChecklist = PatientProcedureChecklistVoAssembler.createPatientProcedureChecklistVoCollectionFromPatientProcedureChecklist((factory.find(hql.toString()))); if(collPatientProcedureChecklist==null || collPatientProcedureChecklist.size()==0) return null; return collPatientProcedureChecklist.get(0); }