public PageFormulationDuMedicament(Medicament leMedicamentSelectionne)
 {
     InitializeComponent();
     ContexteMedicament = leMedicamentSelectionne;
     AfficherFormulationDuMedicament();
 }
Example #2
0
        async void TakePhoto()
        {
            InternetAccess.IsVisible = false;
            string objectFound = "";
            float  prediction  = 0;
            List <Classification> classificationList = new List <Classification>();
            PredictionResult      result             = new PredictionResult();
            await CrossMedia.Current.Initialize();

            // asynchronous method of taking pictures with the built-in camera
            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                DefaultCamera      = Plugin.Media.Abstractions.CameraDevice.Rear,
                PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Small,
                CompressionQuality = 75,
                Name = "medicament.jpg"
            }
                                                               );

            if (file == null)
            {
                return;
            }
            var stream = file.GetStream();

            byte[] bytes  = System.IO.File.ReadAllBytes(file.Path);
            var    client = new HttpClient();

            client.Timeout = new TimeSpan(0, 0, 3);
            client.DefaultRequestHeaders.Add("Prediction-Key", "key ");

            string url = "url to custom vision ";

            HttpResponseMessage response;

            var content = new ByteArrayContent(bytes);

            content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
            try
            {
                //geting ours prediction from custom vision server using http client
                response = await client.PostAsync(url, content);

                var json = await response.Content.ReadAsStringAsync();

                result             = JsonConvert.DeserializeObject <PredictionResult>(json);
                classificationList = result.Predictions;
                objectFound        = classificationList[0].TagName.ToString();
                prediction         = classificationList[0].Probability;
                prediction        *= 100;
            }
            catch (Exception e)
            {
                InternetAccess.Text      = "No Internet Access!";
                InternetAccess.IsVisible = true;
            }

            Photo.Source = ImageSource.FromStream(() => stream);
            // accuracy of ours prediction must over 75%
            if (objectFound != null && prediction > 75)
            {
                Found.Text = objectFound;
                Medicament foundMedicament = medicaments.Find(x => x.Name == objectFound);
                if (foundMedicament != null)
                {
                    // showing results to screen
                    CompositionLabel.IsVisible = true;
                    DoseLabel.IsVisible        = true;
                    IndicationsLabel.IsVisible = true;
                    AbilityLabel.IsVisible     = true;
                    Composition.Text           = foundMedicament.Composition;
                    Dose.Text        = foundMedicament.Dose;
                    Indications.Text = foundMedicament.Indications;
                    if (foundMedicament.AbilityToDrive)
                    {
                        AbilityToDrive.Text = "Tak";
                    }
                    else
                    {
                        AbilityToDrive.Text = "Nie";
                    }
                }
                else
                {
                    Found.Text = Found.Text + Environment.NewLine + " Object not found in database!";
                }
            }
            else
            {
                Found.Text = "Object not found!";
                CompositionLabel.IsVisible = false;
                DoseLabel.IsVisible        = false;
                IndicationsLabel.IsVisible = false;
                AbilityLabel.IsVisible     = false;
                Composition.Text           = "";
                Dose.Text           = "";
                Indications.Text    = "";
                AbilityToDrive.Text = "";
            }
        }
 public PageListeDesIncompatibilites(Medicament m)
 {
     InitializeComponent();
     leMedicamentSelectionne = m;
     AfficherLesIncompatibilitesDuMedicament();
 }
Example #4
0
 public void Edit(Medicament medicament)
 {
     db.Entry(medicament).State = EntityState.Modified;
     db.SaveChanges();
 }
 public void AddStudent(Medicament s)
 {
     throw new Exception("Optiunea AddStudent nu este implementata");
 }
 public async Task <int> Update(Medicament medicament)
 {
     return(await _medicamentRepository.UpdateAsync(medicament));
 }
Example #7
0
        // chargement des données de la base dans les différentes collections statique de la classe Globale
        // dans cette méthode pas de bloc try catch car aucune erreur imprévisible en production ne doit se produire
        // en cas d'erreur en développement il faut laisser faire le debogueur de VS qui va signaler la ligne en erreur
        static public void chargerDonnees()
        {
            cnx.Open();

            // Chargement des objets Motifs
            MySqlCommand cmd = new MySqlCommand()
            {
                Connection  = cnx,
                CommandText = "getLesMotifs",
                CommandType = CommandType.StoredProcedure
            };
            var curseur = cmd.ExecuteReader();

            while (curseur.Read())
            {
                int    id        = (Int32)curseur["id"];
                string unLibelle = (string)curseur["libelle"];
                // création de l'objet et ajout dans donnees
                Motif unMotif = new Motif(id, unLibelle);
                Globale.LesMotifs.Add(unMotif);
            }
            curseur.Close();

            // Chargement des objets TypePraticien : on utilise le même objet Command on change juste le nom de la procédure stockée à exécuter

            cmd.CommandText = "getLesTypes";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id        = curseur["id"].ToString();
                string unLibelle = curseur["libelle"].ToString();
                // création de l'objet et ajout dans donnees
                TypePraticien unType = new TypePraticien(id, unLibelle);
                Globale.LesTypes.Add(unType);
            }
            curseur.Close();

            // Chargement des objets ville
            cmd.CommandText = "getLesVilles";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string nom        = curseur["nom"].ToString();
                string codePostal = curseur["codePostal"].ToString();
                // création de l'objet et ajout dans donnees
                Ville uneVille = new Ville(nom, codePostal);
                Globale.LesVilles.Add(uneVille);
            }
            curseur.Close();


            // Chargement des objets Specialite
            cmd.CommandText = "getLesSpecialites";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id        = curseur["id"].ToString();
                string unLibelle = curseur["libelle"].ToString();
                // création de l'objet et ajout dans donnees
                Specialite uneSpecialite = new Specialite(id, unLibelle);
                Globale.LesSpecialites.Add(uneSpecialite);
            }
            curseur.Close();

            // Chargement des objets Famille
            cmd.CommandText = "getLesFamilles";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id        = (string)curseur["id"];
                string unLibelle = (string)curseur["libelle"];
                // création de l'objet et ajout dans donnees
                Famille uneFamille = new Famille(id, unLibelle);
                Globale.LesFamilles.Add(id, uneFamille);
            }
            curseur.Close();

            // chargement des objets médicaments
            cmd.CommandText = "getLesMedicaments";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id               = (string)curseur["id"];
                string nom              = (string)curseur["nom"];
                string composition      = (string)curseur["composition"];
                string effet            = (string)curseur["effets"];
                string contreIndication = (string)curseur["contreIndication"];
                string idFamille        = (string)curseur["idFamille"];
                // récupération de l'objet Famille
                Famille uneFamille = Globale.LesFamilles[idFamille];
                // création de l'objet et ajout dans donnees
                Medicament unMedicament = new Medicament(id, nom, composition, effet, contreIndication, uneFamille);
                Globale.LesMedicaments.Add(unMedicament);
            }
            curseur.Close();

            // chargement des praticiens
            cmd.CommandText = "getLesPraticiens";
            cmd.Parameters.AddWithValue("idVisiteur", Globale.LeVisiteur.Id);
            curseur = cmd.ExecuteReader();
            while (curseur.Read())
            {
                int    id           = (Int32)curseur["id"];
                string nom          = (string)curseur["nom"];
                string prenom       = (string)curseur["prenom"];
                string rue          = (string)curseur["rue"];
                string codePostal   = (string)curseur["codePostal"];
                string ville        = (string)curseur["ville"];
                string email        = (string)curseur["email"];
                string telephone    = (string)curseur["telephone"];
                string idType       = (string)curseur["idType"];
                string idSpecialite = curseur.IsDBNull(9) ? null : (string)curseur["idSpecialite"];
                // création de l'objet et ajout dans l'objet db.LeVisiteur
                TypePraticien unType        = Globale.LesTypes.Find(x => x.Id == idType);
                Specialite    uneSpecialite = null;
                if (idSpecialite != null)
                {
                    uneSpecialite = Globale.LesSpecialites.Find(x => x.Id == idSpecialite);
                }

                Praticien unPraticien = new Praticien(id, nom, prenom, rue, codePostal, ville, email, telephone, unType, uneSpecialite);
                Globale.LeVisiteur.ajouterPraticien(unPraticien);
            }
            curseur.Close();


            // chargement des visites du visiteur connecté
            cmd.CommandText = "getLesVisites";
            // pas de changement au niveau des paramètres à transmettre : on garde l'id du visiteur avec la même valeur
            curseur = cmd.ExecuteReader();
            while (curseur.Read())
            {
                int idVisite    = (Int32)curseur["id"];
                int idPraticien = (Int32)curseur["idPraticien"];
                int idMotif     = (Int32)curseur["idMotif"];

                DateTime dateEtHeure = curseur.GetDateTime(1);
                // récupération des objets liés
                Motif     unMotif     = Globale.LesMotifs.Find(x => x.Id == idMotif);
                Praticien unPraticien = Globale.LeVisiteur.getPraticien(idPraticien);
                // création de l'objet visite qui est automatiquement ajouté dans la collection des visites du visiteur
                Visite uneVisite = new Visite(idVisite, unPraticien, unMotif, dateEtHeure, Globale.LeVisiteur);
                // si le bilan est enregistré
                if (!curseur.IsDBNull(4))
                {
                    // initialisation du bilan et du premierMedicament
                    string     bilan        = curseur["bilan"].ToString();
                    string     idMedicament = curseur["premierMedicament"].ToString();
                    Medicament premier      = Globale.LesMedicaments.Find(x => x.Id == idMedicament);
                    Medicament second       = null;
                    // initialisation éventuelle du second médicament s'il est renseigné
                    if (!curseur.IsDBNull(6))
                    {
                        idMedicament = curseur["secondMedicament"].ToString();
                        second       = Globale.LesMedicaments.Find(x => x.Id == idMedicament);
                    }
                    uneVisite.enregistrerBilan(bilan, premier, second);
                    // le chargement des échantillons s'effetue globalement à la fin
                }
            }
            curseur.Close();

            // chargement de la synthèse des échantillons distribués par le visiteur
            cmd.CommandText = "getLesEchantillons";
            // pas de changement au niveau des paramètres à transmettre : on garde l'id du visiteur avec la même valeur
            curseur = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string idMedicament = curseur["idMedicament"].ToString();
                int    quantite     = (Int32)curseur["quantite"];
                int    idVisite     = (Int32)curseur["idVisite"];

                Visite uneVisite = Globale.LeVisiteur.getLaVisite(idVisite);

                uneVisite.ajouterEchantillon(Globale.LesMedicaments.Find(x => x.Id == idMedicament), quantite);
            }

            // chargement des villes du département du visiteur pour la mise en place de l'auto complétion sur l'ajout d'un praticien
            // [ à compléter]
            cnx.Close();
        }
        public IActionResult ChangeMedicament(Medicament medicament)
        {
            this.medicamentsService.Update(medicament);

            return(RedirectToAction("List"));
        }
        internal static Medicament[] InitialMedicamentSeed(HospitalContext context)
        {
            var medicamentNames = new Medicament[]
            {
                new Medicament()
                {
                    MedicamentId = 1, Name = "Biseptol"
                },
                new Medicament()
                {
                    MedicamentId = 2, Name = "Ciclobenzaprina"
                },
                new Medicament()
                {
                    MedicamentId = 3, Name = "Curam"
                },
                new Medicament()
                {
                    MedicamentId = 4, Name = "Diclofenaco"
                },
                new Medicament()
                {
                    MedicamentId = 5, Name = "Disflatyl"
                },
                new Medicament()
                {
                    MedicamentId = 6, Name = "Duvadilan"
                },
                new Medicament()
                {
                    MedicamentId = 7, Name = "Efedrin"
                },
                new Medicament()
                {
                    MedicamentId = 8, Name = "Flanax"
                },
                new Medicament()
                {
                    MedicamentId = 9, Name = "Fluimucil"
                },
                new Medicament()
                {
                    MedicamentId = 10, Name = "Navidoxine"
                },
                new Medicament()
                {
                    MedicamentId = 11, Name = "Nistatin"
                },
                new Medicament()
                {
                    MedicamentId = 12, Name = "Olfen"
                },
                new Medicament()
                {
                    MedicamentId = 13, Name = "Pentrexyl"
                },
                new Medicament()
                {
                    MedicamentId = 14, Name = "Primolut Nor"
                },
                new Medicament()
                {
                    MedicamentId = 15, Name = "Primperan"
                },
                new Medicament()
                {
                    MedicamentId = 16, Name = "Propoven"
                },
                new Medicament()
                {
                    MedicamentId = 17, Name = "Reglin"
                },
                new Medicament()
                {
                    MedicamentId = 18, Name = "Terramicina Oftalmica"
                },
                new Medicament()
                {
                    MedicamentId = 19, Name = "Ultran"
                },
                new Medicament()
                {
                    MedicamentId = 20, Name = "Viartril-S"
                },
            };

            //var medicamentNames = File.ReadAllLines("<INSERT DIR HERE>");
            return(medicamentNames);
        }
        private void InsertMedicament()
        {
            Medicament medicament;

            Console.WriteLine("Insert Medicament");

            Console.Write("Name -> ");
            string medicamentName = Console.ReadLine();

            Console.Write("Require Recipe ->");
            bool   requireRecipe = bool.Parse(Console.ReadLine());
            string recipeNumber  = string.Empty;

            if (requireRecipe)
            {
                Console.Write("Recipe Number");
                recipeNumber = Console.ReadLine();
            }
            Console.Write("Price ->");
            decimal price = decimal.Parse(Console.ReadLine());



            medicament = new Medicament
            {
                Name          = medicamentName,
                RequireRecipe = requireRecipe,
                RecipeNumber  = recipeNumber,
                Price         = price
            };
            this.context.Medicaments.Add(medicament);

            try
            {
                this.context.SaveChanges();
            }
            catch (DbUpdateException)
            {
                Console.WriteLine("Invalid Medicament");

                Console.Write("Do you want to add again Yes or No -> ");
                string s = Console.ReadLine();

                if (s == "Yes")
                {
                    InsertMedicament();
                }
                return;
            }

            Console.WriteLine("Medicament has Successfully Registered ");

            Console.Write("Do you want to register another Medicament ->");
            Console.WriteLine("Yes or No");
            string command = Console.ReadLine();

            if (command == "No")
            {
                return;
            }
            else if (command == "Yes")
            {
                InsertMedicament();
            }
        }
        public IActionResult AddNewMedicament(Medicament medicament)
        {
            var id = this.medicamentsService.Create(medicament);

            return(RedirectToAction("List"));
        }
Example #12
0
        public MedicamentViewModel()
        {
            DownloadMedicaments();

            EditMedicament = new DelegateCommand(() =>
            {
                editoradd = false;
                selectedMedicament?.BeginEdit();

                var w         = new MedicamentEdit();
                w.DataContext = this;
                w.ShowDialog();
            }, () => selectedMedicament != null);


            AddMedicament = new DelegateCommand(() =>
            {
                editoradd = true;

                Medicament medicament = new Medicament();
                SelectedMedicament    = medicament;

                var w         = new MedicamentEdit();
                w.DataContext = this;
                w.ShowDialog();
            });

            SaveMedicament = new DelegateCommand(() =>
            {
                if (editoradd == true)
                {
                    context.Medicament.Add(selectedMedicament);

                    context.SaveChanges();

                    Medicaments.Add(SelectedMedicament);
                }
                else
                {
                    context.Entry(SelectedMedicament).State = EntityState.Modified;
                    context.SaveChanges();
                }
            });

            RemoveMedicament = new DelegateCommand(() =>
            {
                if (MessageBox.Show("Удалить?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    context.Entry(selectedMedicament).State = EntityState.Deleted;
                    context.SaveChanges();
                    Medicaments.Remove(selectedMedicament);
                }
                else
                {
                    return;
                }
            }, () => selectedMedicament != null);

            CanselEdit = new DelegateCommand(() =>
            {
                if (editoradd == false)
                {
                    if (selectedMedicament == null)
                    {
                        return;
                    }
                    SelectedMedicament.CancelEdit();
                }
                else
                {
                    return;
                }
            });
        }
Example #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (numInPackage.Value == 0)
            {
                Notificator.ShowError("В упаковці не може бути 0 од.");
                return;
            }

            if (dozages.Where(t => t.Agent == null).Count() > 0)
            {
                Notificator.ShowError("Ви не вибрали діючу речовину");
                return;
            }

            using (DiabetContext dc = new DiabetContext())
            {
                if (currentMedicament == null)
                {
                    currentMedicament = new Medicament();
                }

                // Обнуляем навигационные свойства для избежания ошибок
                currentMedicament.FullName       = null;
                currentMedicament.MedicamentType = null;
                currentMedicament.AgentDozages.Clear();

                currentMedicament.MedicamentNameId = (int)medNameBox.SelectedValue;
                currentMedicament.MedicamentTypeId = (int)packageType.SelectedValue;
                currentMedicament.NumInPack        = (int)numInPackage.Value;
                currentMedicament.Price            = priceField.Value;

                if (currentMedicament.Id > 0)
                {
                    dc.Medicaments.Attach(currentMedicament);
                    dc.Entry <Medicament>(currentMedicament).State = EntityState.Modified;
                }
                else
                {
                    dc.Medicaments.Add(currentMedicament);
                }
                dc.SaveChanges();

                foreach (var item in dozages)
                {
                    item.DozageMeter  = null;
                    item.MedicamentId = currentMedicament.Id;
                    dc.MedicamentGroups.Attach(item.Agent);
                    if (item.Id > 0)
                    {
                        dc.AgentDozages.Attach(item);
                        dc.Entry <AgentDozage>(item).State = EntityState.Modified;
                    }
                    else
                    {
                        dc.AgentDozages.Add(item);
                    }
                    dc.SaveChanges();
                }

                // Эти изменения не попадут в БД, а нужны лишь для отображения изменения по медикаменту в интерфейсе
                currentMedicament.FullName       = medNameBox.SelectedItem as MedicamentName;
                currentMedicament.MedicamentType = packageType.SelectedItem as MedicamentType;

                idDataChanged = true;

                Notificator.ShowInfo("Дані успішно збережені!");
            }
        }
Example #14
0
        static void Main(string[] args)
        {
            Console.Write("Имя пользователя SQL Server: ");
            string sqlUser = Console.ReadLine();

            Console.Write("Пароль SQL Server: ");
            string sqlPassword = Console.ReadLine();

            Console.Write("Имя пользователя MongoDB: ");
            string mongoUser = Console.ReadLine();

            Console.Write("Пароль MongoDB: ");
            string mongoPassword = Console.ReadLine();

            try
            {
                MongoConnection mongoConnection = new MongoConnection("ds229008.mlab.com", "29008", mongoUser, mongoPassword);
                mongoConnection.Connect();

                SqlConnection sqlConnection = new SqlConnection("ELISEY", /*"1433",*/ sqlUser, sqlPassword);
                sqlConnection.Connect();

                Console.Clear();

                #region Заполнение БД
                Doctor doctor = new Doctor("Иванова", "Людмила", "Ивановна", sqlConnection);
                doctor.Save(sqlConnection);

                doctor.SignUp("doctor", "hello", "hello");
                doctor.SignIn("doctor", "hello", sqlConnection);

                Patient patient = new Patient("Карапузов", "Иван", "Андреевич");
                patient.Save(sqlConnection);

                Problem problem = new Problem("Не могу больше держаться", new DateTime(2018, 4, 17), patient, doctor, sqlConnection);
                problem.Save();
                Console.WriteLine(problem);

                Complaint complaint1 = new Complaint("Мне больно", problem, sqlConnection);
                complaint1.Save();

                Complaint complaint2 = new Complaint("Очень", problem, sqlConnection);
                complaint2.Save();

                Diagnosis diagnosis = new Diagnosis("Простуда", problem, doctor, sqlConnection);
                diagnosis.Save();
                Console.WriteLine(diagnosis);

                Archetype pulse = new Archetype("Пульс");
                pulse.Save(sqlConnection);

                Archetype pressure = new Archetype("Давление");
                pressure.Save(sqlConnection);

                Console.WriteLine(pressure);

                Symptom symptom1 = new Symptom(diagnosis, pulse, "60", sqlConnection);
                symptom1.Save();

                Symptom symptom2 = new Symptom(diagnosis, pressure, "120/80", sqlConnection);
                symptom2.Save();

                Console.WriteLine(symptom1);
                Console.WriteLine(symptom2);

                Medicament medicament = new Medicament("Мезим");
                medicament.Save(sqlConnection);

                Medicament medicament2 = new Medicament("Терафлю");
                medicament2.Save(sqlConnection);

                Medicament medicament3 = new Medicament("Нурофен");
                medicament3.Save(sqlConnection);

                Prescription prescription = new Prescription(medicament, diagnosis, sqlConnection);
                prescription.Save();

                Prescription prescription2 = new Prescription(medicament2, diagnosis, sqlConnection);
                prescription2.Save();

                Prescription prescription3 = new Prescription(medicament3, diagnosis, sqlConnection);
                prescription3.Save();

                Console.WriteLine(prescription3);

                Article article1 = new Article("Повышенная вязкость крови – один из факторов развития кардиоваскулярных осложнений у больных с истинной полицитемией",
                                               "https://research-journal.org/medical/povyshennaya-vyazkost-krovi-odin-iz-faktorov-razvitiya-kardiovaskulyarnyx-oslozhnenij-u-bolnyx-s-istinnoj-policitemiej/",
                                               "Разнообразие клинических проявлений и высокий процент развития осложнений, отличающихся по характеру и тяжести, у больных эритремией продолжает создавать трудности как в лечении, так и в повышении качества жизни больных [6, С. 32]. Изменение реологических свойств и повышение вязкости крови, по результатам наших исследований, оказывают большее влияние на сердечно-сосудистую систему с развитием целого ряда синдромов и симптомов – гипертоническая болезнь, ишемическая болезнь сердца, симптоматическая артериальная гипертензия в 53,4% случаев. Возрастной пик заболеваемости, приходящий на пациентов среднего и пожилого возраста, делает их более уязвимыми в отношении развития тромботических осложнений. В рамках нашего исследования истинной полицитемии более подвержены мужчины  от 40 до 70 лет.",
                                               mongoConnection);
                Article article2 = new Article("Центральная гемодинамика, тиреоидный статус и дисфункции эндотелия у больных артериальной гипертонией в условиях высокогорья",
                                               "https://research-journal.org/medical/centralnaya-gemodinamika-tireoidnyj-status-i-disfunkcii-endoteliya-u-bolnyx-arterialnoj-gipertoniej-v-usloviyax-vysokogorya/",
                                               "Установлено, что снижение продукции NO с одновременным снижением концентрации тиреоидных гормонов вызывают нарушения интракардиальной гемодинамики, изменения структурно-функционального состояния ЛЖ и утяжеляют течение артериальной гипертонии.",
                                               mongoConnection);
                Article article3 = new Article("Сочетанные изменения экспрессии генов cstb и acap3 при симптоматической эпилепсии и болезни паркинсона",
                                               "https://research-journal.org/medical/sochetannye-izmeneniya-ekspressii-genov-cstb-i-acap3-pri-simptomaticheskoj-epilepsii-i-bolezni-parkinsona/",
                                               "Кроме того, у женщин наблюдалось снижение уровня мРНК гена CSTB при эпилепсии(примерно в 3 раза) и при болезни Паркинсона(примерно в 2.5 раза).Полученные данные указывают на возможное участие исследованных генов в патогенезе симптоматической эпилепсии и болезни Паркинсона.",
                                               mongoConnection);
                Tag tag1 = new Tag("Карапузов", mongoConnection);
                Tag tag2 = new Tag("Эритремия", mongoConnection);
                Tag tag3 = new Tag("Гипертония", mongoConnection);
                Tag tag4 = new Tag("Карапузовдержись", mongoConnection);

                article1.Save();
                article2.Save();
                article3.Save();

                tag1.Save();
                tag2.Save();
                tag3.Save();
                tag4.Save();

                Association association1 = new Association("Ассоциация с наибольшим количеством тегов", mongoConnection, sqlConnection);
                association1.Tags.AddRange(new Tag[]
                {
                    tag1,
                    tag2,
                    tag3
                });
                association1.Article = article1;
                association1.MedicineObjects.AddRange(new IEhrObject[]
                {
                    patient,
                    problem,
                    medicament2,
                    medicament3
                });
                association1.Save();

                Association association2 = new Association("Ассоциация про Карапузова", mongoConnection, sqlConnection);
                association2.Tags.AddRange(new Tag[]
                {
                    tag1,
                    tag3
                });
                association2.Article = article2;
                association2.MedicineObjects.AddRange(new IEhrObject[]
                {
                    patient,
                    medicament
                });
                association2.Save();

                Association association3 = new Association("Ассоциация с наименьшим количеством тегов", mongoConnection, sqlConnection);
                association3.Tags.AddRange(new Tag[]
                {
                    tag1,
                    tag4
                });
                association3.Article = article3;
                association3.MedicineObjects.AddRange(new IEhrObject[]
                {
                    medicament,
                    medicament3
                });
                association3.Save();
                #endregion

                #region Поиск по тегам
                Tag findTag1 = new Tag();
                Tag findTag2 = new Tag();
                Tag findTag3 = new Tag();
                Tag findTag4 = new Tag();
                Tag findTag5 = new Tag();

                try
                {
                    Console.Write("Введите тег: ");
                    findTag1.GetByContent(Console.ReadLine(), mongoConnection); //"Карапузов"
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                try
                {
                    Console.Write("Введите тег: ");
                    findTag2.GetByContent(Console.ReadLine(), mongoConnection); //"Эритремия"
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                try
                {
                    Console.Write("Введите тег: ");
                    findTag3.GetByContent(Console.ReadLine(), mongoConnection); //"Гипертония"
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                try
                {
                    Console.Write("Введите тег: ");
                    findTag4.GetByContent(Console.ReadLine(), mongoConnection); //"Грипп"
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                Console.WriteLine();

                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                List <KeyValuePair <int, Association> > associations = Association.GetAssociationListByTag(new Tag[]
                {
                    findTag1,
                    findTag2,
                    findTag3,
                    findTag4
                }, sqlConnection, mongoConnection);
                stopwatch.Stop();

                foreach (KeyValuePair <int, Association> association in associations)
                {
                    Console.WriteLine(association.Value);
                    Console.WriteLine("Число совпадений: " + association.Key);
                    Console.WriteLine();
                }
                Console.WriteLine("Затрачено времени: " + stopwatch.Elapsed);
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
Example #15
0
        //Edit patient in system
        public void EditPatient(HospitalContext context)
        {
            var medicament = new Medicament();
            var diagnose   = new Diagnose();
            var visitation = new Visitation();

            Console.WriteLine("Please, write patient first name and last name you want to edit:");
            List <string> names = Console.ReadLine()
                                  .Split(" ")
                                  .ToList();

            string patientFirstname = names[0];
            string patientLastname  = names[1];

            var patientToEdit = context.Patients
                                .FirstOrDefault(p => p.FirstName == patientFirstname &&
                                                p.LastName == patientLastname && p.HasInsurance == true);

            if (context.Patients.Any(p => p == patientToEdit))
            {
                Console.WriteLine("What do you want to edit? To add visitation/medicament/diagnose write some of the following - " +
                                  "Add visitation/Add medicament/Add diagnose. To remove the same - Remove visitation/Remove medicament/" +
                                  "Remove diagnose.");

                string answer = Console.ReadLine();

                if (answer == "Add visitation")
                {
                    Console.WriteLine("Enter date for visitation:");
                    string visitationDate = Console.ReadLine();

                    visitation.Date = DateTime.Parse(visitationDate);

                    var currentDoctor = context.Doctor.FirstOrDefault(d => d.Name == docName && d.Specialty == docSpecialty &&
                                                                      d.Password == docPassword);

                    visitation.Doctor  = currentDoctor;
                    visitation.Patient = patientToEdit;

                    patientToEdit.Visitations.Add(visitation);
                    Console.WriteLine("Visitation added!");


                    context.SaveChanges();
                }

                else if (answer == "Add medicament")
                {
                    Console.WriteLine("Write medicament name:");
                    string medicamentName = Console.ReadLine();

                    medicament.Name = medicamentName;

                    var patientMedicaments = new PatientMedicament()
                    {
                        Patient    = patientToEdit,
                        Medicament = medicament
                    };

                    patientToEdit.Prescriptions.Add(patientMedicaments);
                    Console.WriteLine("Medicament added!");

                    context.SaveChanges();
                }

                else if (answer == "Add diagnose")
                {
                    Console.WriteLine("Write diagnose name:");
                    string diagnoseName = Console.ReadLine();

                    diagnose.Name    = diagnoseName;
                    diagnose.Patient = patientToEdit;

                    patientToEdit.Diagnoses.Add(diagnose);
                    Console.WriteLine("Diagnose added!");

                    context.SaveChanges();
                }

                else if (answer == "Remove visitation")
                {
                    Console.WriteLine("Write visitation date:");
                    string visitationDate = Console.ReadLine();
                    var    date           = DateTime.Parse(visitationDate);

                    var currentDoctor = context.Doctor
                                        .FirstOrDefault(d => d.Name == docName &&
                                                        d.Specialty == docSpecialty &&
                                                        d.Password == docPassword);

                    var visitationToRemove = context.Visitations
                                             .FirstOrDefault(v => v.Doctor == currentDoctor &&
                                                             v.Patient == patientToEdit);

                    if (patientToEdit.Visitations.Any(v => v == visitationToRemove))
                    {
                        patientToEdit.Visitations.Remove(visitationToRemove);
                        Console.WriteLine("Visitation deleted!");

                        context.SaveChanges();
                    }

                    else
                    {
                        throw new ArgumentException("No such visitation!");
                    }
                }

                else if (answer == "Remove medicament")
                {
                    Console.WriteLine("Write medicament name:");
                    string medicamentName = Console.ReadLine();

                    medicament.Name = medicamentName;

                    var patients = context.PatientMedicaments
                                   .Where(p => p.Patient.PatientId == patientToEdit.PatientId).ToList();

                    var medicaments = context.PatientMedicaments
                                      .Where(m => m.Medicament.MedicamentId == medicament.MedicamentId).ToList();

                    foreach (var patient in patients)
                    {
                        if (context.PatientMedicaments
                            .Any(p => p.Patient.PatientId == patient.PatientId))
                        {
                            context.PatientMedicaments.Remove(patient);

                            context.SaveChanges();
                        }

                        else
                        {
                            throw new ArgumentException("No such patient!");
                        }
                    }

                    foreach (var med in medicaments)
                    {
                        if (context.PatientMedicaments
                            .Any(m => m.MedicamentId == med.MedicamentId))
                        {
                            context.PatientMedicaments.Remove(med);

                            context.SaveChanges();
                        }

                        else
                        {
                            throw new ArgumentException("No such medicament!");
                        }
                    }

                    var medicamentToRemove = context.Medicaments
                                             .Where(m => m.Name == medicament.Name)
                                             .FirstOrDefault();

                    if (context.Medicaments
                        .Any(m => m.MedicamentId == medicamentToRemove.MedicamentId))
                    {
                        context.Medicaments.Remove(medicamentToRemove);
                        context.SaveChanges();

                        Console.WriteLine("Medicament removed!");
                    }

                    else
                    {
                        throw new ArgumentException("No such medicament!");
                    }
                }

                else if (answer == "Remove diagnose")
                {
                    Console.WriteLine("Write diagnose name:");
                    string diagnoseName = Console.ReadLine();

                    var diagnoseToEdit = context.Diagnoses
                                         .FirstOrDefault(d => d.Name == diagnoseName);

                    if (context.Diagnoses.Any(d => d == diagnoseToEdit))
                    {
                        patientToEdit.Diagnoses.Remove(diagnoseToEdit);
                        Console.WriteLine("Diagnose removed!");

                        context.SaveChanges();
                    }
                    else
                    {
                        throw new ArgumentException("No such diagnose!");
                    }
                }
            }

            else
            {
                throw new ArgumentException("There is no such patient in the system!");
            }
        }
Example #16
0
        private static void AddSampleData()
        {
            Doctor doctorOne = new Doctor()
            {
                Name = "Gosho", Speciality = "GP"
            };
            Doctor doctorTwo = new Doctor()
            {
                Name = "Pesho", Speciality = "GP"
            };
            Doctor doctorThree = new Doctor()
            {
                Name = "Ivan", Speciality = "GP"
            };

            Visitation visitationOne = new Visitation()
            {
                Date = DateTime.Now, Comments = "Blabla1"
            };
            Visitation visitationTwo = new Visitation()
            {
                Date = DateTime.Now, Comments = "Blabla2"
            };
            Visitation visitationThree = new Visitation()
            {
                Date = DateTime.Now, Comments = "Blabla3"
            };

            Diagnose diagnoseOne = new Diagnose()
            {
                Name = "SomeDiagnose1", Comments = "You're a wizard harry!"
            };
            Diagnose diagnoseTwo = new Diagnose()
            {
                Name = "SomeDiagnose2", Comments = "You're not a wizard Ivan!"
            };

            Medicament medOne = new Medicament()
            {
                Name = "Vitamin C"
            };
            Medicament medTwo = new Medicament()
            {
                Name = "Vitamin B"
            };

            Patient patiantOne = new Patient()
            {
                FirstName   = "Vankata",
                LastName    = "Vankov",
                Address     = "Kichuka",
                Email       = "*****@*****.**",
                DateOfBirth = new DateTime(2000, 10, 25),
                IsInsured   = true
            };

            Patient patiantTwo = new Patient()
            {
                FirstName   = "Bankata",
                LastName    = "Bankov",
                Address     = "Bichuka",
                Email       = "*****@*****.**",
                DateOfBirth = new DateTime(2001, 11, 26),
                IsInsured   = true
            };

            visitationOne.Doctor   = doctorOne;
            visitationTwo.Doctor   = doctorTwo;
            visitationThree.Doctor = doctorOne;

            patiantOne.Visitations.Add(visitationOne);
            patiantTwo.Visitations.Add(visitationTwo);
            patiantTwo.Visitations.Add(visitationThree);

            patiantOne.Diagnoses.Add(diagnoseOne);
            patiantTwo.Diagnoses.Add(diagnoseTwo);

            patiantOne.Medicaments.Add(medOne);
            patiantTwo.Medicaments.Add(medTwo);

            var context = new HospitalDBContext();

            context.Visitations.Add(visitationOne);
            context.Visitations.Add(visitationTwo);
            context.Visitations.Add(visitationThree);

            context.Patients.Add(patiantOne);
            context.Patients.Add(patiantTwo);

            context.Diagnoses.Add(diagnoseOne);
            context.Diagnoses.Add(diagnoseTwo);

            context.Medicaments.Add(medOne);
            context.Medicaments.Add(medTwo);

            context.SaveChanges();
        }
 public async Task <int> Add(Medicament medicament)
 {
     return(await _medicamentRepository.AddAsync(medicament));
 }
Example #18
0
        public static async Task Initialize(UserManager <User> userManager, ApiContext context, RoleManager <IdentityRole> roleManager)
        {
            string adminEmail = "*****@*****.**";
            string password   = "******";

            if (await userManager.FindByNameAsync(adminEmail) == null)
            {
                await roleManager.CreateAsync(new IdentityRole("admin"));

                await roleManager.CreateAsync(new IdentityRole("author"));

                await roleManager.CreateAsync(new IdentityRole("moderator"));

                User admin = new Administrator {
                    Email = adminEmail, UserName = adminEmail
                };
                await userManager.CreateAsync(admin, password);

                await userManager.AddToRoleAsync(admin, "admin");

                User author = new Author {
                    Email = "*****@*****.**", UserName = "******"
                };
                await userManager.CreateAsync(author, password);

                await userManager.AddToRoleAsync(author, "author");

                Moderator moderator = new Moderator {
                    Email = "*****@*****.**", UserName = "******"
                };
                await userManager.CreateAsync(moderator, password);

                await userManager.AddToRoleAsync(moderator, "moderator");

                Lang ENG = new Lang {
                    Name = "English"
                };
                Lang RUS = new Lang {
                    Name = "Русский"
                };
                Lang TKM = new Lang {
                    Name = "Türkmençe"
                };
                await context.Langs.AddRangeAsync(ENG, RUS, TKM);

                Category Analgesics = new Category {
                    Status = true
                };
                Category Anesthetics = new Category {
                    Status = true
                };
                await context.Categories.AddRangeAsync(Analgesics, Anesthetics);

                CategoryLangLink AnalgesicENG = new CategoryLangLink {
                    Category = Analgesics, Lang = ENG, Name = "Analgesics", Description = @"A group of medications that are used to relieve pain associated with inflammation or damage to tissues and organs.
Unlike anesthetics, analgesics act selectively. They relieve or eliminate pain without reducing the sensitivity of a specific area of the body."
                };
                CategoryLangLink AnalgesicRUS = new CategoryLangLink {
                    Category = Analgesics, Lang = RUS, Name = "Анальгетики", Description = @"Группа медицинских препаратов, которые применяются для облегчения болевого синдрома, связанного с воспалением или повреждением тканей и органов.
В отличие от анестетиков, анальгезирующее средства действуют избирательно. Они ослабляют или устраняют боль, не снижая чувствительность определенной области тела."
                };
                CategoryLangLink AnalgesicTKM = new CategoryLangLink {
                    Category = Analgesics, Lang = TKM, Name = "Analgetikler", Description = @"Analgetikler barada Türkmençe."
                };

                CategoryLangLink AnestheticENG = new CategoryLangLink {
                    Category = Anesthetics, Lang = ENG, Name = "Anesthetics", Description = "Drugs with the ability to cause anesthesia."
                };
                CategoryLangLink AnestheticRUS = new CategoryLangLink {
                    Category = Anesthetics, Lang = RUS, Name = "Анестетики", Description = "Лекарственные средства, обладающие способностью вызывать анестезию."
                };
                CategoryLangLink AnestheticTKM = new CategoryLangLink {
                    Category = Anesthetics, Lang = TKM, Name = "Anesthetics", Description = "Anestetikler barada Türkmençe."
                };
                await context.CategoryLangLinks.AddRangeAsync(AnalgesicENG, AnalgesicRUS, AnalgesicTKM, AnestheticENG, AnestheticRUS, AnestheticTKM);

                Country Russia = new Country();
                await context.Countries.AddAsync(Russia);

                CountryLangLink RussiaENG = new CountryLangLink {
                    Capital = "Moscow", Country = Russia, Name = "Russia", Lang = ENG
                };
                CountryLangLink RussiaRUS = new CountryLangLink {
                    Capital = "Москва", Country = Russia, Name = "Россия", Lang = RUS
                };
                CountryLangLink RussiaTKM = new CountryLangLink {
                    Capital = "Moskwa", Country = Russia, Name = "Russiýa", Lang = TKM
                };
                await context.CountryLangLinks.AddRangeAsync(RussiaENG, RussiaRUS, RussiaTKM);

                Manufacturer Werofarm = new Manufacturer {
                    Country = Russia, Name = "Верофарм"
                };
                await context.Manufacturers.AddAsync(Werofarm);

                Medicament Amigrenin = new Medicament {
                    Category = Analgesics, Manufacturer = Werofarm
                };
                await context.Medicaments.AddAsync(Amigrenin);

                MedicamentLangLink AmigreninENG = new MedicamentLangLink {
                    Medicament = Amigrenin, Lang = ENG, Description = "Code ATC: N02CC01", MedicamentName = "Amigrenin"
                };
                MedicamentLangLink AmigreninRUS = new MedicamentLangLink {
                    Medicament = Amigrenin, Lang = RUS, Description = "Код ATX: N02CC01", MedicamentName = "АМИГРЕНИН"
                };
                MedicamentLangLink AmigreninTKM = new MedicamentLangLink {
                    Medicament = Amigrenin, Lang = TKM, Description = "ATH Kod: N02CC01", MedicamentName = "Amigrenin"
                };
                await context.MedicamentLangLinks.AddRangeAsync(AmigreninENG, AmigreninRUS, AmigreninTKM);

                Medicament Analgin = new Medicament {
                    Category = Analgesics, Manufacturer = Werofarm
                };
                await context.Medicaments.AddAsync(Analgin);

                MedicamentLangLink AnalginENG = new MedicamentLangLink {
                    Medicament = Analgin, Lang = ENG, Description = "Code ATC: N02BB02", MedicamentName = "Analgin"
                };
                MedicamentLangLink AnalginRUS = new MedicamentLangLink {
                    Medicament = Analgin, Lang = RUS, Description = "Код ATX: N02BB02", MedicamentName = "Анальгин"
                };
                MedicamentLangLink AnalginTKM = new MedicamentLangLink {
                    Medicament = Analgin, Lang = TKM, Description = "ATH Kod: N02BB02", MedicamentName = "Analgin"
                };
                await context.MedicamentLangLinks.AddRangeAsync(AnalginENG, AnalginRUS, AnalginTKM);

                Medicament Novocaine = new Medicament {
                    Category = Anesthetics, Manufacturer = Werofarm
                };
                await context.Medicaments.AddAsync(Novocaine);

                MedicamentLangLink NovocaineENG = new MedicamentLangLink {
                    Medicament = Novocaine, Lang = ENG, Description = "Transparent, colorless or slightly colored liquid", MedicamentName = "Novocaine"
                };
                MedicamentLangLink NovocaineRUS = new MedicamentLangLink {
                    Medicament = Novocaine, Lang = RUS, Description = "Прозрачная бесцветная или слегка окрашенная жидкость", MedicamentName = "Новокаин"
                };
                MedicamentLangLink NovocaineTKM = new MedicamentLangLink {
                    Medicament = Novocaine, Lang = TKM, Description = "Reňksiz ýa-da birneme reňkli suwuklyk", MedicamentName = "Nowokain"
                };
                await context.MedicamentLangLinks.AddRangeAsync(NovocaineENG, NovocaineRUS, NovocaineTKM);

                await context.SaveChangesAsync();
            }
        }
Example #19
0
        protected override void Seed(DiabetContext context)
        {
            using (DiabetContext dc = new DiabetContext())
            {
                dc.Settings.Add(new ProgramSettings
                {
                    DoctorLastName   = "Падафа",
                    DoctorFirstName  = "Валерія",
                    DoctorMiddleName = "Едуардівна",
                    DoctorPosition   = "Лікар-ендокринолог",
                    HospitalFullName = "Комунальний заклад \"Запорізька центральна районна лікарня\" Запорізької районної ради",
                    HospitalAdress   = "69089, Запорізька область, місто Запоріжжя, вулиця Лікарняна, будинок 18"
                });
                dc.SaveChanges();

                dc.Communes.Add(new Commune {
                    Name = "Біленьківська"
                });
                dc.Communes.Add(new Commune {
                    Name = "Долинська"
                });
                dc.Communes.Add(new Commune {
                    Name = "Запорізький район"
                });
                dc.SaveChanges();

                MedicamentType mt1 = new MedicamentType {
                    Name = "Таблетки"
                };
                MedicamentType mt2 = new MedicamentType {
                    Name = "Шприц-ручка"
                };
                dc.MedicamentTypes.Add(mt1);
                dc.MedicamentTypes.Add(mt2);
                dc.MedicamentTypes.Add(new MedicamentType {
                    Name = "Ампула"
                });
                dc.SaveChanges();

                Meter mmol = new Meter {
                    MType = MeterType.Analize, Name = "ммоль/л"
                };
                Meter met1 = new Meter {
                    MType = MeterType.MedicamentDozage, Name = "мг"
                };
                Meter met2 = new Meter {
                    MType = MeterType.MedicamentDozage, Name = "мл"
                };
                dc.Meters.Add(met1);
                dc.Meters.Add(met2);
                dc.Meters.Add(mmol);
                dc.SaveChanges();

                dc.Analyze.Add(new Analyze {
                    Name = "Рівень глюкози в крові", AnalizeMeter = mmol
                });
                dc.SaveChanges();

                MedicamentAgent ma1 = new MedicamentAgent {
                    Name = "Метформін гідрохлорид"
                };
                MedicamentAgent ma2 = new MedicamentAgent {
                    Name = "Глімепірид"
                };
                MedicamentAgent ma3 = new MedicamentAgent {
                    Name = "Гліклазид"
                };
                MedicamentAgent ma4 = new MedicamentAgent {
                    Name = "Гліпізид"
                };
                MedicamentAgent ma5 = new MedicamentAgent {
                    Name = "Глюкагон"
                };
                dc.MedicamentGroups.Add(ma1);
                dc.MedicamentGroups.Add(ma2);
                dc.MedicamentGroups.Add(ma3);
                dc.MedicamentGroups.Add(ma4);
                dc.SaveChanges();

                MedicamentName mn1 = new MedicamentName {
                    Name = "Глюкофаж"
                };
                MedicamentName mn2 = new MedicamentName {
                    Name = "Діабетон МR"
                };
                MedicamentName mn3 = new MedicamentName {
                    Name = "Діаглізид МR"
                };
                MedicamentName mn4 = new MedicamentName {
                    Name = "Діапірид"
                };
                MedicamentName mn5 = new MedicamentName {
                    Name = "Метамін SR"
                };
                MedicamentName mn6 = new MedicamentName {
                    Name = "Метамін"
                };
                MedicamentName mn7 = new MedicamentName {
                    Name = "Дуглимакс"
                };
                MedicamentName mn8 = new MedicamentName {
                    Name = "Діаформін SR"
                };
                MedicamentName mn9 = new MedicamentName {
                    Name = "Дибізид М"
                };
                MedicamentName mn10 = new MedicamentName {
                    Name = "Амарил МСР"
                };
                MedicamentName mn11 = new MedicamentName {
                    Name = "ГЛЮКАГЕН ГІПОКІТ"
                };
                dc.MedicamentNames.Add(mn1);
                dc.MedicamentNames.Add(mn2);
                dc.MedicamentNames.Add(mn3);
                dc.MedicamentNames.Add(mn4);
                dc.MedicamentNames.Add(mn5);
                dc.MedicamentNames.Add(mn6);
                dc.MedicamentNames.Add(mn7);
                dc.MedicamentNames.Add(mn8);
                dc.MedicamentNames.Add(mn9);
                dc.MedicamentNames.Add(mn10);
                dc.MedicamentNames.Add(mn11);
                dc.SaveChanges();

                // Глюкофаж
                Medicament m1 = new Medicament
                {
                    FullName       = mn1,
                    NumInPack      = 60,
                    MedicamentType = mt1
                };
                m1.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, DozageMeter = met1, Dozage = 500
                });
                Medicament m2 = new Medicament
                {
                    FullName       = mn1,
                    NumInPack      = 60,
                    MedicamentType = mt1
                };
                m2.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, DozageMeter = met1, Dozage = 850
                });
                Medicament m3 = new Medicament
                {
                    FullName       = mn1,
                    NumInPack      = 60,
                    MedicamentType = mt1
                };
                m3.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, DozageMeter = met1, Dozage = 1000
                });

                // Дибетон
                Medicament m4 = new Medicament
                {
                    FullName       = mn2,
                    NumInPack      = 30,
                    MedicamentType = mt1
                };
                m4.AgentDozages.Add(new AgentDozage {
                    Agent = ma3, DozageMeter = met1, Dozage = 60
                });

                // Діаглізид МR
                Medicament m5 = new Medicament
                {
                    FullName       = mn3,
                    NumInPack      = 30,
                    MedicamentType = mt1
                };
                m5.AgentDozages.Add(new AgentDozage {
                    Agent = ma3, Dozage = 60, DozageMeter = met1
                });

                // Діапірид
                Medicament m6 = new Medicament
                {
                    FullName       = mn4,
                    NumInPack      = 30,
                    MedicamentType = mt1
                };
                m6.AgentDozages.Add(new AgentDozage {
                    Agent = ma2, DozageMeter = met1, Dozage = 4
                });

                // Метамін SR
                Medicament m7 = new Medicament
                {
                    FullName       = mn5,
                    NumInPack      = 30,
                    MedicamentType = mt1
                };
                m7.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, DozageMeter = met1, Dozage = 1000
                });

                // Метамін
                Medicament m8 = new Medicament
                {
                    FullName       = mn6,
                    NumInPack      = 90,
                    MedicamentType = mt1
                };
                m8.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, DozageMeter = met1, Dozage = 1000
                });

                // Дуглимакс
                Medicament m9 = new Medicament
                {
                    FullName       = mn7,
                    NumInPack      = 30,
                    MedicamentType = mt1
                };
                m9.AgentDozages.Add(new AgentDozage {
                    Agent = ma2, Dozage = 2, DozageMeter = met1
                });
                m9.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, Dozage = 500, DozageMeter = met1
                });

                // Діаформін SR
                Medicament m10 = new Medicament
                {
                    FullName       = mn6,
                    NumInPack      = 60,
                    MedicamentType = mt1
                };
                m10.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, DozageMeter = met1, Dozage = 1000
                });

                // Дибізид М
                Medicament m11 = new Medicament
                {
                    FullName       = mn9,
                    NumInPack      = 60,
                    MedicamentType = mt1
                };
                m11.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, Dozage = 500, DozageMeter = met1
                });
                m11.AgentDozages.Add(new AgentDozage {
                    Agent = ma4, Dozage = 5, DozageMeter = met1
                });

                // Амарил МСР
                Medicament m12 = new Medicament
                {
                    FullName       = mn9,
                    NumInPack      = 30,
                    MedicamentType = mt1
                };
                m12.AgentDozages.Add(new AgentDozage {
                    Agent = ma2, Dozage = 2, DozageMeter = met1
                });
                m12.AgentDozages.Add(new AgentDozage {
                    Agent = ma1, Dozage = 500, DozageMeter = met1
                });

                // ГЛЮКАГЕН ГІПОКІТ
                Medicament m13 = new Medicament
                {
                    FullName       = mn11,
                    NumInPack      = 60,
                    MedicamentType = mt2
                };
                m13.AgentDozages.Add(new AgentDozage {
                    Agent = ma5, Dozage = 1, DozageMeter = met2
                });

                dc.Medicaments.Add(m1);
                dc.Medicaments.Add(m2);
                dc.Medicaments.Add(m3);
                dc.Medicaments.Add(m4);
                dc.Medicaments.Add(m5);
                dc.Medicaments.Add(m6);
                dc.Medicaments.Add(m7);
                dc.Medicaments.Add(m8);
                dc.Medicaments.Add(m9);
                dc.Medicaments.Add(m10);
                dc.Medicaments.Add(m11);
                dc.Medicaments.Add(m12);
                dc.Medicaments.Add(m13);
                dc.SaveChanges();
            }
        }
Example #20
0
        public override void GetById(ObjectId id)
        {
            Collection = Connection.GetCollection(collectionName);
            var filter = Builders <BsonDocument> .Filter.Eq("_id", id);

            var document = Collection.Find(filter).First();

            _id = id;

            Description = document.GetValue("Description").AsString;

            Doctor = new Doctor();
            Doctor.GetById(document.GetValue("Doctor").AsInt32, sqlConnection);

            Article = new Article();
            Article.GetById(document.GetValue("Article").AsBsonDocument.GetValue("$id").AsObjectId, Connection);

            foreach (BsonDocument doc in document.GetValue("Tags").AsBsonArray)
            {
                Tag tag = new Tag();
                tag.GetById(doc.GetValue("$id").AsObjectId, Connection);
                Tags.Add(tag);
            }

            foreach (BsonDocument doc in document.GetValue("MedicineObjects").AsBsonArray)
            {
                switch (doc.GetValue("Table").AsString)
                {
                case "Complaint":
                    Complaint complaint = new Complaint();
                    complaint.GetById(doc.GetValue("Id").AsInt32, sqlConnection);
                    MedicineObjects.Add(complaint);
                    break;

                case "Diagnosis":
                    Diagnosis diagnosis = new Diagnosis();
                    diagnosis.GetById(doc.GetValue("Id").AsInt32, sqlConnection);
                    MedicineObjects.Add(diagnosis);
                    break;

                case "Doctor":
                    Doctor doctor = new Doctor();
                    doctor.GetById(doc.GetValue("Id").AsInt32, sqlConnection);
                    MedicineObjects.Add(doctor);
                    break;

                case "Medicament":
                    Medicament medicament = new Medicament();
                    medicament.GetById(doc.GetValue("Id").AsInt32, sqlConnection);
                    MedicineObjects.Add(medicament);
                    break;

                case "Patient":
                    Patient patient = new Patient();
                    patient.GetById(doc.GetValue("Id").AsInt32, sqlConnection);
                    MedicineObjects.Add(patient);
                    break;

                case "Problem":
                    Problem problem = new Problem();
                    problem.GetById(doc.GetValue("Id").AsInt32, sqlConnection);
                    MedicineObjects.Add(problem);
                    break;

                case "Symptom":
                    Symptom symptom = new Symptom();
                    symptom.GetById(doc.GetValue("Id").AsInt32, sqlConnection);
                    MedicineObjects.Add(symptom);
                    break;
                }
            }

            foreach (BsonDocument doc in document.GetValue("Changes").AsBsonArray)
            {
                Change change = new Change()
                {
                    ChangeTime = doc.GetValue("ChangeTime").ToUniversalTime(),
                    Content    = doc.GetValue("Content").AsString
                };
                Changes.Add(change);
            }
        }
Example #21
0
 public void AddNew(Medicament medicament)
 {
     db.Medicament.Add(medicament);
     db.SaveChanges();
 }
Example #22
0
        public IActionResult index()
        {
            var context = new DefaultDbContext();
            var doctor1 = new Doctor
            {
                FirstName = "Jarek",
                LastName  = "Dokczyński",
                Email     = "*****@*****.**"
            };
            var doctor2 = new Doctor
            {
                FirstName = "Darek",
                LastName  = "Leczynski",
                Email     = "*****@*****.**"
            };
            var doctor3 = new Doctor
            {
                FirstName = "Marek",
                LastName  = "Dietczynski",
                Email     = "*****@*****.**"
            };

            var pacjet1 = new Patient
            {
                FirstName = "Pan",
                LastName  = "Kotek",
            };

            var pacjet2 = new Patient
            {
                FirstName = "Byl",
                LastName  = "Chorym",
            };

            var pacjet3 = new Patient
            {
                FirstName = "Lezal",
                LastName  = "Lozeczku",
            };

            var med1 = new Medicament
            {
                Name        = "Vicodin",
                Type        = "Painkiller",
                Description = "Silny lek przeciwbólowy"
            };

            var med2 = new Medicament
            {
                Name        = "Rutinoscorbin",
                Type        = "Suplement",
                Description = "Suplement wspomagający"
            };

            var med3 = new Medicament
            {
                Name        = "Penicylina",
                Type        = "Antibiotic",
                Description = "Popularny antybiotyk"
            };

            var pres1 = new Prescription
            {
                Patient = pacjet1,
                Doctor  = doctor1,
                DueDate = DateTime.Parse("2020-11-01"),
                Date    = DateTime.Now
            };

            var pres2 = new Prescription
            {
                Patient = pacjet2,
                Doctor  = doctor2,
                DueDate = DateTime.Parse("2020-11-01"),
                Date    = DateTime.Now
            };

            var pres1med1 = new Prescription_Medicament
            {
                Medicament   = med1,
                Prescription = pres1,
                Dose         = 100,
            };

            var pres2med1 = new Prescription_Medicament
            {
                Medicament   = med1,
                Prescription = pres2,
                Dose         = 200
            };

            var pres2med2 = new Prescription_Medicament
            {
                Medicament   = med2,
                Prescription = pres2
            };

            context.Add(doctor1);
            context.Add(doctor2);
            context.Add(doctor3);
            context.Add(pacjet1);
            context.Add(pacjet2);
            context.Add(pacjet3);
            context.Add(med1);
            context.Add(med2);
            context.Add(med3);
            context.Add(pres1);
            context.Add(pres2);
            context.Add(pres1med1);
            context.Add(pres2med1);
            context.Add(pres2med2);

            context.SaveChanges();

            return(Ok("Seeded"));
        }
Example #23
0
        // GET: Medicament/Edit/5
        public ActionResult Edit(int id)
        {
            Medicament m = db.Medicament.Find(id);

            return(View(m));
        }
 // à la BD avec la méthode AjoutEleve de la DAL
 public static int CreerMedicament(Medicament mdc)
 {
     return(MedicamentDAO.AjoutMedicament(mdc));
 }
 public IEnumerable <VenteMedi> GetVenteMediByMedicament(Medicament m)
 {
     return(context.VenteMedis.Where(e => e.CodeMedicament == m.CodeMedicament));
 }
 public static int ModifierMedicament(Medicament mdc)
 {
     return(MedicamentDAO.UpdateMedicament(mdc));
 }
Example #27
0
 public void Create(Medicament medicament)
 {
     db.Medicaments.Add(medicament);
 }
 public static int ArchiveMedicament(Medicament unMedicament)
 {
     return(MedicamentDAO.ArchiverMedicament(unMedicament));
 }
        public static void Main()
        {
            try
            {
                var context = new HospitalContext();

                using (context)
                {
                    //context.Database.Initialize(true);

                    Patient patient = new Patient
                    {
                        FirstName   = "Marrika",
                        LastName    = "Obstova",
                        Adress      = "Luvov most No.1",
                        Email       = "*****@*****.**",
                        DateOfBirth = new DateTime(1990, 05, 07)
                    };

                    Doctor doctor = new Doctor
                    {
                        Name      = "Doctor Frankenstein",
                        Specialty = "Mad scientist"
                    };

                    Visitation visitation = new Visitation
                    {
                        Doctor   = doctor,
                        Comments = "Mnoo zle",
                        Patient  = patient,
                        Date     = DateTime.Now
                    };

                    patient.Visitations.Add(visitation);
                    doctor.Visitations.Add(visitation);

                    Diagnose diagnose = new Diagnose
                    {
                        Name     = "HIV",
                        Comments = "Ot mangalite na luvov most",
                        Patient  = patient
                    };

                    patient.Diagnoses.Add(diagnose);

                    Medicament medicament = new Medicament
                    {
                        Name    = "Paracetamol",
                        Patient = patient
                    };

                    patient.Medicaments.Add(medicament);

                    context.Patients.Add(patient);
                    context.Doctors.Add(doctor);
                    context.Diagnoses.Add(diagnose);
                    context.Visitations.Add(visitation);
                    context.Medicaments.Add(medicament);
                    context.SaveChanges();
                }
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult dbEntityValidationResult in ex.EntityValidationErrors)
                {
                    foreach (DbValidationError dbValidationError in dbEntityValidationResult.ValidationErrors)
                    {
                        Console.WriteLine(dbValidationError.ErrorMessage);
                    }
                }
            }
        }
 public IActionResult Delete(Medicament medicament)
 {
     medicamentData.Delete(medicament.Id);
     return(RedirectToAction("Index"));
 }