コード例 #1
0
 /// <summary>
 /// Removes a PatientMedication from the Repository.
 /// </summary>
 /// <param name="entity">The PatientMedication to remove from the Repository.</param>
 public void Remove(PatientMedication entity)
 {
     Session.Delete(entity);
 }
コード例 #2
0
        /// <summary>
        /// Add medication to patient
        /// </summary>
        /// <returns></returns>
        public JsonResult AddMedicationToPatient()
        {
            try
            {
                PatientRepository repo = new PatientRepository();
                Patient patient = repo.Get(int.Parse(Request.Form["patientID"]));
                PatientMedicationRepositiry pmr = new PatientMedicationRepositiry();
                MedicationRepository medRepo = new MedicationRepository();

                PatientMedication pMed = new PatientMedication();
                pMed.Medication = medRepo.Get(int.Parse(Request.Form["name"]));
                pMed.Instruction = Request.Form["instructions"];
                pMed.StartDate = DateTime.Now;
                pMed.ExpDate = DateTime.Parse(Request.Form["expDate"]);
                pMed.Administration = (MedicationRouteOfAdministrationType)Enum.Parse(typeof(MedicationRouteOfAdministrationType), Request.Form["route"]);
                pMed.Dose = Request.Form["dose"];
                pMed.Frequency = Request.Form["frequency"];
                pMed.Patient = patient;

                pmr.Add(pMed);

                return Json(new
                                {
                                    error = "false",
                                    id = pMed.Medication.Id,
                                    name = pMed.Medication.Name,
                                    dose = pMed.Dose,
                                    frequency = pMed.Frequency,
                                    route = Enum.GetName(typeof(OpenEhs.Domain.MedicationRouteOfAdministrationType), pMed.Administration),
                                    instructions = pMed.Instruction,
                                    startDate = pMed.StartDate.ToString("dd/MM/yyyy"),
                                    expDate = pMed.ExpDate.ToString("dd/MM/yyyy")
                                });

            }
            catch (Exception e)
            {
                return Json(new
                                {
                                    error = "true",
                                    status = "Unable to add medication to patient",
                                    errorMessage = e.Message
                                });
            }
        }
コード例 #3
0
 /// <summary>
 /// Adds a PatientMedication to the Repository.
 /// </summary>
 /// <param name="entity">The PatientMedication to add to the Repository.</param>
 public void Add(PatientMedication entity)
 {
     Session.Save(entity);
 }