Пример #1
0
        public IActionResult ViewTreatmentRecord(int Id)
        {
            //10/10/2019 aakansha
            ViewBag.FormName = "TreatmentRecord";
            var treatmentRecordData = _reportService.GetAllTreatmentRecordData(Id);
            var AllData             = new AllTreatmentRecordDataVM();

            AllData.PatientVM         = treatmentRecordData.PatientVM;
            AllData.DoctorsInfo       = treatmentRecordData.DoctorsInfo;
            AllData.MachineMaster     = treatmentRecordData.MachineMaster;
            AllData.PreTreatmentCheck = treatmentRecordData.PreTreatmentCheck;
            AllData.LabValues         = treatmentRecordData.LabValues;
            var otherlabvaluedata = _treatmentRecordServices.GetOtherLabValueByLabValueId(AllData.LabValues.Id);

            foreach (var otherlabValue in otherlabvaluedata)
            {
                var data = new OtherLabValuesVM
                {
                    ContentName  = otherlabValue.ContentName,
                    Id           = otherlabValue.Id,
                    ContentValue = (decimal)otherlabValue.ContentValue,
                    LabValuesId  = otherlabValue.LabValuesId
                };
                AllData.OtherLabValuesVMs.Add(data);
            }
            AllData.SuppliesVM             = treatmentRecordData.SuppliesVM;
            AllData.PreTreatmentAssessment = treatmentRecordData.PreTreatmentAssessment;
            AllData.RunValuesVM            = treatmentRecordData.RunValuesVM;
            AllData.FinalValuesVM          = treatmentRecordData.FinalValuesVM;
            AllData.PostTreatmentVM        = treatmentRecordData.PostTreatmentVM;
            AllData.medication             = treatmentRecordData.medication;
            var medication = _treatmentRecordServices.GetMedicationByPostTreatmentId(AllData.PostTreatmentVM.Id);

            foreach (var Medication in medication)
            {
                var data = new MedicationVM
                {
                    id              = Medication.Id,
                    Name            = Medication.Name,
                    Dosage          = Medication.Dosage,
                    Route           = Medication.Route,
                    Comments        = Medication.Comments,
                    PostTreatment   = Medication.PostTreatment,
                    PostTreatmentId = Medication.PostTreatmentId,
                };
                AllData.medication.Add(data);
            }
            AllData.NoteAndReportVM = treatmentRecordData.NoteAndReportVM;

            return(View(AllData));
        }
        public AllTreatmentRecordDataVM GetAllTreatmentRecordData(
            int TreatmentRecordId
            )
        {
            try
            {
                AllTreatmentRecordDataVM dd         = new AllTreatmentRecordDataVM();
                List <RunValuesVM>       _RunValues = new List <RunValuesVM>();

                string query = "exec GetAllDataByTreatmentRecordId  @TreatmentRecordId='" + TreatmentRecordId + "'";
                using (var command = _dbContext.Database.GetDbConnection().CreateCommand())
                {
                    command.CommandText = query;
                    _dbContext.Database.OpenConnection();
                    using (var result = command.ExecuteReader())
                    {
                        while (result.Read())
                        {
                            //Patient Data
                            dd.PatientVM = new PatientVM
                            {
                                Id                      = result.GetInt32(0),
                                Deleted                 = result.GetBoolean(1),
                                Date                    = result.GetDateTime(2),
                                LastUpdated             = result.GetDateTime(3),
                                MR                      = _encryptionService.DecryptText(result.GetString(4)),
                                HospitalMasterId        = result.GetInt32(5),
                                HospitalName            = _encryptionService.DecryptText(result.GetString(6)),
                                NurseMasterId           = result.GetInt32(7),
                                NurseFirstName          = result.GetString(8),
                                NurseLastName           = result.GetString(9),
                                ProcedureId             = result.GetInt32(10),
                                ProcedureName           = result.GetString(11),
                                DiagnosisId             = result.GetInt32(12),
                                DaignosisName           = result.GetString(13),
                                PatientMasterId         = result.GetInt32(14),
                                CreatedOn               = result.GetDateTime(15),
                                MarkComplete            = result.GetBoolean(16),
                                TreatmentRecordMasterId = result.GetInt32(17),
                                PatientName             = _encryptionService.DecryptText(result.GetString(18))
                            };
                        }
                        //Doctor's Data
                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.DoctorsInfo = new DoctorsInfoVM
                                {
                                    Id                      = result.GetInt32(0),
                                    DoctorName              = result.GetString(1),
                                    OrdersReviewed          = result.GetBoolean(2),
                                    Room                    = result.GetString(3),
                                    OutPatient              = result.GetBoolean(4),
                                    Comments                = result.GetString(5),
                                    EducatioPreTreatmentId  = result.GetInt32(6),
                                    TreatmentRecordMasterId = result.GetInt32(7),
                                    MarkComplete            = result.GetBoolean(8)
                                };
                            }
                        }

                        //Machine's Data
                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.MachineMaster = new MachineMasterVM
                                {
                                    Id                       = result.GetInt32(0),
                                    EquipmentId              = result.GetInt32(1),
                                    EquipSerial              = result.GetString(2),
                                    KitTypeId                = result.GetInt32(3),
                                    PMDate                   = result.GetDateTime(4),
                                    ExpDate                  = result.GetDateTime(5),
                                    SafetyChkDate            = result.GetDateTime(6),
                                    MachineClean             = result.GetBoolean(7),
                                    AlarmCheck               = result.GetBoolean(8),
                                    CorrectiveAction         = result.GetString(9),
                                    PrimeSuccess             = result.GetBoolean(10),
                                    CleanedTrackDoors        = result.GetBoolean(11),
                                    CleanedSensors           = result.GetBoolean(12),
                                    CleanedPressurePODSSeals = result.GetBoolean(13),
                                    CreatedOn                = result.GetDateTime(14),
                                    LastUpdated              = result.GetDateTime(15),
                                    Deleted                  = result.GetBoolean(16),
                                    KitTypeSerial            = result.GetString(17),
                                    CleanedFrontDoorSensors  = result.GetBoolean(18),
                                    TreatmentRecordMasterId  = result.GetInt32(19),
                                    EquipmentName            = result.GetString(20),
                                    MarkComplete             = result.GetBoolean(21)
                                };
                            }
                        }

                        //Pre treatment Check Data
                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.PreTreatmentCheck = new PreTreatmentCheckVM
                                {
                                    Id = result.GetInt32(0),
                                    InformedConsent = result.GetBoolean(1),
                                    BloodConsent    = result.GetBoolean(2),
                                    MachinePrimeId  = result.GetInt32(3),

                                    AlarmTest               = result.GetBoolean(5),
                                    UniversalPrecautions    = result.GetBoolean(6),
                                    TreatmentRecordMasterId = result.GetInt32(7),
                                    MarkComplete            = result.GetBoolean(8)
                                };
                            }
                        }
                        //Lab Values
                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.LabValues = new LabValuesVM
                                {
                                    Id = result.GetInt32(0),
                                    TreatmentRecordMasterId = result.GetInt32(1),
                                    Height       = result.GetDecimal(2),
                                    Weight       = result.GetDecimal(3),
                                    EBV          = result.GetDecimal(4),
                                    EPV          = result.GetDecimal(5),
                                    ECV10        = result.GetDecimal(6),
                                    ECV15        = result.GetDecimal(7),
                                    HGB          = result.GetDecimal(8),
                                    HTC          = result.GetDecimal(9),
                                    WBC          = result.GetDecimal(10),
                                    PLT          = result.GetDecimal(11),
                                    CreatedOn    = result.GetDateTime(12),
                                    LastUpdated  = result.GetDateTime(13),
                                    Deleted      = result.GetBoolean(14),
                                    MarkComplete = result.GetBoolean(15)
                                };
                            }
                        }
                        //Supplies and Access

                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.SuppliesVM = new SuppliesVM
                                {
                                    Id = result.GetInt32(0),
                                    TreatmentRecordId = result.GetInt32(1),
                                    ACDLot            = result.GetString(2),
                                    ACDLotExpDate     = result.GetDateTime(3),
                                    NSPrimeLot        = result.GetString(4),
                                    NSPrimeLotExpDate = result.GetDateTime(5),
                                    Rate          = result.GetString(6),
                                    BloodWarmer   = result.GetBoolean(7),
                                    ACEInhibitors = result.GetBoolean(8),
                                    MedsReviewed  = result.GetBoolean(9),
                                    TEMP          = result.GetDecimal(10),
                                    Serial        = result.GetString(11),
                                    LastDoseDate  = result.GetDateTime(12),
                                    DateDC        = result.GetDateTime(13),
                                    CVC           = result.GetBoolean(14),
                                    Type          = result.GetString(15),
                                    Peripheral    = result.GetBoolean(16),
                                    Vortex        = result.GetBoolean(17),
                                    Locations     = result.GetString(18),
                                    Comments      = result.GetString(19),
                                    CreatedOn     = result.GetDateTime(20),
                                    LastUpdated   = result.GetDateTime(21),
                                    Deleted       = result.GetBoolean(22),
                                    MarkComplete  = result.GetBoolean(23)
                                };
                            }
                        }
                        //Pre Treatment Assessment

                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.PreTreatmentAssessment = new PreTreatmentAssessmentVM
                                {
                                    Id                      = result.GetInt32(0),
                                    IsAlert                 = result.GetBoolean(1),
                                    IsLethargic             = result.GetBoolean(2),
                                    IsComatose              = result.GetBoolean(3),
                                    OrientedX               = result.GetString(4),
                                    IsWeakness              = result.GetBoolean(5),
                                    WeaknessAutoTextId      = result.GetInt32(6),
                                    IsNumbness              = result.GetBoolean(7),
                                    NumbnessAutoTextId      = result.GetInt32(8),
                                    PainAutoTextId          = result.GetInt32(9),
                                    LocationAutoTextId      = result.GetInt32(10),
                                    IsEasy                  = result.GetBoolean(11),
                                    IsLabored               = result.GetBoolean(12),
                                    OSat                    = result.GetString(13),
                                    IsNC                    = result.GetBoolean(14),
                                    IsRoomAir               = result.GetBoolean(15),
                                    IsMask                  = result.GetBoolean(16),
                                    IsVent                  = result.GetBoolean(17),
                                    IsFiO2                  = result.GetBoolean(18),
                                    LungSoundsAutoTextId    = result.GetInt32(19),
                                    RythmAutoTextId         = result.GetInt32(20),
                                    IsEdema                 = result.GetBoolean(21),
                                    EdemaAutoTextId         = result.GetInt32(22),
                                    IsBleeding              = result.GetBoolean(23),
                                    BleendAutoTextId        = result.GetInt32(24),
                                    SkinAutoTextId          = result.GetInt32(25),
                                    TreatmentRecordMasterId = result.GetInt32(26),
                                    IsDeleted               = result.GetBoolean(27),
                                    CreatedOn               = result.GetDateTime(28),
                                    LastUpdated             = result.GetDateTime(29),
                                    MarkComplete            = result.GetBoolean(30),
                                    WaeknessAutoTextName    = result.GetString(31),
                                    NumbnessAutoTexName     = result.GetString(32),
                                    PainAutoTextName        = result.GetString(33),
                                    LocationAutoTextName    = result.GetString(34),
                                    LungSoundsAutoTextName  = result.GetString(35),
                                    RythmAutoTextName       = result.GetString(36),
                                    EdemaAutoTextName       = result.GetString(37),
                                    BleendAutoTextName      = result.GetString(38),
                                    SkinAutoTextName        = result.GetString(39),
                                };
                            }
                        }
                        //Final Values
                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.FinalValuesVM = new FinalValuesVM
                                {
                                    Id                      = result.GetInt32(0),
                                    Time                    = result.GetInt32(1),
                                    AC                      = result.GetInt32(2),
                                    Inlet                   = result.GetInt32(3),
                                    Plasma                  = result.GetInt32(4),
                                    Collet                  = result.GetInt32(5),
                                    FluidBalance            = result.GetString(6),
                                    BP                      = result.GetString(7),
                                    T                       = result.GetInt32(8),
                                    P                       = result.GetInt32(9),
                                    R                       = result.GetInt32(10),
                                    TreatmentRecordId       = result.GetInt32(11),
                                    NewDressing             = result.GetBoolean(12),
                                    Reinforced              = result.GetBoolean(13),
                                    Intact                  = result.GetBoolean(14),
                                    Saline                  = result.GetBoolean(15),
                                    Heparin                 = result.GetBoolean(16),
                                    ChlorhexidineCapApplied = result.GetBoolean(17),
                                    Comments                = result.GetString(18),
                                    CreatedOn               = result.GetDateTime(19),
                                    LastUpdated             = result.GetDateTime(20),
                                    Deleted                 = result.GetBoolean(21),
                                    MarkComplete            = result.GetBoolean(22)
                                };
                            }
                        }
                        //Post Treatment
                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.PostTreatmentVM = new PostTreatmentVM
                                {
                                    Id = result.GetInt32(0),
                                    IsRinseBackComplete              = result.GetBoolean(1),
                                    IsPostCVCCarePerPolicy           = result.GetBoolean(2),
                                    IsEquipmentCleanedAndDisinfected = result.GetBoolean(3),

                                    IsBiohazardWasteDisposed = result.GetBoolean(4),
                                    IsSideRailsUp            = result.GetBoolean(5),
                                    TreatmentRecordId        = result.GetInt32(6),
                                    MarkComplete             = result.GetBoolean(7)
                                };
                            }
                        }
                        //Note and Report

                        if (result.NextResult())
                        {
                            while (result.Read())
                            {
                                dd.NoteAndReportVM = new NoteAndReportVM
                                {
                                    Id = result.GetInt32(0),
                                    TreatmentRecordMasterId = result.GetInt32(1),
                                    Note          = result.GetString(2),
                                    ReportGivenTo = result.GetString(3),

                                    CreatedOn   = result.GetDateTime(4),
                                    LastUpdated = result.GetDateTime(5),
                                    Deleted     = result.GetBoolean(6),
                                    IsTreatmentCompletedWOIncident = result.GetBoolean(7),
                                    MarkComplete = result.GetBoolean(8)
                                };
                            }
                        }
                    }
                }


                return(dd);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }