Пример #1
0
        private Entry CreateHistologicalResultEntry(HistologicalResultSummaryViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder createHistologicalBuilder = EhrManager.EntryBuilder.Clear()
                                                      .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Code)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Code).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Date)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.Date).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Note)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Note).Build())
                .Build()
                );

            return(createHistologicalBuilder.Build());
        }
Пример #2
0
        private Entry CreateInClinicProcedureEntry(PatientInClinicProcedurePreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder.Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MKBCode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.MKBCode).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MKBName)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.MKBName).Build()).Build()
                );

            if (model.PlanVisitDate != default)
            {
                EhrManager.EntryBuilder.Clear()
                .AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PlanVisitDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.PlanVisitDate).Build()).Build());
            }

            return(entryBuilder.Build());
        }
        private Entry CreateDrugProtocolEntry(DrugProtocolPreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder
                                         .Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ATCCode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ATCCode).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ATCName)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ATCName).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Days)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Days).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ApplicationWay)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ApplicationWay).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.StandartDose)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.StandartDose).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IndividualDose)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.IndividualDose).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CycleDose)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.CycleDose).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AllDose)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.AllDose).Build()).Build()
                );

            if (model.TherapyType != default)
            {
                entryBuilder.AddItems(
                    EhrManager.ClusterBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyType)).Build())
                    .AddParts(
                        EhrManager.ElementBuilder.Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyType.Code)).Build())
                        .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.TherapyType.Code).Build()).Build(),
                        EhrManager.ElementBuilder.Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyType.Name)).Build())
                        .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.TherapyType.Name).Build()).Build()
                        ).Build()
                    );
            }

            return(entryBuilder.Build());
        }
Пример #4
0
        protected Entry CreatePractitionerEntry(HealthcarePractitionerSummaryViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryPratitionerBuilder = EhrManager.EntryBuilder.Clear();

            if (!string.IsNullOrWhiteSpace(model.UniqueIdentifier))
            {
                entryPratitionerBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.UniqueIdentifier)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.UniqueIdentifier).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.DeputyUniqueIdentifier))
            {
                entryPratitionerBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DeputyUniqueIdentifier)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.DeputyUniqueIdentifier).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.Speciality))
            {
                entryPratitionerBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Speciality)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Speciality).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.Name))
            {
                entryPratitionerBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Name)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Name).Build())
                    .Build());
            }

            return(entryPratitionerBuilder.Build());
        }
Пример #5
0
        private Entry CreateAPr38PreviewViewModelEntry(APr38PreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder
                                         .Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Height)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Height).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Weight)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Weight).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.History)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.History).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FairCondition)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.FairCondition).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Therapy)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Therapy).Build()).Build()
                );

            if (model.Decision != default && model.Decision.Choices != default && model.Decision.Choices.Count > 0)
            {
                entryBuilder.AddItems(
                    EhrManager.ClusterBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Decision)).Build())
                    .AddParts(
                        EhrManager.ClusterBuilder
                        .Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Decision.Choices)).Build())
                        .AddParts(model.Decision.Choices.Where(ch => ch != default).Select(ch => ChoicePreviewViewModelToCluster(ch, nameof(model.Decision.Choices))).ToArray())
                        .Build())
                    .Build()
                    );
            }

            return(entryBuilder.Build());
        }
        private Entry CreateAccompanyingDrugEntry(AccompanyingDrugPreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder.Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ATCCode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ATCCode).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ATCName)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ATCName).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SingleDose)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.SingleDose).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AllDose)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.AllDose).Build()).Build()
                );

            if (model.TherapyType != default)
            {
                entryBuilder.AddItems(
                    EhrManager.ClusterBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyType)).Build())
                    .AddParts(
                        EhrManager.ElementBuilder.Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyType.Code)).Build())
                        .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.TherapyType.Code).Build()).Build(),
                        EhrManager.ElementBuilder.Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyType.Name)).Build())
                        .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.TherapyType.Name).Build()).Build()
                        )
                    .Build()
                    );
            }

            return(entryBuilder.Build());
        }
        private Entry CreateHematologyPartEntry(HematologyPartPreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder.Clear();

            if (model.PredMarker != default && model.PredMarker.Choices != default && model.PredMarker.Choices.Count > 0)
            {
                Cluster[] choiceCluster = model.PredMarker.Choices.Where(c => c != default).Select(c => CreateChoiceCluster(c, nameof(model.PredMarker.Choices))).ToArray();

                entryBuilder.AddItems(EhrManager.ClusterBuilder.Clear()
                                      .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PredMarker)).Build())
                                      .AddParts(choiceCluster)
                                      .Build());
            }

            return(entryBuilder.Build());
        }
Пример #8
0
        private Entry CreateDispObservationEntry(PatientDispObservationPreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder.Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DispDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DispDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MKBCode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.MKBCode).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MKBName)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.MKBName).Build()).Build()
                );

            return(entryBuilder.Build());
        }
Пример #9
0
        private Entry CreatePlannedEntry(PatientPlannedPreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder
                                         .Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ExaminationDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.ExaminationDate).Build()).Build()
                );

            if (model.Diagnoses != default && model.Diagnoses.Count > 0)
            {
                entryBuilder.AddItems(
                    model.Diagnoses.Where(sd => sd != default).Select(sd => CreateDiagnoseCluster(sd, nameof(model.Diagnoses))).ToArray()
                    );
            }

            return(entryBuilder.Build());
        }
Пример #10
0
        private Entry CreateProcedureEntry(ProcedureSummaryViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder createHistologicalBuilder = EhrManager.EntryBuilder.Clear()
                                                      .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Date)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.Date).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Code)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.Code).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ACHICode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ACHICode).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ImplantReferenceNumber)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ImplantReferenceNumber).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ImplantManufacturer)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ImplantManufacturer).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ImplantCode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ImplantCode).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HLNumber)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.HLNumber).Build())
                .Build()

                );

            if (!string.IsNullOrWhiteSpace(model.SendAPr))
            {
                createHistologicalBuilder = EhrManager.EntryBuilder.Clear()
                                            .AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendAPr)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SendAPr).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.InAPr))
            {
                createHistologicalBuilder = EhrManager.EntryBuilder.Clear()
                                            .AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InAPr)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.InAPr).Build())
                    .Build());
            }

            if (model.OutHospital != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutHospital)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.OutHospital).Build())
                    .Build()
                    );
            }

            if (model.BedDays != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BedDays)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.BedDays).Build())
                    .Build()
                    );
            }

            if (model.HLTotalDays != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HLTotalDays)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.HLTotalDays).Build())
                    .Build()
                    );
            }

            if (model.StateAtDischarge != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.StateAtDischarge)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.StateAtDischarge).Build())
                    .Build()
                    );
            }

            if (model.Laparoscopic != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Laparoscopic)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.Laparoscopic).Build())
                    .Build()
                    );
            }

            if (model.PathologicFinding != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PathologicFinding)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.PathologicFinding).Build())
                    .Build()
                    );
            }

            if (model.EndCourse != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.EndCourse)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.EndCourse).Build())
                    .Build()
                    );
            }

            if (model.HLDateFrom != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HLDateFrom)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.HLDateFrom).Build())
                    .Build()
                    );
            }

            return(createHistologicalBuilder.Build());
        }
Пример #11
0
        private Entry CreateUsedDrugEntry(UsedDrugSummaryViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder createHistologicalBuilder = EhrManager.EntryBuilder.Clear()
                                                      .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Date)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.Date).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Code)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Code).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Quantity)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.Quantity).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Cost)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.Cost).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ICDDrug)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ICDDrug).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.UINPrescr)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.UINPrescr).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NoPrescr)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.NoPrescr).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PracticeCodeProtocol)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PracticeCodeProtocol).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolNumber)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.ProtocolNumber).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.ProtocolDate).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolType)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.ProtocolType).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BatchNumber)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.BatchNumber).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.QuantityPack)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.QuantityPack).Build())
                .Build()
                );

            if (model.DatePrescr != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DatePrescr)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.DatePrescr).Build())
                    .Build()
                    );
            }

            return(createHistologicalBuilder.Build());
        }
Пример #12
0
        private Entry CreateEpicrisisEntry(EpicrisisSummaryViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder createHistologicalBuilder = EhrManager.EntryBuilder.Clear()
                                                      .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.History)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.History).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FairCondition)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.FairCondition).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ClinicalExaminations)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ClinicalExaminations).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Consultations)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Consultations).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Regimen)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Regimen).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DiseaseCourse)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.DiseaseCourse).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Complications)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Complications).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SampleProtocol)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SampleProtocol).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PostoperativeStatus)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PostoperativeStatus).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DischargeStatus)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.DischargeStatus).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Recommendations)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Recommendations).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CheckupAfterDischarge)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CheckupAfterDischarge).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.GPRecommendations)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.GPRecommendations).Build())
                .Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OtherDocuments)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.OtherDocuments).Build())
                .Build()
                );

            if (model.DateOfSurgery != default)
            {
                createHistologicalBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DateOfSurgery)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.DateOfSurgery).Build())
                    .Build()
                    );
            }

            return(createHistologicalBuilder.Build());
        }
Пример #13
0
        internal EhrExtract Convert(PathProcedureViewModel model, string name, string systemId)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryPathProcedureBuilder = EhrManager.EntryBuilder;

            entryPathProcedureBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientBranch)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientBranch).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientHRegion)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientHRegion).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TypeProcSend)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.TypeProcSend).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DateSend)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DateSend).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MedicalWard)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.MedicalWard).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TypeProcPriem)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.TypeProcPriem).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProcRefuse)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.ProcRefuse).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZNumChild)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.IZNumChild).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZYearChild)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.IZYearChild).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VisitDoctorUniqueIdentifier)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.VisitDoctorUniqueIdentifier).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VisitDoctorName)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.VisitDoctorName).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientStatus)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.PatientStatus).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VisitDoctorUniqueIdentifier)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.VisitDoctorUniqueIdentifier).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutUniqueIdentifier)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.OutUniqueIdentifier).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sign)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Sign).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NZOKPay)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NZOKPay).Build()).Build()
                );

            if (model.AllDoneProcedures != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AllDoneProcedures)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.AllDoneProcedures).Build())
                    .Build());
            }

            if (model.AllDrugCost != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AllDrugCost)).Build())
                    .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.AllDrugCost).Build())
                    .Build());
            }

            if (model.CPrSend != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CPrSend)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CPrSend).Build())
                    .Build());
            }

            if (model.APrSend != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.APrSend)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.APrSend).Build())
                    .Build());
            }

            if (model.CPrPriem != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CPrPriem)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CPrPriem).Build())
                    .Build());
            }

            if (model.APrPriem != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.APrPriem)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.APrPriem).Build())
                    .Build());
            }

            if (model.FirstVisitDate != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FirstVisitDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.FirstVisitDate).Build())
                    .Build());
            }

            if (model.DatePlanPriem != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DatePlanPriem)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.DatePlanPriem).Build())
                    .Build());
            }

            if (model.DateProcedureBegins != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DateProcedureBegins)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.DateProcedureBegins).Build())
                    .Build());
            }

            if (model.DateProcedureEnd != default)
            {
                entryPathProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DateProcedureEnd)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.DateProcedureEnd).Build())
                    .Build());
            }

            Content pathProcedureContent = entryPathProcedureBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder
                                                     .Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            if (model.Patient != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Patient)).Build())
                    .AddMembers(base.CreatePatientEntry(model.Patient))
                    .Build());
            }

            if (model.Sender != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sender)).Build())
                    .AddMembers(base.CreatePractitionerEntry(model.Sender))
                    .Build());
            }

            if (model.FirstMainDiag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FirstMainDiag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.FirstMainDiag))
                    .Build());
            }

            if (model.SecondMainDiag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SecondMainDiag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.SecondMainDiag))
                    .Build());
            }

            if (model.DoneNewProcedures != default && model.DoneNewProcedures.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DoneNewProcedures)).Build())
                    .AddMembers(model.DoneNewProcedures.Where(dnp => dnp != default).Select(dnp => CreateProcedureSummaryEntry(dnp)).ToArray())
                    .Build());
            }

            if (model.UsedDrugs != default && model.UsedDrugs.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.UsedDrugs)).Build())
                    .AddMembers(model.UsedDrugs.Where(ud => ud != default).Select(ud => CreateClinicUsedDrugEntry(ud)).ToArray())
                    .Build());
            }

            if (model.ClinicProcedures != default && model.ClinicProcedures.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ClinicProcedures)).Build())
                    .AddMembers(model.ClinicProcedures.Where(cp => cp != default).Select(cp => CreateClinicProcedureEntry(cp)).ToArray())
                    .Build());
            }

            if (model.DoneProcedures != default && model.DoneProcedures.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DoneProcedures)).Build())
                    .AddMembers(model.DoneProcedures.Where(dp => dp != default).Select(dp => CreateDoneProcedureEntry(dp)).ToArray())
                    .Build());
            }

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(pathProcedureContent).Build());

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.Patient.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
Пример #14
0
        internal EhrExtract Convert(OutViewModel model, string name, string systemId)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryOutBuilder = EhrManager.EntryBuilder;

            entryOutBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientBranch)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientBranch).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientHRegion)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientHRegion).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InType)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.InType).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.SendDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendUrgency)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.SendUrgency).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.UniqueIdentifier)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.UniqueIdentifier).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ExaminationDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.ExaminationDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Urgency)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Urgency).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NZOKPay)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NZOKPay).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InMedicalWard)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.InMedicalWard).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.EntryDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.EntryDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Payer)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Payer).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutMedicalWard)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.OutMedicalWard).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutUniqueIdentifier)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.OutUniqueIdentifier).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.OutDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutType)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.OutType).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BirthPractice)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.BirthPractice).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutClinicalPath)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.OutClinicalPath).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutAPr)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.OutAPr).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HLNumber)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.HLNumber).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CPFile)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CPFile).Build()).Build()
                );

            if (model.PlannedNumber != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PlannedNumber)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.PlannedNumber).Build())
                    .Build());
            }

            if (model.SendClinicalPath != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendClinicalPath)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SendClinicalPath).Build())
                    .Build());
            }

            if (model.ClinicalPath != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ClinicalPath)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ClinicalPath).Build())
                    .Build());
            }

            if (model.SendAPr != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendAPr)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SendAPr).Build())
                    .Build());
            }

            if (model.InAPr != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InAPr)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.InAPr).Build())
                    .Build());
            }

            if (model.Severity != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Severity)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.Severity).Build()).Build());
            }

            if (model.Delay != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Delay)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.Delay).Build())
                    .Build());
            }

            if (model.AgeInDays != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AgeInDays)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.AgeInDays).Build())
                    .Build());
            }

            if (model.WeightInGrams != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.WeightInGrams)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.WeightInGrams).Build())
                    .Build());
            }

            if (model.BirthWeight != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BirthWeight)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.BirthWeight).Build())
                    .Build());
            }

            if (model.MotherIZYear != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MotherIZYear)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.MotherIZYear).Build())
                    .Build());
            }

            if (model.MotherIZNo != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MotherIZNo)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.MotherIZNo).Build())
                    .Build());
            }

            if (model.IZYear != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZYear)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.IZYear).Build())
                    .Build());
            }

            if (model.IZNo != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZNo)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.IZNo).Build())
                    .Build());
            }

            if (model.BirthNumber != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BirthNumber)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.BirthNumber).Build())
                    .Build());
            }

            if (model.BirthGestWeek != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BirthGestWeek)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.BirthGestWeek).Build())
                    .Build());
            }

            if (model.BedDays != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BedDays)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.BedDays).Build())
                    .Build());
            }

            if (model.HLDateFrom != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HLDateFrom)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.HLDateFrom).Build())
                    .Build());
            }

            if (model.HLTotalDays != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HLTotalDays)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.HLTotalDays).Build())
                    .Build());
            }

            if (model.StateAtDischarge != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.StateAtDischarge)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.StateAtDischarge).Build())
                    .Build());
            }

            if (model.Laparoscopic != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Laparoscopic)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.Laparoscopic).Build())
                    .Build());
            }

            if (model.EndCourse != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.EndCourse)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.EndCourse).Build())
                    .Build());
            }

            if (model.PackageType != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PackageType)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.PackageType).Build())
                    .Build());
            }

            if (model.SendPackageType != default)
            {
                entryOutBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendPackageType)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.SendPackageType).Build())
                    .Build());
            }

            Content outContent = entryOutBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder
                                                     .Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            if (model.Patient != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Patient)).Build())
                    .AddMembers(base.CreatePatientEntry(model.Patient))
                    .Build());
            }

            if (model.Sender != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sender)).Build())
                    .AddMembers(base.CreatePractitionerEntry(model.Sender))
                    .Build());
            }

            if (model.SendDiagnoses != default && model.SendDiagnoses.Count > 0)
            {
                compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear()
                                              .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendDiagnoses)).Build())
                                              .AddMembers(model.SendDiagnoses.Where(sd => sd != default).Select(sd => base.CreateDiagnoseEntry(sd)).ToArray())
                                              .Build());
            }

            if (model.Diagnoses != default && model.Diagnoses.Count > 0)
            {
                compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear()
                                              .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Diagnoses)).Build())
                                              .AddMembers(model.Diagnoses.Where(d => d != default).Select(d => base.CreateDiagnoseEntry(d)).ToArray())
                                              .Build());
            }

            if (model.Dead != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Dead)).Build())
                    .AddMembers(base.CreateDiagnoseEntry(model.Dead))
                    .Build());
            }

            if (model.OutMainDiagnose != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutMainDiagnose)).Build())
                    .AddMembers(base.CreateDiagnoseEntry(model.OutMainDiagnose))
                    .Build());
            }

            if (model.OutDiagnoses != default && model.OutDiagnoses.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OutDiagnoses)).Build())
                    .AddMembers(model.OutDiagnoses.Where(d => d != default).Select(d => base.CreateDiagnoseEntry(d)).ToArray())
                    .Build());
            }

            if (model.HistologicalResult != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HistologicalResult)).Build())
                    .AddMembers(CreateHistologicalResultEntry(model.HistologicalResult))
                    .Build());
            }

            if (model.Epicrisis != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Epicrisis)).Build())
                    .AddMembers(CreateEpicrisisEntry(model.Epicrisis))
                    .Build());
            }

            if (model.UsedDrugs != default && model.UsedDrugs.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HistologicalResult)).Build())
                    .AddMembers(model.UsedDrugs.Where(ud => ud != default).Select(ud => CreateUsedDrugEntry(ud)).ToArray())
                    .Build());
            }

            if (model.Procedures != default && model.Procedures.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HistologicalResult)).Build())
                    .AddMembers(model.Procedures.Where(p => p != default).Select(p => CreateProcedureEntry(p)).ToArray())
                    .Build());
            }

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(outContent).Build());

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.Patient.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
Пример #15
0
        private Entry CreateClinicUsedDrugEntry(ClinicUsedDrugViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder
                                         .Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DrugDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DrugDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DrugCode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.DrugCode).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DrugName)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.DrugName).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DrugQuantity)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.DrugQuantity).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DrugCost)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.DrugCost).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ICDDrug)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ICDDrug).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.UINPrescr)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.UINPrescr).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NoPrescr)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.NoPrescr).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DatePrescr)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DatePrescr).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PracticeCodeProtocol)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PracticeCodeProtocol).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolNumber)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.ProtocolNumber).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.ProtocolDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolType)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.ProtocolType).Build()).Build()
                );

            if (model.VersionCode != default)
            {
                entryBuilder.AddItems(
                    EhrManager.ClusterBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VersionCode)).Build())
                    .AddParts(
                        EhrManager.ElementBuilder.Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VersionCode.BatchNumber)).Build())
                        .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.VersionCode.BatchNumber).Build()).Build(),
                        EhrManager.ElementBuilder.Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VersionCode.QuantityPack)).Build())
                        .AddValue(EhrManager.REALBuilder.Clear().AddValue((double)model.VersionCode.QuantityPack).Build()).Build()
                        ).Build()

                    );
            }

            return(entryBuilder.Build());
        }
        private Entry CreateChemotherapyPartEntry(ChemotherapyPartPreviewViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder.Clear()
                                         .AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DiagnoseDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DiagnoseDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ExpandDiagnose)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ExpandDiagnose).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ECOG)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.ECOG).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Staging)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Staging).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TNM)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.TNM).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyType)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.TherapyType).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.EvalAfterCycle)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.EvalAfterCycle).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Interval)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Interval).Build()).Build()
                );

            if (model.AddDiags != default && model.AddDiags.Count > 0)
            {
                entryBuilder.AddItems(model.AddDiags.Where(d => d != default).Select(d => CreateDiagCluster(d, nameof(model.AddDiags))).ToArray());
            }

            if (model.Histology != default)
            {
                entryBuilder.AddItems(CreateHistologyCluster(model.Histology, nameof(model.Histology)));
            }

            if (model.GenMarkers != default && model.GenMarkers.Count > 0)
            {
                entryBuilder.AddItems(model.GenMarkers
                                      .Where(gm => gm != default)
                                      .Select(gm => CreateGenMarkerCluster(gm, nameof(model.GenMarkers))).ToArray());
            }

            if (model.Evaluation != default && model.Evaluation.Choices != default && model.Evaluation.Choices.Count > 0)
            {
                Cluster[] choiceCluster = model.Evaluation.Choices.Where(c => c != default).Select(c => CreateChoiceCluster(c, nameof(model.Evaluation.Choices))).ToArray();

                entryBuilder.AddItems(EhrManager.ClusterBuilder.Clear()
                                      .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Evaluation)).Build())
                                      .AddParts(choiceCluster)
                                      .Build());
            }

            return(entryBuilder.Build());
        }
        internal EhrExtract Convert(ProtocolDrugTherapyViewModel model, string name, string systemId)
        {
            IEntryBuilder entryProtocolDrugTherapyBuilder = EhrManager.EntryBuilder;

            entryProtocolDrugTherapyBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientBranch)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientBranch).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientHRegion)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientHRegion).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NumberOfDecision)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NumberOfDecision).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DecisionDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DecisionDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PracticeCodeProtocol)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PracticeCodeProtocol).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NumberOfProtocol)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NumberOfProtocol).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.ProtocolDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Height)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Height).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Weight)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Weight).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BSA)).Build())
                .AddValue(EhrManager.REALBuilder.Clear().AddValue(model.BSA).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TherapyLine)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.TherapyLine).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Scheme)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Scheme).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CycleCount)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.CycleCount).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sign)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Sign).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CPFile)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CPFile).Build()).Build()
                );

            Content protocolDrugTherapyContent = entryProtocolDrugTherapyBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder
                                                     .Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            if (model.Patient != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Patient)).Build())
                    .AddMembers(base.CreatePatientEntry(model.Patient))
                    .Build());
            }

            if (model.Chairman != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Chairman)).Build())
                    .AddMembers(base.CreatePractitionerEntry(model.Chairman))
                    .Build());
            }

            if (model.Diag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Diag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.Diag))
                    .Build());
            }

            if (model.Practice != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Practice)).Build())
                    .AddMembers(CreatePracticeEntry(model.Practice))
                    .Build());
            }

            if (model.HematologyPart != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HematologyPart)).Build())
                    .AddMembers(CreateHematologyPartEntry(model.HematologyPart))
                    .Build());
            }

            if (model.ChemotherapyPart != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ChemotherapyPart)).Build())
                    .AddMembers(CreateChemotherapyPartEntry(model.ChemotherapyPart))
                    .Build());
            }

            if (model.DrugProtocols != default && model.DrugProtocols.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DrugProtocols)).Build())
                    .AddMembers(model.DrugProtocols.Where(dp => dp != default).Select(dp => CreateDrugProtocolEntry(dp)).ToArray())
                    .Build());
            }

            if (model.AccompanyingDrugs != default && model.AccompanyingDrugs.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AccompanyingDrugs)).Build())
                    .AddMembers(model.AccompanyingDrugs.Where(ad => ad != default).Select(ad => CreateAccompanyingDrugEntry(ad)).ToArray())
                    .Build());
            }

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(protocolDrugTherapyContent).Build());

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.Patient.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
Пример #18
0
        private Entry CreateDoneProcedureEntry(DoneProcedureViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryBuilder = EhrManager.EntryBuilder.Clear();

            if (model.ProcedureStartDate != default)
            {
                entryBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProcedureStartDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.ProcedureStartDate).Build()).Build());
            }

            if (model.ProcedureEndDate != default)
            {
                entryBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProcedureEndDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.ProcedureEndDate).Build()).Build());
            }

            if (model.Doctor != default)
            {
                IClusterBuilder clusterBuilder = EhrManager.ClusterBuilder.Clear()
                                                 .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Doctor)).Build());

                if (!string.IsNullOrWhiteSpace(model.Doctor.UniqueIdentifier))
                {
                    clusterBuilder.AddParts(
                        EhrManager.ElementBuilder
                        .Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Doctor.UniqueIdentifier)).Build())
                        .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Doctor.UniqueIdentifier).Build())
                        .Build());
                }

                if (!string.IsNullOrWhiteSpace(model.Doctor.DeputyUniqueIdentifier))
                {
                    clusterBuilder.AddParts(
                        EhrManager.ElementBuilder
                        .Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Doctor.DeputyUniqueIdentifier)).Build())
                        .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Doctor.DeputyUniqueIdentifier).Build())
                        .Build());
                }

                if (!string.IsNullOrWhiteSpace(model.Doctor.Speciality))
                {
                    clusterBuilder.AddParts(
                        EhrManager.ElementBuilder
                        .Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Doctor.Speciality)).Build())
                        .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Doctor.Speciality).Build())
                        .Build());
                }

                if (!string.IsNullOrWhiteSpace(model.Doctor.Name))
                {
                    clusterBuilder.AddParts(
                        EhrManager.ElementBuilder
                        .Clear()
                        .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Doctor.Name)).Build())
                        .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Doctor.Name).Build())
                        .Build());
                }

                entryBuilder.AddItems(clusterBuilder.Build());
            }

            return(entryBuilder.Build());
        }
Пример #19
0
        internal EhrExtract Convert(InClinicProcedureViewModel model, string name, string systemId)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryInClinicProcedureBuilder = EhrManager.EntryBuilder;

            entryInClinicProcedureBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientBranch)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientBranch).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientHealthRegion)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientHealthRegion).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DateSend)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DateSend).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProcRefuse)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.ProcRefuse).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZYearChild)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.IZYearChild).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VisitDoctorUniqueIdentifier)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.VisitDoctorUniqueIdentifier).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.VisitDoctorName)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.VisitDoctorName).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientStatus)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.PatientStatus).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NZOKPay)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NZOKPay).Build()).Build()
                );

            if (model.TypeProcSend != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TypeProcSend)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.TypeProcSend).Build())
                    .Build());
            }

            if (model.TypeProcPriem != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.TypeProcPriem)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.TypeProcPriem).Build())
                    .Build());
            }

            if (model.CPrSend != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CPrSend)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CPrSend).Build())
                    .Build());
            }

            if (model.APrSend != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.APrSend)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.APrSend).Build())
                    .Build());
            }

            if (model.CPrPriem != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CPrPriem)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CPrPriem).Build())
                    .Build());
            }

            if (model.APrPriem != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.APrPriem)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.APrPriem).Build())
                    .Build());
            }


            if (model.IZNumChild != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZNumChild)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.IZNumChild).Build())
                    .Build());
            }

            if (model.FirstVisitDate != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FirstVisitDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.FirstVisitDate).Build())
                    .Build());
            }

            if (model.PlanVisitDate != default)
            {
                entryInClinicProcedureBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PlanVisitDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.PlanVisitDate).Build())
                    .Build());
            }

            Content inClinicProcedureContent = entryInClinicProcedureBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder
                                                     .Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            if (model.Patient != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Patient)).Build())
                    .AddMembers(base.CreatePatientEntry(model.Patient))
                    .Build());
            }

            if (model.Sender != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sender)).Build())
                    .AddMembers(base.CreatePractitionerEntry(model.Sender))
                    .Build());
            }

            if (model.FirstMainDiag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FirstMainDiag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.FirstMainDiag))
                    .Build());
            }

            if (model.SecondMainDiag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SecondMainDiag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.SecondMainDiag))
                    .Build());
            }

            if (model.CeasedClinicalPath != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CeasedClinicalPath)).Build())
                    .AddMembers(CreateCeasedClinicalEntry(model.CeasedClinicalPath))
                    .Build());
            }

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(inClinicProcedureContent).Build());

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.Patient.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
        internal EhrExtract Convert(DispObservationViewModel model, string name, string systemId)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryDispObservationBuilder = EhrManager.EntryBuilder;

            entryDispObservationBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientBranch)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientBranch).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientHRegion)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientHRegion).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DispNum)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.DispNum).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DispDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DispDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AprCode)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.AprCode).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DiagDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DiagDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DispVisit)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.DispVisit).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Anamnesa)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Anamnesa).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.HState)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.HState).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Therapy)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Therapy).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sign)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Sign).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NZOKPay)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NZOKPay).Build()).Build()
                );

            if (model.DispanserDate != default)
            {
                entryDispObservationBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DispanserDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.DispanserDate).Build())
                    .Build());
            }

            Content dispObservationContent = entryDispObservationBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder
                                                     .Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            if (model.Patient != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Patient)).Build())
                    .AddMembers(base.CreatePatientEntry(model.Patient))
                    .Build());
            }

            if (model.Doctor != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Doctor)).Build())
                    .AddMembers(base.CreatePractitionerEntry(model.Doctor))
                    .Build());
            }

            if (model.FirstMainDiag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FirstMainDiag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.FirstMainDiag))
                    .Build());
            }

            if (model.SecondMainDiag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SecondMainDiag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.SecondMainDiag))
                    .Build());
            }

            if (model.MDIs != default && model.MDIs.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MDIs)).Build())
                    .AddMembers(model.MDIs.Where(m => m != default).Select(m => CreateMDIsEntry(m)).ToArray())
                    .Build());
            }

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(dispObservationContent).Build());

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.Patient.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
Пример #21
0
        internal EhrExtract Convert(CommissionAprViewModel model, string name, string systemId)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryCommissionAprBuilder = EhrManager.EntryBuilder;

            entryCommissionAprBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientBranch)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientBranch).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientHRegion)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientHRegion).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.SendDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SpecCommission)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.SpecCommission).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NoDecision)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NoDecision).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DecisionDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DecisionDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sign)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Sign).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NZOKPay)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NZOKPay).Build()).Build()
                );

            if (model.AprSend != default)
            {
                entryCommissionAprBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AprSend)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.AprSend).Build())
                    .Build());
            }

            if (model.AprPriem != default)
            {
                entryCommissionAprBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AprPriem)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.AprPriem).Build())
                    .Build());
            }

            Content commissionAprContent = entryCommissionAprBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder
                                                     .Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            if (model.Patient != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Patient)).Build())
                    .AddMembers(base.CreatePatientEntry(model.Patient))
                    .Build());
            }

            if (model.Sender != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sender)).Build())
                    .AddMembers(base.CreatePractitionerEntry(model.Sender))
                    .Build());
            }

            if (model.MainDiag != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MainDiag)).Build())
                    .AddMembers(base.CreateDiagEntry(model.MainDiag))
                    .Build());
            }

            if (model.AddDiags != default && model.AddDiags.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AddDiags)).Build())
                    .AddMembers(model.AddDiags.Where(ad => ad != default).Select(d => base.CreateDiagEntry(d)).ToArray())
                    .Build());
            }

            if (model.APr38 != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.APr38)).Build())
                    .AddMembers(CreateAPr38PreviewViewModelEntry(model.APr38))
                    .Build());
            }

            if (model.APr05 != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.APr05)).Build())
                    .AddMembers(CreateAPr05PreviewViewModelEntry(model.APr05))
                    .Build());
            }

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(commissionAprContent).Build());

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.Patient.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
Пример #22
0
        internal EhrExtract Convert(PatientViewModel model, string name, string systemId)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryPatientBuilder = EhrManager.EntryBuilder;

            entryPatientBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IdentityNumber)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.IdentityNumber).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BirthDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.BirthDate).Build()).Build()
                );

            if (!string.IsNullOrWhiteSpace(model.FirstName))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FirstName)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.FirstName).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.SecondName))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SecondName)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SecondName).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.LastName))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.LastName)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.LastName).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.Sex))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sex)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Sex).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.Address))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Address)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Address).Build())
                    .Build());
            }

            if (!string.IsNullOrWhiteSpace(model.Notes))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Notes)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Notes).Build())
                    .Build());
            }

            Content patientBuilderContent = entryPatientBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder
                                                     .Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(patientBuilderContent).Build());

            if (model.Ins != default && model.Ins.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Ins)).Build())
                    .AddMembers(model.Ins.Where(i => i != default).Select(i => CreateInEntry(i)).ToArray())
                    .Build());
            }

            if (model.InClinicProcedures != default && model.InClinicProcedures.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InClinicProcedures)).Build())
                    .AddMembers(model.InClinicProcedures.Where(icp => icp != default).Select(icp => CreateInClinicProcedureEntry(icp)).ToArray())
                    .Build());
            }

            if (model.Outs != default && model.Outs.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Outs)).Build())
                    .AddMembers(model.Outs.Where(o => o != default).Select(o => CreateOutEntry(o)).ToArray())
                    .Build());
            }

            if (model.PathProcedures != default && model.PathProcedures.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PathProcedures)).Build())
                    .AddMembers(model.PathProcedures.Where(pp => pp != default).Select(pp => CreatePathProcedureEntry(pp)).ToArray())
                    .Build());
            }

            if (model.ProtocolDrugTherapies != default && model.ProtocolDrugTherapies.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ProtocolDrugTherapies)).Build())
                    .AddMembers(model.ProtocolDrugTherapies.Where(pdt => pdt != default).Select(pdt => CreateProtocolDrugTherapyEntry(pdt)).ToArray())
                    .Build());
            }

            if (model.CommissionAprs != default && model.CommissionAprs.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CommissionAprs)).Build())
                    .AddMembers(model.CommissionAprs.Where(ca => ca != default).Select(ca => CreateCommissionAprEntry(ca)).ToArray())
                    .Build());
            }

            if (model.DispObservations != default && model.DispObservations.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DispObservations)).Build())
                    .AddMembers(model.DispObservations.Where(disp => disp != default).Select(disp => CreateDispObservationEntry(disp)).ToArray())
                    .Build());
            }

            if (model.Plannings != default && model.Plannings.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Plannings)).Build())
                    .AddMembers(model.Plannings.Where(p => p != default).Select(p => CreatePlannedEntry(p)).ToArray())
                    .Build());
            }

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
Пример #23
0
        internal EhrExtract Convert(InViewModel model, string name, string systemId)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryInsBuilder = EhrManager.EntryBuilder;

            entryInsBuilder.AddItems(
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientBranch)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientBranch).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PatientHRegion)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PatientHRegion).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InType)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.InType).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.SendDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendUrgency)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.SendUrgency).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.UniqueIdentifier)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.UniqueIdentifier).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ExaminationDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.ExaminationDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Urgency)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Urgency).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NZOKPay)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NZOKPay).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InMedicalWard)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.InMedicalWard).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.EntryDate)).Build())
                .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.EntryDate).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Severity)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Severity).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Payer)).Build())
                .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.Payer).Build()).Build(),
                EhrManager.ElementBuilder.Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CPFile)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CPFile).Build()).Build()
                );

            if (model.PlannedNumber != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PlannedNumber)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.PlannedNumber).Build())
                    .Build());
            }

            if (model.SendClinicalPath != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendClinicalPath)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SendClinicalPath).Build())
                    .Build());
            }

            if (model.ClinicalPath != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ClinicalPath)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ClinicalPath).Build())
                    .Build());
            }

            if (model.SendAPr != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendAPr)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SendAPr).Build())
                    .Build());
            }

            if (model.InAPr != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.InAPr)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.InAPr).Build())
                    .Build());
            }

            if (model.Delay != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Delay)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.Delay).Build())
                    .Build());
            }

            if (model.AgeInDays != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.AgeInDays)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.AgeInDays).Build())
                    .Build());
            }

            if (model.WeightInGrams != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.WeightInGrams)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.WeightInGrams).Build())
                    .Build());
            }

            if (model.BirthWeight != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BirthWeight)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.BirthWeight).Build())
                    .Build());
            }

            if (model.MotherIZYear != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MotherIZYear)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.MotherIZYear).Build())
                    .Build());
            }

            if (model.MotherIZNo != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.MotherIZNo)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.MotherIZNo).Build())
                    .Build());
            }

            if (model.IZYear != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZYear)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.IZYear).Build())
                    .Build());
            }

            if (model.IZNo != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZNo)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.IZNo).Build())
                    .Build());
            }

            if (model.PackageType != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PackageType)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.PackageType).Build())
                    .Build());
            }

            if (model.SendPackageType != default)
            {
                entryInsBuilder.AddItems(
                    EhrManager.ElementBuilder
                    .Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendPackageType)).Build())
                    .AddValue(EhrManager.INTBuilder.Clear().AddValue((int)model.SendPackageType).Build())
                    .Build());
            }

            Content insContent = entryInsBuilder.Build();

            ICompositionBuilder compositionBuilder = EhrManager.CompositionBuilder.Clear()
                                                     .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(name).Build());

            if (model.Patient != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Patient)).Build())
                    .AddMembers(base.CreatePatientEntry(model.Patient))
                    .Build());
            }

            if (model.Sender != default)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sender)).Build())
                    .AddMembers(base.CreatePractitionerEntry(model.Sender))
                    .Build());
            }

            if (model.SendDiagnoses != default && model.SendDiagnoses.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SendDiagnoses)).Build())
                    .AddMembers(model.SendDiagnoses.Where(sd => sd != default).Select(sd => base.CreateDiagnoseEntry(sd)).ToArray())
                    .Build());
            }

            if (model.Diagnoses != default && model.Diagnoses.Count > 0)
            {
                compositionBuilder.AddContent(
                    EhrManager.SectionBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Diagnoses)).Build())
                    .AddMembers(model.Diagnoses.Where(d => d != default).Select(d => base.CreateDiagnoseEntry(d)).ToArray())
                    .Build());
            }

            compositionBuilder.AddContent(EhrManager.SectionBuilder.Clear().AddMembers(insContent).Build());

            EhrExtract ehrExtractModel = EhrManager
                                         .EhrExtractModelBuilder
                                         .AddEhrSystem(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(systemId)).Build())
                                         .AddSubjectOfCare(EhrManager.IIBuilder.Clear().AddRoot(EhrManager.OIDBuilder.Build(model.Patient.IdentityNumber)).Build())
                                         .AddTimeCreated(EhrManager.TSBuilder.Clear().AddTime(DateTime.Now).Build())
                                         .AddComposition(compositionBuilder.Build())
                                         .Build();

            return(ehrExtractModel);
        }
Пример #24
0
        protected Entry CreatePatientEntry(PatientSummaryViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            IEntryBuilder entryPatientBuilder = EhrManager.EntryBuilder.Clear();

            entryPatientBuilder.AddItems(
                EhrManager.ElementBuilder
                .Clear()
                .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IdentityNumber)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.IdentityNumber).Build())
                .Build(),
                EhrManager.ElementBuilder
                .Clear().AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sex)).Build())
                .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Sex).Build())
                .Build()
                );

            if (!string.IsNullOrWhiteSpace(model.FirstName))
            {
                entryPatientBuilder
                .AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FirstName)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.FirstName).Build()).Build());
            }

            if (!string.IsNullOrWhiteSpace(model.SecondName))
            {
                entryPatientBuilder
                .AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SecondName)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SecondName).Build()).Build());
            }

            if (!string.IsNullOrWhiteSpace(model.LastName))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.LastName)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.LastName).Build()).Build());
            }

            if (!string.IsNullOrWhiteSpace(model.Address))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Address)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Address).Build()).Build());
            }

            if (model.BirthDate != default)
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.BirthDate)).Build())
                    .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.BirthDate).Build()).Build());
            }

            if (!string.IsNullOrWhiteSpace(model.Notes))
            {
                entryPatientBuilder.AddItems(
                    EhrManager.ElementBuilder.Clear()
                    .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Notes)).Build())
                    .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Notes).Build()).Build());
            }

            return(entryPatientBuilder.Build());
        }