public MedicationAllergie AddAllergie(MedicationAllergie medallerg)
        {
            MedicationAllergie alg = _allergies.FindAll().OrderBy(p => p.MedicationAllergiesid).Last();

            medallerg._id = ObjectId.GenerateNewId().ToString();
            Int32 medallgid = alg.MedicationAllergiesid + 1;

            medallerg.MedicationAllergiesid = medallgid;
            if (medallerg.EncounterType == "P")
            {
                medallerg.EncounterType = "I,A";
            }
            _allergies.Insert(medallerg);
            return(medallerg);
        }
Beispiel #2
0
        public MedicationAllergie UpdatePatient(MedicationAllergie medallerg)
        {
            var session = HttpContext.Current.Session;

            if (session["UserId"] != null)
            {
                userId = session["UserId"].ToString();
            }
            MedicationAllergie alg = _Allergies.UpdatePatient(medallerg);
            EncounterReport    erp = new EncounterReport();

            erp.RefId     = alg._id;
            erp.PatientId = alg.UserId;
            erp.UpdateBy  = userId;
            erp.Action    = "update MedicationAllergie";
            var encreports = encrepo.AddEncReport(erp);

            return(alg);
        }
        public MedicationAllergie UpdatePatient(MedicationAllergie medalg)
        {
            var algexist = GetByUserId(medalg.UserId);

            if (medalg.EncounterType == "P")
            {
                if (medalg.UserId != "a8a56c1d-203c-4c53-9d95-972dec7a2ef5" || medalg.UserId == "b6c625f5-653a-429f-b134-5b4d128ce4e8" || medalg.UserId == "a24e6d62-414d-4434-bbe3-b3eec3a026e7")
                {
                    medalg.EncounterType = "I,A";
                }
            }
            MedicationAllergie algs = algexist.Where(p => p._id == medalg._id).First();

            algs.Allergen   = medalg.Allergen;
            algs.Reaction   = medalg.Reaction;
            algs.Status     = medalg.Status;
            algs.RxNormCode = medalg.RxNormCode;

            _allergies.Save(algs);

            return(algs);
        }