public AdmissionDetailsVo getNursingAdmission(CareContextLiteVo voCareContextLite) { if(voCareContextLite == null) throw new CodingRuntimeException("Contact not Provided"); DomainFactory factory = getDomainFactory(); //the following query retrievs the one and only contact of type spinalmedicaladmission if it has been instantiated List admisDetails = factory.find(" from AdmissionDetails ad where ad.careContext.id = :idCareContext )", new String[]{"idCareContext" }, new Object[]{ voCareContextLite.getID_CareContext()}); AdmissionDetailsVoCollection voAdmisDetails = AdmissionDetailsVoAssembler.createAdmissionDetailsVoCollectionFromAdmissionDetails(admisDetails); if(voAdmisDetails.size()>0) return voAdmisDetails.get(0); else return null; }
public AdmissionDetailsVo saveNursingAdmission(AdmissionDetailsVo voAdmissionDetails) throws StaleObjectException { if (!voAdmissionDetails.isValidated()) { throw new DomainRuntimeException("AdmissionDetails has not been validated"); } DomainFactory factory = getDomainFactory(); AdmissionDetails domAdmisDetails = AdmissionDetailsVoAssembler.extractAdmissionDetails(factory, voAdmissionDetails); factory.save(domAdmisDetails); AdmissionDetailsVo voAdmisDetails = AdmissionDetailsVoAssembler.create(domAdmisDetails); return voAdmisDetails; }