public PasEventShortVo getLatestPasEvent(PatientRefVo patient) { if (patient == null) return null; StringBuilder query = new StringBuilder("SELECT pasEv FROM PASEvent AS pasEv LEFT JOIN pasEv.patient AS pat WHERE "); query.append(" pat.id = :PATIENT_ID ORDER BY pasEv.systemInformation.creationDateTime DESC"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("PATIENT_ID"); paramValues.add(patient.getID_Patient()); return PasEventShortVoAssembler.create((PASEvent) getDomainFactory().findFirst(query.toString(), paramNames, paramValues)); }
public PasEventVo savePASEvent(PasEventShortVo pasEvent) throws ims.domain.exceptions.StaleObjectException { if(pasEvent == null) throw new DomainRuntimeException("Invalid PAS event"); if(!pasEvent.isValidated()) throw new DomainRuntimeException("PAS event was not validated"); DomainFactory factory = getDomainFactory(); PASEvent domainObject = PasEventShortVoAssembler.extractPASEvent(factory, pasEvent); factory.save(domainObject); return PasEventVoAssembler.create(domainObject); }