コード例 #1
0
        public void SeedChronicDisease(HealthDbContext db)
        {
            string[] diseaseNames =
            {
                "Alzheimer diseaseanddementia",
                "Arthritis",
                "Asthma",
                "Cancer",
                "COPD",
                "Crohn disease",
                "Cystic fibrosis",
                "Diabetes",
                "Epilepsy",
                "Heart disease",
                "HIV/AIDS",
                "Mood disorders (bipolar,cyclothymic, anddepression)",
                "Multiple sclerosis",
                "Parkinson disease"
            };

            List <ChronicDisease> chronicDiseases = new List <ChronicDisease>();

            for (int counter = 0; counter < diseaseNames.Length; counter++)
            {
                ChronicDisease chronicDisease = new ChronicDisease()
                {
                    Name = diseaseNames[counter]
                };

                chronicDiseases.Add(chronicDisease);
            }

            db.ChronicDiseases.AddRange(chronicDiseases);
            db.SaveChanges();
        }
コード例 #2
0
        public void AddPersonDiseaseInfo(string doctorId, string personId, PersonDiseaseInfoInputModel personDiseaseInfoInputModel)
        {
            int            diseaseId      = this.diseasesService.GetDiseaseId(personDiseaseInfoInputModel.Name);
            ChronicDisease chronicDisease = null;

            if (diseaseId == 0)
            {
                diseaseId      = this.diseasesService.Add(personDiseaseInfoInputModel.Name);
                chronicDisease = this.diseasesService.GetDisease(diseaseId);
            }
            else
            {
                chronicDisease = this.diseasesService.GetDisease(diseaseId);
            }

            PersonChronicDisease personChronicDisease = new PersonChronicDisease()
            {
                DoctorId       = doctorId,
                PersonId       = personId,
                DiagnosedOn    = DateTime.Parse(personDiseaseInfoInputModel.DiagnosedOn),
                ChronicDisease = chronicDisease
            };

            this.db.PersonChronicDiseases.Add(personChronicDisease);
            this.db.SaveChanges();
        }
コード例 #3
0
        public int Add(string name)
        {
            ChronicDisease chronicDisease = new ChronicDisease()
            {
                Name = name
            };

            this.db.ChronicDiseases.Add(chronicDisease);
            this.db.SaveChanges();

            return((int)this.GetDiseaseId(chronicDisease.Name));
        }
コード例 #4
0
 public PatientBuilder AddComorbidity(ChronicDisease comorbidity)
 {
     _comorbidities.Add(comorbidity);
     return(this);
 }