public static ims.core.clinical.domain.objects.PatientDiagnosis extractPatientDiagnosis( ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.PatientDiagnosisEDischargeVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_PatientDiagnosis(); ims.core.clinical.domain.objects.PatientDiagnosis domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.core.clinical.domain.objects.PatientDiagnosis) domMap.get(valueObject); } // ims.core.vo.PatientDiagnosisEDischargeVo ID_PatientDiagnosis field is unknown domainObject = new ims.core.clinical.domain.objects.PatientDiagnosis(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PatientDiagnosis()); if (domMap.get(key) != null) { return (ims.core.clinical.domain.objects.PatientDiagnosis) domMap.get(key); } domainObject = (ims.core.clinical.domain.objects.PatientDiagnosis) domainFactory.getDomainObject( ims.core.clinical.domain.objects.PatientDiagnosis.class, id); // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception, // but maybe should be handled as that further up. if (domainObject == null) return null; domMap.put(key, domainObject); } domainObject.setVersion(valueObject.getVersion_PatientDiagnosis()); domainObject.setStatusHistory( ims.clinical.vo.domain.PatientDiagnosisStatusVoAssembler.extractPatientDiagnosisStatusSet( domainFactory, valueObject.getStatusHistory(), domainObject.getStatusHistory(), domMap)); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getDiagnosisDescription() != null && valueObject.getDiagnosisDescription().equals("")) { valueObject.setDiagnosisDescription(null); } domainObject.setDiagnosisDescription(valueObject.getDiagnosisDescription()); ims.framework.utils.PartialDate DiagnosedDate = valueObject.getDiagnosedDate(); Integer value3 = null; if (null != DiagnosedDate) { value3 = DiagnosedDate.toInteger(); } domainObject.setDiagnosedDate(value3); // SaveAsRefVO - treated as a refVo in extract methods ims.core.clinical.domain.objects.Diagnosis value4 = null; if (null != valueObject.getDiagnosis()) { if (valueObject.getDiagnosis().getBoId() == null) { if (domMap.get(valueObject.getDiagnosis()) != null) { value4 = (ims.core.clinical.domain.objects.Diagnosis) domMap.get(valueObject.getDiagnosis()); } } else { value4 = (ims.core.clinical.domain.objects.Diagnosis) domainFactory.getDomainObject( ims.core.clinical.domain.objects.Diagnosis.class, valueObject.getDiagnosis().getBoId()); } } domainObject.setDiagnosis(value4); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value5 = null; if (null != valueObject.getSourceofInformation()) { value5 = domainFactory.getLookupInstance(valueObject.getSourceofInformation().getID()); } domainObject.setSourceofInformation(value5); domainObject.setIsComplication(valueObject.getIsComplication()); domainObject.setIsComorbidity(valueObject.getIsComorbidity()); java.util.Date value8 = null; ims.framework.utils.Date date8 = valueObject.getDateResolved(); if (date8 != null) { value8 = date8.getDate(); } domainObject.setDateResolved(value8); // SaveAsRefVO - treated as a refVo in extract methods ims.core.admin.domain.objects.CareContext value9 = null; if (null != valueObject.getCareContext()) { if (valueObject.getCareContext().getBoId() == null) { if (domMap.get(valueObject.getCareContext()) != null) { value9 = (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext()); } } else { value9 = (ims.core.admin.domain.objects.CareContext) domainFactory.getDomainObject( ims.core.admin.domain.objects.CareContext.class, valueObject.getCareContext().getBoId()); } } domainObject.setCareContext(value9); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value10 = null; if (null != valueObject.getDiagLaterality()) { value10 = domainFactory.getLookupInstance(valueObject.getDiagLaterality().getID()); } domainObject.setDiagLaterality(value10); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getSiteText() != null && valueObject.getSiteText().equals("")) { valueObject.setSiteText(null); } domainObject.setSiteText(valueObject.getSiteText()); domainObject.setAuthoringInfo( ims.core.vo.domain.AuthoringInformationVoAssembler.extractAuthoringInformation( domainFactory, valueObject.getAuthoringInfo(), domMap)); domainObject.setIncludeDiagnosisInDiscReports( ims.core.vo.domain.IncludeDiagnosisInDischargeReportVoAssembler .extractIncludeDiagnosisInDischargeReportSet( domainFactory, valueObject.getIncludeDiagnosisInDiscReports(), domainObject.getIncludeDiagnosisInDiscReports(), domMap)); domainObject.setIsPrevRelevantDiagnosis(valueObject.getIsPrevRelevantDiagnosis()); java.util.Date value16 = null; ims.framework.utils.Date date16 = valueObject.getDateOnset(); if (date16 != null) { value16 = date16.getDate(); } domainObject.setDateOnset(value16); ims.core.admin.domain.objects.ClinicalContact value17 = null; if (null != valueObject.getClinicalContact()) { if (valueObject.getClinicalContact().getBoId() == null) { if (domMap.get(valueObject.getClinicalContact()) != null) { value17 = (ims.core.admin.domain.objects.ClinicalContact) domMap.get(valueObject.getClinicalContact()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value17 = domainObject.getClinicalContact(); } else { value17 = (ims.core.admin.domain.objects.ClinicalContact) domainFactory.getDomainObject( ims.core.admin.domain.objects.ClinicalContact.class, valueObject.getClinicalContact().getBoId()); } } domainObject.setClinicalContact(value17); domainObject.setPrimaryForCareSpells( ims.core.vo.domain.CSPrimaryDiagnosisVoAssembler.extractCsPrimaryDiagnosisSet( domainFactory, valueObject.getPrimaryForCareSpells(), domainObject.getPrimaryForCareSpells(), domMap)); domainObject.setCoMorbidityForEpisodeOfCares( ims.core.vo.domain.EpisodeOfCareCoMorbidityVoAssembler.extractEpisodeOfCareCoMorbiditySet( domainFactory, valueObject.getCoMorbidityForEpisodeOfCares(), domainObject.getCoMorbidityForEpisodeOfCares(), domMap)); ims.core.admin.domain.objects.EpisodeOfCare value20 = null; if (null != valueObject.getEpisodeOfCare()) { if (valueObject.getEpisodeOfCare().getBoId() == null) { if (domMap.get(valueObject.getEpisodeOfCare()) != null) { value20 = (ims.core.admin.domain.objects.EpisodeOfCare) domMap.get(valueObject.getEpisodeOfCare()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value20 = domainObject.getEpisodeOfCare(); } else { value20 = (ims.core.admin.domain.objects.EpisodeOfCare) domainFactory.getDomainObject( ims.core.admin.domain.objects.EpisodeOfCare.class, valueObject.getEpisodeOfCare().getBoId()); } } domainObject.setEpisodeOfCare(value20); domainObject.setDiagnosedOnAdmission(valueObject.getDiagnosedOnAdmission()); return domainObject; }