Ejemplo n.º 1
0
 public string PediatricEvaluationPartial(mp_pediatric_evaluation evaluation, IFormCollection collection)
 {
     try
     {
         var symptoms = collection["symptoms"];
         //save the eval
         var user_id = _userManager.GetUserId(HttpContext.User);
         evaluation.created_by   = user_id;
         evaluation.created_date = DateTime.Now;
         int id = _evaluationService.AddPediatricEvaluation(evaluation);
         //save the history
         _evaluationService.AddPedEvaluationHistory(new mp_ped_evaluation_history
         {
             ped_eval_id    = id,
             profile_id     = Guid.Parse(collection["profile_id"]),
             appointment_id = Guid.Parse(collection["appointment_id"])
         });
         //save the symptoms
         List <mp_ped_symptomps> ped_Symptomps = new List <mp_ped_symptomps>();
         foreach (var s in symptoms)
         {
             ped_Symptomps.Add(new mp_ped_symptomps
             {
                 symptom_id        = int.Parse(s),
                 ped_evaluation_id = id
             });
         }
         _evaluationService.AddSymptoms(ped_Symptomps);
         return("success");
     }
     catch (Exception e)
     {
         return("error");
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostPediatricEvaluation(mp_pediatric_evaluation note)
        {
            var old = _evaluationService.GetPediatricEvaluation().FirstOrDefault(e => e.appointment_id == note.appointment_id);

            var email = _userManager.GetUserId(HttpContext.User);
            var user  = await _userManager.FindByEmailAsync(email);

            _evaluationService.AddPediatricEvaluation(note);

            return(Ok(200));
        }
Ejemplo n.º 3
0
        public IActionResult GetPediatricEvaluation(Guid appointment_id)
        {
            mp_pediatric_evaluation evaluation = _evaluationService.GetPediatricEvaluation().FirstOrDefault(e => e.appointment_id == appointment_id);

            if (evaluation == null)
            {
                evaluation = new mp_pediatric_evaluation();
            }

            return(Ok(evaluation));
        }
Ejemplo n.º 4
0
        public IActionResult PediatricEvaluationPartial(Guid profile_id, Guid appointment_id)
        {
            ViewBag.appointment_id = appointment_id;
            ViewBag.profile_id     = profile_id;

            mp_pediatric_evaluation evaluation = _evaluationService.GetPediatricEvaluation().Include(e => e.mp_ped_evaluation_history).Include(e => e.mp_ped_symptomps).FirstOrDefault(e => e.profile_id == profile_id && e.appointment_id == appointment_id);

            if (evaluation == null)
            {
                evaluation = new mp_pediatric_evaluation();
            }

            return(PartialView(evaluation));
        }
Ejemplo n.º 5
0
        public int AddPediatricEvaluation(mp_pediatric_evaluation evaluation)
        {
            var old = _context.mp_pediatric_evaluation.FirstOrDefault(e => e.appointment_id == evaluation.appointment_id && e.profile_id == evaluation.profile_id);

            if (old == null)
            {
                _context.Add(evaluation);
            }
            else
            {
                evaluation.created_by   = old.created_by;
                evaluation.created_date = old.created_date;
                evaluation.id           = old.id;

                _context.Entry(old).CurrentValues.SetValues(evaluation);
            }
            _context.SaveChanges();

            return(evaluation.id);
        }