コード例 #1
0
        private void GetMedicationPreviousDetails(out MedicationModel previous_state, Guid id, string connectionString, string sessionTicket, HttpRequest request)
        {
            var transaction = new TransactionalInformation();
            var md          = new MedicationDataService();

            previous_state = md.GetMedicationforMedicationID(id, connectionString, sessionTicket, out transaction, request);
        }
コード例 #2
0
 public void verifyStandardMedication(MedicationModel medication, int id)
 {
     Assert.AreEqual(id, medication.Id);
     Assert.AreEqual(String.Format("Medication {0}", id), medication.BrandName);
     Assert.AreEqual(String.Format("Generic {0}", id), medication.GenericName);
     Assert.AreEqual(id.ToString(), medication.FdaId);
     Assert.AreEqual("Field", medication.ImageUrl);
 }
コード例 #3
0
        /// <summary>
        /// Get medications for list
        /// </summary>
        /// <param name="connectionString"></param>
        /// <param name="sessionTicket"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public List <MedicationModel> GetMedications(MedicationSort objSort, string connectionString, string sessionTicket, out TransactionalInformation transaction)
        {
            var method = MethodInfo.GetCurrentMethod();
            var ipInfo = Util.GetIPInfo(HttpContext.Current.Request);

            transaction = new TransactionalInformation();
            var userSecurityTicket                   = VerifySessionToken(sessionTicket);
            List <MedicationModel> medications       = new List <MedicationModel>();
            List <MedicationModel> medicationsSorted = new List <MedicationModel>();

            try
            {
                MC_GM_1208[] medicationList = cls_Get_Medications.Invoke(connectionString, userSecurityTicket).Result;
                foreach (var medicationItem in medicationList)
                {
                    MedicationModel medication = new MedicationModel();
                    medication.MedicationID    = medicationItem.MedicationID;
                    medication.Medication      = medicationItem.Medication;
                    medication.ProprietaryDrug = medicationItem.ProprietaryDrug;
                    medication.HecDrugID       = medicationItem.HecDrugID;
                    medication.PZNScheme       = medicationItem.PZNScheme;
                    medications.Add(medication);
                }
                switch (objSort.frKey)
                {
                case "Medication":
                    medicationsSorted = medications.OrderBy(pr => pr.Medication).ToList();
                    break;

                case "ProprietaryDrug":
                    medicationsSorted = medications.OrderBy(pr => pr.ProprietaryDrug).ToList();
                    break;

                case "PZNScheme":
                    medicationsSorted = medications.OrderBy(pr => pr.PZNScheme).ToList();
                    break;
                }
                if (!objSort.isAsc)
                {
                    medicationsSorted.Reverse();
                }
            }
            catch (Exception ex)
            {
                Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, ex));

                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
                transaction.IsAuthenicated = true;
                transaction.IsException    = true;
            }
            return(medicationsSorted);
        }
コード例 #4
0
        public MedicationModel Post(MedicationModel model)
        {
            if (!dbContext.Cabinets.Any(u => u.Id == model.CabinetId))
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            var medication = model.ToDbMedication();

            dbContext.Add(medication);
            dbContext.Commit();
            return(Get(medication.Id));
        }
コード例 #5
0
        public MedicationModel Put(MedicationModel model)
        {
            var medication = dbContext.Medications.FirstOrDefault(m => m.Id == model.Id);

            if (medication == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            model.UpdateDbMedication(medication);
            dbContext.Commit();
            return(Get(model.Id));
        }
コード例 #6
0
        public HttpResponseMessage SaveMedication(MedicationModel medication)
        {
            TransactionalInformation transaction = new TransactionalInformation();

            medicationDataService.SaveMedication(medication, connectionString, SessionToken, out transaction);

            if (transaction.ReturnStatus)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "ok"));
            }

            return(Request.CreateResponse <TransactionalInformation>(HttpStatusCode.BadRequest, transaction));
        }
コード例 #7
0
        public HttpResponseMessage GetMedicationforMedicationID([FromUri] Guid ID)
        {
            TransactionalInformation transaction   = new TransactionalInformation();
            MedicationApiModel       medicationApi = new MedicationApiModel();
            MedicationModel          medication    = medicationDataService.GetMedicationforMedicationID(ID, connectionString, SessionToken, out transaction);

            medicationApi.medication = medication;
            if (transaction.ReturnStatus)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, medicationApi));
            }

            return(Request.CreateResponse <TransactionalInformation>(HttpStatusCode.BadRequest, transaction));
        }
コード例 #8
0
        public ActionResult Create(MedicationModel medicationmodel)
        {
            if (ModelState.IsValid)
            {
                var ingredients = this.GetSelectedIngredientsFromIds(medicationmodel.IngredientIDs);
                medicationmodel.Ingredients = this.AttachIngredientsToDatabaseAndReturn(DataContext.Ingredients, ingredients);

                DataContext.Medications.Add(medicationmodel);
                DataContext.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.DosageID = this.OrderedDosageSelectList(medicationmodel.DosageID);
            ViewBag.Ingredients = this.OrderedIngredientsMultiSelectList();

            return View(medicationmodel);
        }
コード例 #9
0
        private MedicationModel GetMappedMedication(MedicationRequest medication)
        {
            var resultMedicationRequest = new MedicationModel
            {
                Id = medication.Id
            };

            resultMedicationRequest.VersionId = medication.VersionId ?? "";
            var meds = medication.Medication as CodeableConcept;

            resultMedicationRequest.Text = meds.Text;
            resultMedicationRequest.DosageInstructions = medication.DosageInstruction;
            resultMedicationRequest.SubjectId          = medication.Subject.Reference.Split('/')[1];
            resultMedicationRequest.Status             = medication.Status;
            resultMedicationRequest.AuthoredOn         = medication.AuthoredOnElement.ToDateTimeOffset();
            resultMedicationRequest.Practitioner       = medication.Requester.Display;
            resultMedicationRequest.Intent             = medication.Intent;
            return(resultMedicationRequest);
        }
コード例 #10
0
        public MedicationModel GetMedicationforMedicationID(Guid id, string connectionString, string sessionTicket, out TransactionalInformation transaction, HttpRequest request = null)
        {
            if (request == null)
            {
                request = HttpContext.Current.Request;
            }
            var method = MethodInfo.GetCurrentMethod();
            var ipInfo = Util.GetIPInfo(request);

            transaction = new TransactionalInformation();
            var             userSecurityTicket = VerifySessionToken(sessionTicket);
            MedicationModel medication         = new MedicationModel();

            try
            {
                MC_GMfMID_1433 medicationFound = cls_Get_Medication_for_MedicationID.Invoke(connectionString, new P_MC_GMfMID_1433()
                {
                    MedicationID = id
                }, userSecurityTicket).Result;
                medication.MedicationID    = medicationFound.MedicationID;
                medication.Medication      = medicationFound.Medication;
                medication.ProprietaryDrug = medicationFound.ProprietaryDrug;
                medication.PZNScheme       = medicationFound.PZNScheme;
            }
            catch (Exception ex)
            {
                Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, ex));

                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
                transaction.IsAuthenicated = true;
                transaction.IsException    = true;
            }

            return(medication);
        }
コード例 #11
0
 public static bool Save(IServerAuthentication restClientAuthenticator, MedicationModel model)
 {
     return(ApiClientGenericObject <MedicationModel> .Save(restClientAuthenticator, ControllerName, model));
 }
コード例 #12
0
        /// <summary>
        /// Save new medication or edit existing one
        /// </summary>
        /// <param name="medication"></param>
        /// <param name="connectionString"></param>
        /// <param name="sessionTicket"></param>
        /// <param name="transaction"></param>
        public void SaveMedication(MedicationModel medication, string connectionString, string sessionTicket, out TransactionalInformation transaction)
        {
            var request = HttpContext.Current.Request;
            var method  = MethodInfo.GetCurrentMethod();
            var ipInfo  = Util.GetIPInfo(request);

            transaction = new TransactionalInformation();
            var userSecurityTicket = VerifySessionToken(sessionTicket);

            IEnumerable <IEnumerable <IElasticMapper> > elastic_backup = null;

            try
            {
                #region PARAMETER
                P_MC_SM_1132 medication_parameter = new P_MC_SM_1132();
                medication_parameter.MedicationID    = medication.MedicationID;
                medication_parameter.Medication      = medication.Medication;
                medication_parameter.ProprietaryDrug = medication.ProprietaryDrug;
                medication_parameter.PZNScheme       = medication.PZNScheme;
                medication_parameter.Dosage          = medication.Dosage;
                medication_parameter.Unit            = medication.Unit;
                #endregion

                MedicationModel previous_state = null;

                if (medication.MedicationID != Guid.Empty)
                {
                    var detailsThread = new Thread(() => GetMedicationPreviousDetails(out previous_state, medication.MedicationID, connectionString, sessionTicket, request));
                    detailsThread.Start();

                    var medication_details = cls_Get_Medication_for_MedicationID.Invoke(connectionString, new P_MC_GMfMID_1433()
                    {
                        MedicationID = medication.MedicationID
                    }, userSecurityTicket).Result;

                    if (medication_details != null && medication_details.Medication != medication.Medication)
                    {
                        elastic_backup = Elastic_Rollback.GetBackup(userSecurityTicket.TenantID.ToString(), medication.HecDrugID.ToString(), "drug");

                        var values = new string[] { medication.Medication };

                        var elastic_data = Elastic_Rollback.GetUpdatedData(userSecurityTicket.TenantID.ToString(), medication.HecDrugID.ToString(), "drug", values);

                        Elastic_Rollback.InsertDataIntoElastic(elastic_data, userSecurityTicket.TenantID.ToString());
                    }
                }

                cls_Save_Medication.Invoke(connectionString, medication_parameter, userSecurityTicket);

                Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, medication, previous_state));
            }
            catch (Exception ex)
            {
                Logger.LogInfo(new LogEntry(ipInfo.address, ipInfo.agent, connectionString, method, userSecurityTicket, ex));

                transaction.ReturnMessage = new List <string>();
                string errorMessage = ex.Message;
                transaction.ReturnStatus = false;
                transaction.ReturnMessage.Add(errorMessage);
                transaction.IsAuthenicated = true;
                transaction.IsException    = true;

                if (elastic_backup != null)
                {
                    Elastic_Rollback.InsertDataIntoElastic(elastic_backup, userSecurityTicket.TenantID.ToString());
                }
            }
        }
コード例 #13
0
        public ActionResult Edit(MedicationModel medicationmodel)
        {
            if (ModelState.IsValid)
            {
                //get the true model
                var model = DataContext.Medications.Include(m => m.Ingredients).Single(m => m.MedicationID == medicationmodel.MedicationID);

                //set all scalar values and then clear out the list of items currently attached
                DataContext.Entry(model).CurrentValues.SetValues(medicationmodel);
                model.Ingredients.Clear();

                // disable autodetectchanges before runing loop with DbSet<T>.Find because it slows it down. similar to how you should tell a gridview to not draw or fire events until everything is loaded.
                // we then load up all the true ingredients based on the incoming list of ingredientIDs
                // finally, we turn the autodetectchangesenabled back on
                DataContext.Configuration.AutoDetectChangesEnabled = false;
                foreach (var ingredientID in medicationmodel.IngredientIDs)
                {
                    var ingredient = DataContext.Ingredients.Find(ingredientID);
                    model.Ingredients.Add(ingredient);
                }
                DataContext.Configuration.AutoDetectChangesEnabled = true;

                //save changes and redirect to the medications index
                DataContext.SaveChanges();
                return RedirectToAction("Index");
            }

            medicationmodel.IngredientIDs = medicationmodel.Ingredients.Select(i => i.IngredientID).ToList();

            ViewBag.Dosages = this.OrderedDosageSelectList(medicationmodel.DosageID);
            ViewBag.Ingredients = this.OrderedIngredientsMultiSelectList(medicationmodel.IngredientIDs.ToList());

            return View(medicationmodel);
        }
コード例 #14
0
        public IActionResult GetTreatmentRecordByAppointmenDatetId(int AppointmentDateId)
        {
            ResultModel resultModel        = new ResultModel();
            var         treatmentReocrd    = _treatmentRecordServices.GetTreatmentRecordsByAppointmentDateId(AppointmentDateId);
            var         treatmentRecodData = _reportServices.GetAllTreatmentRecordData(treatmentReocrd.Id);

            var treatmentRecordModel = new TreatmentRecordMasterModel();

            treatmentRecordModel.TreatmentRecordNo = treatmentReocrd.TreatmentRecordNo;
            treatmentRecordModel.Id = treatmentReocrd.Id;
            treatmentRecordModel.AppointmentDateId = treatmentReocrd.AppointmentDateId;
            //Patient Data
            var patientdata = new PatientInfoModel();

            patientdata.DiagnosisId      = treatmentRecodData.PatientVM.DiagnosisId;
            patientdata.HospitalMasterId = treatmentRecodData.PatientVM.HospitalMasterId;
            patientdata.MarkComplete     = treatmentRecodData.PatientVM.MarkComplete;
            patientdata.MR                      = (treatmentRecodData.PatientVM.MR != null)?_encryptionService.DecryptText(treatmentRecodData.PatientVM.MR):null;
            patientdata.NurseMasterId           = treatmentRecodData.PatientVM.NurseMasterId;
            patientdata.PatientInfoId           = treatmentRecodData.PatientVM.Id;
            patientdata.ProcedureId             = treatmentRecodData.PatientVM.ProcedureId;
            patientdata.PatientMasterId         = treatmentRecodData.PatientVM.PatientMasterId;
            patientdata.TreatmentRecordMasterId = treatmentRecodData.PatientVM.TreatmentRecordMasterId;
            patientdata.PatientName             = (treatmentRecodData.PatientVM.PatientName != null)?_encryptionService.DecryptText(treatmentRecodData.PatientVM.PatientName) : null;
            patientdata.ProcedureName           = treatmentRecodData.PatientVM.ProcedureName;
            patientdata.DaignosisName           = treatmentRecodData.PatientVM.DaignosisName;
            patientdata.HospitalName            = (treatmentRecodData.PatientVM.HospitalName != null)?_encryptionService.DecryptText(treatmentRecodData.PatientVM.HospitalName) : null;
            //patientdata.NurseName = treatmentRecodData.PatientVM.NurseName;
            patientdata.NurseName   = _encryptionService.DecryptText(treatmentRecodData.PatientVM.NurseFirstName) + " " + _encryptionService.DecryptText(treatmentRecodData.PatientVM.NurseLastName);
            patientdata.Date        = treatmentRecodData.PatientVM.Date;
            patientdata.Deleted     = treatmentRecodData.PatientVM.Deleted;
            patientdata.LastUpdated = treatmentRecodData.PatientVM.LastUpdated;
            treatmentRecordModel.PatientInfoData = patientdata;

            //Doctor Data
            treatmentRecordModel.DoctorData = new DoctorInfoModel
            {
                Comments               = treatmentRecodData.DoctorsInfo.Comments,
                DoctorName             = treatmentRecodData.DoctorsInfo.DoctorName,
                EducatioPreTreatmentId = treatmentRecodData.DoctorsInfo.EducatioPreTreatmentId,
                Id                      = treatmentRecodData.DoctorsInfo.Id,
                OrdersReviewed          = treatmentRecodData.DoctorsInfo.OrdersReviewed,
                OutPatient              = treatmentRecodData.DoctorsInfo.OutPatient,
                Room                    = treatmentRecodData.DoctorsInfo.Room,
                TreatmentRecordMasterId = treatmentRecodData.DoctorsInfo.TreatmentRecordMasterId,
                MarkComplete            = treatmentRecodData.DoctorsInfo.MarkComplete
            };

            //Machine Data
            treatmentRecordModel.MachineData = new MachineModel
            {
                Id                       = treatmentRecodData.MachineMaster.Id,
                KitTypeSerial            = treatmentRecodData.MachineMaster.KitTypeSerial,
                AlarmCheck               = treatmentRecodData.MachineMaster.AlarmCheck,
                CleanedFrontDoorSensors  = treatmentRecodData.MachineMaster.CleanedFrontDoorSensors,
                CleanedPressurePODSSeals = treatmentRecodData.MachineMaster.CleanedPressurePODSSeals,
                CleanedSensors           = treatmentRecodData.MachineMaster.CleanedSensors,
                CleanedTrackDoors        = treatmentRecodData.MachineMaster.CleanedTrackDoors,
                CorrectiveAction         = treatmentRecodData.MachineMaster.CorrectiveAction,
                EquipmentId              = treatmentRecodData.MachineMaster.EquipmentId,
                EquipSerial              = treatmentRecodData.MachineMaster.EquipSerial,
                ExpDate                  = treatmentRecodData.MachineMaster.ExpDate,
                KitTypeId                = (treatmentRecodData.MachineMaster.KitTypeId != null) ? treatmentRecodData.MachineMaster.KitTypeId : 0,
                MachineClean             = treatmentRecodData.MachineMaster.MachineClean,
                PMDate                   = treatmentRecodData.MachineMaster.PMDate,
                PrimeSuccess             = treatmentRecodData.MachineMaster.PrimeSuccess,
                SafetyChkDate            = treatmentRecodData.MachineMaster.SafetyChkDate,
                TreatmentRecordMasterId  = treatmentRecodData.MachineMaster.TreatmentRecordMasterId,
                MarkComplete             = treatmentRecodData.MachineMaster.MarkComplete,
                EquipmentName            = treatmentRecodData.MachineMaster.EquipmentName
            };
            //Pre treatment Check

            treatmentRecordModel.PreTreatmentCheckData = new PreTreatmentCheckModel
            {
                AlarmTest               = treatmentRecodData.PreTreatmentCheck.AlarmTest,
                BloodConsent            = treatmentRecodData.PreTreatmentCheck.BloodConsent,
                Id                      = treatmentRecodData.PreTreatmentCheck.Id,
                InformedConsent         = treatmentRecodData.PreTreatmentCheck.InformedConsent,
                TreatmentRecordMasterId = treatmentRecodData.PreTreatmentCheck.TreatmentRecordMasterId,
                UniversalPrecautions    = treatmentRecodData.PreTreatmentCheck.UniversalPrecautions,
                MarkComplete            = treatmentRecodData.PreTreatmentCheck.MarkComplete,
                MachinePrimeId          = (treatmentRecodData.PreTreatmentCheck.MachinePrimeId != null) ? treatmentRecodData.PreTreatmentCheck.MachinePrimeId : 0
            };
            //Lab Values
            treatmentRecordModel.LabValueData = new LabValuesModel
            {
                EBV                     = treatmentRecodData.LabValues.EBV,
                ECV10                   = treatmentRecodData.LabValues.ECV10,
                ECV15                   = treatmentRecodData.LabValues.ECV15,
                EPV                     = treatmentRecodData.LabValues.EPV,
                Height                  = treatmentRecodData.LabValues.Height,
                HGB                     = treatmentRecodData.LabValues.HGB,
                HTC                     = treatmentRecodData.LabValues.HTC,
                Id                      = treatmentRecodData.LabValues.Id,
                MarkComplete            = treatmentRecodData.LabValues.MarkComplete,
                TreatmentRecordMasterId = treatmentRecodData.LabValues.TreatmentRecordMasterId
            };
            //Other Lab Values
            var otherLabValues = _treatmentRecordServices.GetOtherLabValueByLabValueId(treatmentRecodData.LabValues.Id);

            if (otherLabValues.Count() != 0)
            {
                foreach (var othervalue in otherLabValues)
                {
                    var otherValuesData = new OtherLabValuesModel
                    {
                        ContentName  = othervalue.ContentName,
                        Id           = othervalue.Id,
                        ContentValue = othervalue.ContentValue,
                        LabValuesId  = othervalue.LabValuesId
                    };
                    treatmentRecordModel.LabValueData.OtherLabValues.Add(otherValuesData);
                }
            }
            //Supplies And Access
            treatmentRecordModel.SuppliesData = new SuppliesAndAccessModel
            {
                ACDLot            = treatmentRecodData.SuppliesVM.ACDLot,
                ACDLotExpDate     = treatmentRecodData.SuppliesVM.ACDLotExpDate,
                ACEInhibitors     = treatmentRecodData.SuppliesVM.ACEInhibitors,
                BloodWarmer       = treatmentRecodData.SuppliesVM.BloodWarmer,
                Comments          = treatmentRecodData.SuppliesVM.Comments,
                CreatedOn         = treatmentRecodData.SuppliesVM.CreatedOn,
                CVC               = treatmentRecodData.SuppliesVM.CVC,
                DateDC            = treatmentRecodData.SuppliesVM.DateDC,
                Deleted           = treatmentRecodData.SuppliesVM.Deleted,
                Id                = treatmentRecodData.SuppliesVM.Id,
                LastDoseDate      = treatmentRecodData.SuppliesVM.LastDoseDate,
                LastUpdated       = treatmentRecodData.SuppliesVM.LastUpdated,
                Locations         = treatmentRecodData.SuppliesVM.Locations,
                MarkComplete      = treatmentRecodData.SuppliesVM.MarkComplete,
                MedsReviewed      = treatmentRecodData.SuppliesVM.MedsReviewed,
                NSPrimeLot        = treatmentRecodData.SuppliesVM.NSPrimeLot,
                NSPrimeLotExpDate = treatmentRecodData.SuppliesVM.NSPrimeLotExpDate,
                Peripheral        = treatmentRecodData.SuppliesVM.Peripheral,
                Rate              = treatmentRecodData.SuppliesVM.Rate,
                Serial            = treatmentRecodData.SuppliesVM.Serial,
                TEMP              = treatmentRecodData.SuppliesVM.TEMP,
                TreatmentRecordId = treatmentRecodData.SuppliesVM.TreatmentRecordId,
                Type              = treatmentRecodData.SuppliesVM.Type,
                Vortex            = treatmentRecodData.SuppliesVM.Vortex
            };
            //Pre treatment Assessment
            treatmentRecordModel.PreTreatmentAssessmentData = new PreTreatmentAssessmentModel
            {
                BleendAutoTextId = treatmentRecodData.PreTreatmentAssessment.BleendAutoTextId,
                CreatedOn        = treatmentRecodData.PreTreatmentAssessment.CreatedOn,
                EdemaAutoTextId  = treatmentRecodData.PreTreatmentAssessment.EdemaAutoTextId,
                Id                      = treatmentRecodData.PreTreatmentAssessment.Id,
                IsAlert                 = treatmentRecodData.PreTreatmentAssessment.IsAlert,
                IsBleeding              = treatmentRecodData.PreTreatmentAssessment.IsBleeding,
                IsComatose              = treatmentRecodData.PreTreatmentAssessment.IsComatose,
                IsDeleted               = treatmentRecodData.PreTreatmentAssessment.IsDeleted,
                IsEasy                  = treatmentRecodData.PreTreatmentAssessment.IsEasy,
                IsEdema                 = treatmentRecodData.PreTreatmentAssessment.IsEdema,
                IsFiO2                  = treatmentRecodData.PreTreatmentAssessment.IsFiO2,
                IsLabored               = treatmentRecodData.PreTreatmentAssessment.IsLabored,
                IsLethargic             = treatmentRecodData.PreTreatmentAssessment.IsLethargic,
                IsMask                  = treatmentRecodData.PreTreatmentAssessment.IsMask,
                IsNC                    = treatmentRecodData.PreTreatmentAssessment.IsNC,
                IsNumbness              = treatmentRecodData.PreTreatmentAssessment.IsNumbness,
                IsRoomAir               = treatmentRecodData.PreTreatmentAssessment.IsRoomAir,
                IsVent                  = treatmentRecodData.PreTreatmentAssessment.IsVent,
                IsWeakness              = treatmentRecodData.PreTreatmentAssessment.IsWeakness,
                LastUpdated             = treatmentRecodData.PreTreatmentAssessment.LastUpdated,
                LocationAutoTextId      = treatmentRecodData.PreTreatmentAssessment.LungSoundsAutoTextId,
                LungSoundsAutoTextId    = treatmentRecodData.PreTreatmentAssessment.LungSoundsAutoTextId,
                MarkComplete            = treatmentRecodData.PreTreatmentAssessment.MarkComplete,
                NumbnessAutoTextId      = treatmentRecodData.PreTreatmentAssessment.NumbnessAutoTextId,
                OrientedX               = treatmentRecodData.PreTreatmentAssessment.OrientedX,
                OSat                    = treatmentRecodData.PreTreatmentAssessment.OSat,
                PainAutoTextId          = treatmentRecodData.PreTreatmentAssessment.PainAutoTextId,
                RythmAutoTextId         = treatmentRecodData.PreTreatmentAssessment.RythmAutoTextId,
                SkinAutoTextId          = treatmentRecodData.PreTreatmentAssessment.SkinAutoTextId,
                TreatmentRecordMasterId = treatmentRecodData.PreTreatmentAssessment.TreatmentRecordMasterId,
                WeaknessAutoTextId      = treatmentRecodData.PreTreatmentAssessment.WeaknessAutoTextId
            };
            //Run Values
            var runvaluesData = _treatmentRecordServices.GetRunValuesByTreatmentRecordId(treatmentReocrd.Id);

            if (runvaluesData.Count() != 0)
            {
                foreach (var runvalue in runvaluesData)
                {
                    var RunValuesModel = new RunValuesModel
                    {
                        ACFlowRate      = runvalue.ACFlowRate,
                        ACFlowVol       = runvalue.ACFlowVol,
                        BP              = runvalue.BP,
                        CollectFlowRate = runvalue.CollectFlowRate,
                        CollectFlowVol  = runvalue.CollectFlowVol,
                        CreatedOn       = runvalue.CreatedOn,
                        Deleted         = runvalue.Deleted,
                        Id              = runvalue.Id,
                        IntelFlowRate   = runvalue.IntelFlowRate,
                        IntelFlowVol    = runvalue.IntelFlowVol,
                        LastUpdated     = runvalue.LastUpdated,
                        LotNo           = runvalue.LotNo,
                        P = runvalue.P,
                        T = runvalue.T,
                        PlasmaFlowRate = runvalue.PlasmaFlowRate,
                        PlasmaFlowVol  = runvalue.PlasmaFlowVol,
                        R = runvalue.R,
                        ReplaceFluidId          = runvalue.ReplaceFluidId,
                        RunTime                 = runvalue.RunTime,
                        TreatmentRecordMasterId = runvalue.TreatmentRecordMasterId,
                        WarmerTemp              = runvalue.WarmerTemp
                    };
                    treatmentRecordModel.RunValues.runValuesList.Add(RunValuesModel);
                }
                treatmentRecordModel.RunValues.MarkComplete = runvaluesData[0].MarkComplete;
            }
            //Final Values

            treatmentRecordModel.FinalValuesData = new FinalValuesAndAccessPostAssessmentModel
            {
                AC = treatmentRecodData.FinalValuesVM.AC,
                BP = treatmentRecodData.FinalValuesVM.BP,
                ChlorhexidineCapApplied = treatmentRecodData.FinalValuesVM.ChlorhexidineCapApplied,
                Collet            = treatmentRecodData.FinalValuesVM.Collet,
                Comments          = treatmentRecodData.FinalValuesVM.Comments,
                CreatedOn         = treatmentRecodData.FinalValuesVM.CreatedOn,
                Deleted           = treatmentRecodData.FinalValuesVM.Deleted,
                FluidBalance      = treatmentRecodData.FinalValuesVM.FluidBalance,
                Heparin           = treatmentRecodData.FinalValuesVM.Heparin,
                Id                = treatmentRecodData.FinalValuesVM.Id,
                Inlet             = treatmentRecodData.FinalValuesVM.Inlet,
                Intact            = treatmentRecodData.FinalValuesVM.Intact,
                LastUpdated       = treatmentRecodData.FinalValuesVM.LastUpdated,
                MarkComplete      = treatmentRecodData.FinalValuesVM.MarkComplete,
                NewDressing       = treatmentRecodData.FinalValuesVM.NewDressing,
                P                 = treatmentRecodData.FinalValuesVM.P,
                Plasma            = treatmentRecodData.FinalValuesVM.Plasma,
                R                 = treatmentRecodData.FinalValuesVM.R,
                Reinforced        = treatmentRecodData.FinalValuesVM.Reinforced,
                Saline            = treatmentRecodData.FinalValuesVM.Saline,
                T                 = treatmentRecodData.FinalValuesVM.T,
                Time              = treatmentRecodData.FinalValuesVM.Time,
                TreatmentRecordId = treatmentRecodData.FinalValuesVM.TreatmentRecordId
            };
            //post treatment
            treatmentRecordModel.PostTreatmentData = new PostTreatmentModel {
                Id = treatmentRecodData.PostTreatmentVM.Id,
                IsBiohazardWasteDisposed         = treatmentRecodData.PostTreatmentVM.IsBiohazardWasteDisposed,
                IsEquipmentCleanedAndDisinfected = treatmentRecodData.PostTreatmentVM.IsEquipmentCleanedAndDisinfected,
                TreatmentRecordId      = treatmentRecodData.PostTreatmentVM.TreatmentRecordId,
                IsPostCVCCarePerPolicy = treatmentRecodData.PostTreatmentVM.IsPostCVCCarePerPolicy,
                IsRinseBackComplete    = treatmentRecodData.PostTreatmentVM.IsRinseBackComplete,
                IsSideRailsUp          = treatmentRecodData.PostTreatmentVM.IsSideRailsUp,
                MarkComplete           = treatmentRecodData.PostTreatmentVM.MarkComplete
            };

            var Medication = _treatmentRecordServices.GetMedicationByPostTreatmentId(treatmentRecordModel.PostTreatmentData.Id);

            if (Medication.Count() != 0)
            {
                foreach (var medicationData in Medication)
                {
                    var medicationdata = new MedicationModel
                    {
                        Comments        = medicationData.Comments,
                        Dosage          = medicationData.Dosage,
                        Id              = medicationData.Id,
                        Name            = medicationData.Name,
                        PostTreatmentId = medicationData.PostTreatmentId,
                        Route           = medicationData.Route
                    };
                }
            }
            //Note and Report
            treatmentRecordModel.NoteAndReportData = new NoteAndReportModel
            {
                CreatedOn = treatmentRecodData.NoteAndReportVM.CreatedOn,
                Deleted   = treatmentRecodData.NoteAndReportVM.Deleted,
                Id        = treatmentRecodData.NoteAndReportVM.Id,
                IsTreatmentCompletedWOIncident = treatmentRecodData.NoteAndReportVM.IsTreatmentCompletedWOIncident,
                LastUpdated             = treatmentRecodData.NoteAndReportVM.LastUpdated,
                MarkComplete            = treatmentRecodData.NoteAndReportVM.MarkComplete,
                Note                    = treatmentRecodData.NoteAndReportVM.Note,
                ReportGivenTo           = treatmentRecodData.NoteAndReportVM.ReportGivenTo,
                TreatmentRecordMasterId = treatmentRecodData.NoteAndReportVM.TreatmentRecordMasterId
            };

            resultModel.Message  = ValidationMessages.Success;
            resultModel.Status   = 1;
            resultModel.Response = treatmentRecordModel;
            return(Ok(resultModel));
        }
        public IActionResult Create(PostTreatmentModel model)
        {
            ResultModel resultModel = new ResultModel();

            try
            {
                if (model.Id == 0)
                {
                    var postTreatment = new PostTreatment();
                    postTreatment.IsBiohazardWasteDisposed         = model.IsBiohazardWasteDisposed;
                    postTreatment.IsEquipmentCleanedAndDisinfected = model.IsEquipmentCleanedAndDisinfected;
                    postTreatment.IsPostCVCCarePerPolicy           = model.IsPostCVCCarePerPolicy;
                    postTreatment.IsRinseBackComplete = model.IsRinseBackComplete;
                    postTreatment.IsSideRailsUp       = model.IsSideRailsUp;
                    postTreatment.TreatmentRecordId   = model.TreatmentRecordId;
                    //Mark Complete
                    postTreatment.MarkComplete = model.MarkComplete;
                    _treatmentRecordServices.InsertPostTreatment(postTreatment);
                    //Bhawana(09/10/2019)
                    //Change treatment Record Status
                    _reportService.UpdateTreatmentStatusID((int)postTreatment.TreatmentRecordId);


                    foreach (var medicationData in model.MedicationList)
                    {
                        var medication = new Medication();
                        medication.PostTreatmentId = postTreatment.Id;
                        medication.Dosage          = medicationData.Dosage;
                        medication.Comments        = medicationData.Comments;
                        medication.Route           = medicationData.Route;
                        medication.Name            = medicationData.Name;
                        postTreatment.Medications.Add(medication);
                        _treatmentRecordServices.UpdatePostTreatment(postTreatment);
                    }
                    //12/10/19 aakansha
                    //model response
                    model.Id = postTreatment.Id;
                    model.TreatmentRecordId = postTreatment.TreatmentRecordId;
                    var postTreatment1 = _treatmentRecordServices.GetPostTreatmentById(postTreatment.Id);
                    foreach (var Medication in postTreatment.Medications)
                    {
                        var MEdication = new MedicationModel();

                        MEdication.Id              = Medication.Id;
                        MEdication.Name            = Medication.Name;
                        MEdication.PostTreatmentId = Medication.PostTreatmentId;
                        MEdication.Route           = Medication.Route;
                        model.MedicationList.Clear();
                        model.MedicationList.Add(MEdication);
                    }

                    resultModel.Message  = ValidationMessages.Success;
                    resultModel.Status   = 1;
                    resultModel.Response = model;
                    return(Ok(resultModel));
                }
                else
                {
                    var postTreatment = _treatmentRecordServices.GetPostTreatmentById(model.Id);
                    postTreatment.IsBiohazardWasteDisposed         = model.IsBiohazardWasteDisposed;
                    postTreatment.IsEquipmentCleanedAndDisinfected = model.IsEquipmentCleanedAndDisinfected;
                    postTreatment.IsPostCVCCarePerPolicy           = model.IsPostCVCCarePerPolicy;
                    postTreatment.IsRinseBackComplete = model.IsRinseBackComplete;
                    postTreatment.IsSideRailsUp       = model.IsSideRailsUp;
                    postTreatment.TreatmentRecordId   = model.TreatmentRecordId;
                    postTreatment.Id           = model.Id;
                    postTreatment.MarkComplete = model.MarkComplete;
                    _treatmentRecordServices.UpdatePostTreatment(postTreatment);
                    //Bhawana(09/10/2019)
                    //Change treatment Record Status
                    _reportService.UpdateTreatmentStatusID((int)postTreatment.TreatmentRecordId);
                    foreach (var medicationList in model.MedicationList)
                    {
                        if (medicationList.Id == 0)
                        {
                            var medication = new Medication();
                            medication.PostTreatmentId = postTreatment.Id;
                            medication.Dosage          = medicationList.Dosage;
                            medication.Comments        = medicationList.Comments;
                            medication.Route           = medicationList.Route;
                            medication.Name            = medicationList.Name;
                            postTreatment.Medications.Add(medication);
                            _treatmentRecordServices.UpdatePostTreatment(postTreatment);
                        }
                        else
                        {
                            var medication = _treatmentRecordServices.GetMedicationById(medicationList.Id);
                            medication.PostTreatmentId = postTreatment.Id;
                            medication.Dosage          = medicationList.Dosage;
                            medication.Comments        = medicationList.Comments;
                            medication.Route           = medicationList.Route;
                            medication.Name            = medicationList.Name;

                            _treatmentRecordServices.UpdateMedication(medication);
                        }
                    }
                    //12/10/19 aakansha
                    //model response
                    model.Id = postTreatment.Id;
                    model.TreatmentRecordId = postTreatment.TreatmentRecordId;
                    var postTreatment1 = _treatmentRecordServices.GetPostTreatmentById(postTreatment.Id);
                    foreach (var Medication in postTreatment.Medications)
                    {
                        var MEdication = new MedicationModel();

                        MEdication.Id              = Medication.Id;
                        MEdication.Name            = Medication.Name;
                        MEdication.PostTreatmentId = Medication.PostTreatmentId;
                        MEdication.Route           = Medication.Route;
                        model.MedicationList.Clear();
                        model.MedicationList.Add(MEdication);
                    }
                    resultModel.Message  = ValidationMessages.Success;
                    resultModel.Status   = 1;
                    resultModel.Response = model;
                    return(Ok(resultModel));
                }
            }
            catch (Exception e)
            {
                resultModel.Message  = ValidationMessages.Failure;
                resultModel.Status   = 0;
                resultModel.Response = null;
                return(Ok(resultModel));
            }
        }
コード例 #16
0
 public static void materializeMedication(MedicationModel medication)
 {
     medication.Id = int.Parse(medication.FdaId.Split('.')[0]);
 }