public PatientDiagnosisChecklistVo savePatientDiagnosisChecklist(PatientDiagnosisChecklistVo diagnosisChecklist) throws StaleObjectException, DomainInterfaceException { if (!diagnosisChecklist.isValidated()) throw new DomainRuntimeException("Patient Diagnosis Checklist has not been validated"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from PatientDiagnosisChecklist p "); if(diagnosisChecklist.getID_PatientDiagnosisChecklist() == null) hql.append(" where (p.clinicalContact.id = " + diagnosisChecklist.getClinicalContact().getID_ClinicalContact() + ")"); else hql.append(" where (p.clinicalContact.id = " + diagnosisChecklist.getClinicalContact().getID_ClinicalContact() + ") and p.id <> " + diagnosisChecklist.getID_PatientDiagnosisChecklist()); 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"); PatientDiagnosisChecklist domChecklist = PatientDiagnosisChecklistVoAssembler.extractPatientDiagnosisChecklist(factory, diagnosisChecklist); factory.save(domChecklist); return PatientDiagnosisChecklistVoAssembler.create(domChecklist); }
public PatientDiagnosisChecklistVo getPatientDiagnosisChecklistVo(ClinicalContactRefVo clinicalContact) { if(clinicalContact == null) throw new DomainRuntimeException("Invalid Search criteria. ClinicalContact must be supplied."); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from PatientDiagnosisChecklist p "); hql.append(" where (p.clinicalContact.id = " + clinicalContact.getID_ClinicalContact() + ")"); List list = (factory.find(hql.toString())); PatientDiagnosisChecklistVoCollection collPatientDiagnosisChecklist = PatientDiagnosisChecklistVoAssembler.createPatientDiagnosisChecklistVoCollectionFromPatientDiagnosisChecklist(list); if(collPatientDiagnosisChecklist==null || collPatientDiagnosisChecklist.size()==0) return null; return collPatientDiagnosisChecklist.get(0); }