Пример #1
0
        public VisitSummary CreateVisitSummary(Visit visit, IPersistenceContext context)
        {
            var patientProfileAssembler = new PatientProfileAssembler();
            var summary = new VisitSummary
            {
                VisitRef      = visit.GetRef(),
                Patient       = patientProfileAssembler.CreatePatientProfileSummary(visit.PatientProfile, context),
                VisitNumber   = CreateVisitNumberDetail(visit.VisitNumber),
                AdmissionType = EnumUtils.GetEnumValueInfo(visit.AdmissionType),
                PatientClass  = EnumUtils.GetEnumValueInfo(visit.PatientClass),
                PatientType   = EnumUtils.GetEnumValueInfo(visit.PatientType),
                Status        = EnumUtils.GetEnumValueInfo(visit.Status, context),
                AdmitTime     = visit.AdmitTime,
                DischargeTime = visit.DischargeTime
            };

            var facilityAssembler = new FacilityAssembler();

            summary.Facility = visit.Facility == null ? null : facilityAssembler.CreateFacilitySummary(visit.Facility);

            var locationAssembler = new LocationAssembler();

            summary.CurrentLocation = visit.CurrentLocation == null ? null : locationAssembler.CreateLocationSummary(visit.CurrentLocation);
            summary.CurrentRoom     = visit.CurrentRoom;
            summary.CurrentBed      = visit.CurrentBed;

            return(summary);
        }
Пример #2
0
        public LoadVisitForEditResponse LoadVisitForEdit(LoadVisitForEditRequest request)
        {
            IVisitBroker broker = PersistenceContext.GetBroker <IVisitBroker>();

            Visit          visit     = broker.Load(request.VisitRef);
            VisitAssembler assembler = new VisitAssembler();

            return(new LoadVisitForEditResponse(visit.GetRef(), assembler.CreateVisitDetail(visit, PersistenceContext)));
        }
Пример #3
0
        private static void UpdateListItem(VisitListItem data, Visit visit, IPersistenceContext context)
        {
            var facilityAssembler = new FacilityAssembler();

            data.VisitRef       = visit.GetRef();
            data.VisitNumber    = new CompositeIdentifierDetail(visit.VisitNumber.Id, EnumUtils.GetEnumValueInfo(visit.VisitNumber.AssigningAuthority));
            data.PatientClass   = EnumUtils.GetEnumValueInfo(visit.PatientClass);
            data.PatientType    = EnumUtils.GetEnumValueInfo(visit.PatientType);
            data.AdmissionType  = EnumUtils.GetEnumValueInfo(visit.AdmissionType);
            data.VisitStatus    = EnumUtils.GetEnumValueInfo(visit.Status, context);
            data.AdmitTime      = visit.AdmitTime;
            data.DischargeTime  = visit.DischargeTime;
            data.VisitFacility  = facilityAssembler.CreateFacilitySummary(visit.Facility);
            data.PreadmitNumber = visit.PreadmitNumber;
        }
Пример #4
0
        public VisitDetail CreateVisitDetail(Visit visit, IPersistenceContext context)
        {
            var patientProfileAssembler = new PatientProfileAssembler();
            var detail = new VisitDetail
            {
                VisitRef             = visit.GetRef(),
                Patient              = patientProfileAssembler.CreatePatientProfileSummary(visit.PatientProfile, context),
                VisitNumber          = CreateVisitNumberDetail(visit.VisitNumber),
                AdmissionType        = EnumUtils.GetEnumValueInfo(visit.AdmissionType),
                PatientClass         = EnumUtils.GetEnumValueInfo(visit.PatientClass),
                PatientType          = EnumUtils.GetEnumValueInfo(visit.PatientType),
                Status               = EnumUtils.GetEnumValueInfo(visit.Status, context),
                AdmitTime            = visit.AdmitTime,
                DischargeTime        = visit.DischargeTime,
                DischargeDisposition = visit.DischargeDisposition,
                Facility             = new FacilityAssembler().CreateFacilitySummary(visit.Facility),
                CurrentLocation      = visit.CurrentLocation == null ? null : new LocationAssembler().CreateLocationSummary(visit.CurrentLocation),
                CurrentRoom          = visit.CurrentRoom,
                CurrentBed           = visit.CurrentBed,
                Locations            = new List <VisitLocationDetail>(),
                PreadmitNumber       = visit.PreadmitNumber,
                VipIndicator         = visit.VipIndicator,
                ExtendedProperties   = ExtendedPropertyUtils.Copy(visit.ExtendedProperties)
            };

            foreach (var vl in visit.Locations)
            {
                detail.Locations.Add(CreateVisitLocationDetail(vl, context));
            }

            detail.Practitioners = new List <VisitPractitionerDetail>();
            foreach (var vp in visit.Practitioners)
            {
                detail.Practitioners.Add(CreateVisitPractitionerDetail(vp, context));
            }

            detail.AmbulatoryStatuses = new List <EnumValueInfo>();
            foreach (var ambulatoryStatus in visit.AmbulatoryStatuses)
            {
                detail.AmbulatoryStatuses.Add(EnumUtils.GetEnumValueInfo(ambulatoryStatus));
            }

            return(detail);
        }