Exemplo n.º 1
0
        private MED_OPERATION_SCHEDULE setOperationSubmit(string sql_GetMaxOperationNo, MED_OPERATION_SCHEDULE item)
        {
            MED_OPERATION_SCHEDULE dbSCHEDULE = dapper.Set <MED_OPERATION_SCHEDULE>().Single(item); //判断收到已经提交

            if (dbSCHEDULE.OPER_STATUS_CODE == 1)                                                   //实时判断,没提交才能判断
            {
                #region 获取MED_OPERATION_SCHEDULE_NAME表数据
                List <MED_OPERATION_SCHEDULE_NAME> scheduleNameItemList = dapper.Set <MED_OPERATION_SCHEDULE_NAME>().Select(d => d.PATIENT_ID == item.PATIENT_ID && d.VISIT_ID == item.VISIT_ID && d.SCHEDULE_ID == item.SCHEDULE_ID).OrderBy(d => d.OPER_NO).ToList <MED_OPERATION_SCHEDULE_NAME>();
                #endregion
                int    OperationNo       = GetMaxOperationNo(sql_GetMaxOperationNo, item);
                string tempOperationName = string.Empty;
                #region 向MED_OPERATION_NAME表插入数据
                List <MED_OPERATION_NAME> operNameItemList = new List <MED_OPERATION_NAME>();
                foreach (MED_OPERATION_SCHEDULE_NAME scheduleNameItem in scheduleNameItemList)
                {
                    MED_OPERATION_NAME operNameItem = new MED_OPERATION_NAME();
                    operNameItem.PATIENT_ID = scheduleNameItem.PATIENT_ID;
                    operNameItem.VISIT_ID   = scheduleNameItem.VISIT_ID;
                    operNameItem.OPER_ID    = item.OPER_ID;
                    operNameItem.OPER_NO    = ++OperationNo;
                    operNameItem.OPER_NAME  = scheduleNameItem.OPER_NAME;
                    operNameItem.OPER_CODE  = scheduleNameItem.OPER_CODE;
                    operNameItem.OPER_SCALE = scheduleNameItem.OPER_SCALE;
                    operNameItem.WOUND_TYPE = scheduleNameItem.WOUND_TYPE;
                    operNameItem.RESERVED1  = scheduleNameItem.RESERVED1;
                    operNameItem.RESERVED2  = scheduleNameItem.RESERVED2;
                    operNameItem.RESERVED3  = scheduleNameItem.RESERVED3;
                    operNameItem.RESERVED4  = scheduleNameItem.RESERVED4;
                    operNameItemList.Add(operNameItem);
                    tempOperationName += "," + scheduleNameItem.RESERVED2 + scheduleNameItem.OPER_NAME;
                }
                dapper.Set <MED_OPERATION_NAME>().Insert(operNameItemList);
                #endregion
                tempOperationName = tempOperationName.TrimStart(',');
                #region 向MED_OPERATION_MASTER表插入数据
                MED_OPERATION_MASTER masterITEM = new MED_OPERATION_MASTER
                {
                    PATIENT_ID            = item.PATIENT_ID,
                    VISIT_ID              = item.VISIT_ID,
                    OPER_ID               = Convert.ToInt32(item.OPER_ID),
                    HOSP_BRANCH           = item.HOSP_BRANCH,
                    WARD_CODE             = item.WARD_CODE,
                    DEPT_CODE             = item.DEPT_CODE,
                    OPER_DEPT_CODE        = item.OPER_DEPT_CODE,
                    OPER_ROOM             = item.OPER_ROOM,
                    OPER_ROOM_NO          = item.OPER_ROOM_NO,
                    SEQUENCE              = item.SEQUENCE,
                    OPER_CLASS            = item.OPER_CLASS,
                    DIAG_BEFORE_OPERATION = item.DIAG_BEFORE_OPERATION,
                    DIAG_AFTER_OPERATION  = item.DIAG_BEFORE_OPERATION,
                    PATIENT_CONDITION     = item.PATIENT_CONDITION,
                    OPER_SCALE            = item.OPER_SCALE,
                    WOUND_TYPE            = item.WOUND_TYPE,
                    ASA_GRADE             = item.ASA_GRADE,
                    EMERGENCY_IND         = item.EMERGENCY_IND,
                    OPER_SOURCE           = item.OPER_SOURCE,
                    ISOLATION_IND         = item.ISOLATION_IND,
                    INFECTED_IND          = item.INFECTED_IND,
                    RADIATE_IND           = item.RADIATE_IND,
                    SURGEON               = item.SURGEON,
                    FIRST_OPER_ASSISTANT  = item.FIRST_OPER_ASSISTANT,
                    SECOND_OPER_ASSISTANT = item.SECOND_OPER_ASSISTANT,
                    THIRD_OPER_ASSISTANT  = item.THIRD_OPER_ASSISTANT,
                    FOURTH_OPER_ASSISTANT = item.FOURTH_OPER_ASSISTANT,
                    ANES_METHOD           = item.ANES_METHOD,
                    ANES_DOCTOR           = item.ANES_DOCTOR,
                    FIRST_ANES_ASSISTANT  = item.FIRST_ANES_ASSISTANT,
                    SECOND_ANES_ASSISTANT = item.SECOND_ANES_ASSISTANT,
                    THIRD_ANES_ASSISTANT  = item.THIRD_ANES_ASSISTANT,
                    FOURTH_ANES_ASSISTANT = item.FOURTH_ANES_ASSISTANT,
                    FIRST_ANES_NURSE      = item.FIRST_ANES_NURSE,
                    SECOND_ANES_NURSE     = item.SECOND_ANES_NURSE,
                    THIRD_ANES_NURSE      = item.THIRD_ANES_NURSE,
                    CPB_DOCTOR            = item.CPB_DOCTOR,
                    FIRST_CPB_ASSISTANT   = item.FIRST_CPB_ASSISTANT,
                    SECOND_CPB_ASSISTANT  = item.SECOND_CPB_ASSISTANT,
                    THIRD_CPB_ASSISTANT   = item.THIRD_CPB_ASSISTANT,
                    FOURTH_CPB_ASSISTANT  = item.FOURTH_CPB_ASSISTANT,
                    FIRST_OPER_NURSE      = item.FIRST_OPER_NURSE,
                    SECOND_OPER_NURSE     = item.SECOND_OPER_NURSE,
                    THIRD_OPER_NURSE      = item.THIRD_OPER_NURSE,
                    FOURTH_OPER_NURSE     = item.FOURTH_OPER_NURSE,
                    FIRST_SUPPLY_NURSE    = item.FIRST_SUPPLY_NURSE,
                    SECOND_SUPPLY_NURSE   = item.SECOND_SUPPLY_NURSE,
                    THIRD_SUPPLY_NURSE    = item.THIRD_SUPPLY_NURSE,
                    FOURTH_SUPPLY_NURSE   = item.FOURTH_SUPPLY_NURSE,
                    PACU_DOCTOR           = item.PACU_DOCTOR,
                    FIRST_PACU_ASSISTANT  = item.FIRST_PACU_ASSISTANT,
                    SECOND_PACU_ASSISTANT = item.SECOND_PACU_ASSISTANT,
                    FIRST_PACU_NURSE      = item.FIRST_PACU_NURSE,
                    SECOND_PACU_NURSE     = item.SECOND_PACU_NURSE,
                    REQ_DATE_TIME         = item.REQ_DATE_TIME,
                    SCHEDULED_DATE_TIME   = item.SCHEDULED_DATE_TIME,
                    OPER_POSITION         = item.OPER_POSITION,
                    BED_NO            = item.BED_NO,
                    OPERATION_NAME    = tempOperationName,
                    SPECIAL_EQUIPMENT = item.SPECIAL_EQUIPMENT,
                    SPECIAL_INFECT    = item.SPECIAL_INFECT,
                    OPER_STATUS_CODE  = item.OPER_STATUS_CODE,
                    HIS_PATIENT_ID    = item.HIS_PATIENT_ID,
                    HIS_VISIT_ID      = item.HIS_VISIT_ID,
                    HIS_SCHEDULE_ID   = item.HIS_SCHEDULE_ID,
                    HIS_OPER_STATUS   = item.HIS_OPER_STATUS,
                    MEMO = item.NOTES_ON_OPERATION
                };

                bool flag = dapper.Set <MED_OPERATION_MASTER>().Insert(masterITEM);
                #endregion
                item.OPERATION_NAME = tempOperationName;
                dapper.Set <MED_OPERATION_SCHEDULE>().Update(item, d => new { d.ANES_CONFIRM, d.NURSE_CONFIRM, d.OPER_STATUS_CODE, d.OPER_ID, d.OPERATION_NAME, d.ANES_DOCTOR });
                if (flag)
                {
                    //确认成功后,从visit表中往plan表中写入手术名称,身高体重数据
                    MED_ANESTHESIA_PLAN anesPlan = dapper.Set <MED_ANESTHESIA_PLAN>().Single(d => d.PATIENT_ID == masterITEM.PATIENT_ID && d.VISIT_ID == masterITEM.VISIT_ID && d.OPER_ID == masterITEM.OPER_ID);
                    if (anesPlan == null)
                    {
                        anesPlan            = new MED_ANESTHESIA_PLAN();
                        anesPlan.PATIENT_ID = masterITEM.PATIENT_ID;
                        anesPlan.VISIT_ID   = masterITEM.VISIT_ID;
                        anesPlan.OPER_ID    = masterITEM.OPER_ID;
                    }
                    if (!string.IsNullOrEmpty(masterITEM.OPERATION_NAME))
                    {
                        anesPlan.OPERATION_NAME = masterITEM.OPERATION_NAME;
                    }
                    dapper.Set <MED_ANESTHESIA_PLAN>().Save(anesPlan, d => d.PATIENT_ID == masterITEM.PATIENT_ID && d.VISIT_ID == masterITEM.VISIT_ID && d.OPER_ID == masterITEM.OPER_ID);

                    MED_ANESTHESIA_PLAN_PMH anesPlanPmh = dapper.Set <MED_ANESTHESIA_PLAN_PMH>().Single(d => d.PATIENT_ID == masterITEM.PATIENT_ID && d.VISIT_ID == masterITEM.VISIT_ID && d.OPER_ID == masterITEM.OPER_ID);
                    MED_PAT_VISIT           patVisit    = dapper.Set <MED_PAT_VISIT>().Single(d => d.PATIENT_ID == masterITEM.PATIENT_ID && d.VISIT_ID == masterITEM.VISIT_ID);
                    if (anesPlanPmh == null)
                    {
                        anesPlanPmh            = new MED_ANESTHESIA_PLAN_PMH();
                        anesPlanPmh.PATIENT_ID = masterITEM.PATIENT_ID;
                        anesPlanPmh.VISIT_ID   = masterITEM.VISIT_ID;
                        anesPlanPmh.OPER_ID    = masterITEM.OPER_ID;
                        if (patVisit != null)
                        {
                            anesPlanPmh.HEIGHT     = patVisit.BODY_HEIGHT.HasValue ? patVisit.BODY_HEIGHT.Value.ToString() : "";
                            anesPlanPmh.WEIGHT     = patVisit.BODY_WEIGHT.HasValue ? patVisit.BODY_WEIGHT.Value.ToString() : "";
                            anesPlanPmh.BLOOD_TYPE = patVisit.BLOOD_TYPE + " " + patVisit.BLOOD_TYPE_RH;
                        }
                    }
                    else
                    {
                        if (patVisit != null)
                        {
                            anesPlanPmh.HEIGHT     = patVisit.BODY_HEIGHT.HasValue ? patVisit.BODY_HEIGHT.Value.ToString() : "";;
                            anesPlanPmh.WEIGHT     = patVisit.BODY_WEIGHT.HasValue ? patVisit.BODY_WEIGHT.Value.ToString() : "";;
                            anesPlanPmh.BLOOD_TYPE = patVisit.BLOOD_TYPE + " " + patVisit.BLOOD_TYPE_RH;
                        }
                    }
                    dapper.Set <MED_ANESTHESIA_PLAN_PMH>().Save(anesPlanPmh, d => d.PATIENT_ID == anesPlanPmh.PATIENT_ID && d.VISIT_ID == anesPlanPmh.VISIT_ID && d.OPER_ID == anesPlanPmh.OPER_ID);
                    dapper.SaveChanges();
                    return(item);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        protected override void OnSaveData(Dictionary <string, DataTable> dataSource)//, ref bool bNeedMsg
        {
            foreach (MTextBox mtb in textBoxs)
            {
                if (string.IsNullOrEmpty(mtb.Text) && !string.IsNullOrEmpty(mtb.InputNeededMessage))
                {
                    MessageBoxFormPC.Show("*号为必填项目,请重新填写");
                    // bNeedMsg = false;
                    return;
                }
            }
            string patientID = BindControls("MED_PAT_MASTER_INDEX", "PATIENT_ID");

            if (operationMaster == null)
            {
                operationMaster = new MED_OPERATION_MASTER();
            }
            operationMaster.SetValue("PATIENT_ID", patientID);
            operationMaster.SetValue("VISIT_ID", visitID);
            operationMaster.SetValue("OPER_ID", operID);
            operationMaster.SetValue("OPER_ROOM", ExtendAppContext.CurntSelect.OperRoom);
            operationMaster.SetValue("HOSP_BRANCH", ExtendAppContext.CurntSelect.HospBranchCode);
            operationMaster.SetValue("EMERGENCY_IND", BindControls("MED_OPERATION_MASTER", "EMERGENCY_IND"));
            operationMaster.SetValue("DEPT_CODE", BindControls("MED_OPERATION_MASTER", "DEPT_CODE"));
            operationMaster.SetValue("BED_NO", BindControls("MED_OPERATION_MASTER", "BED_NO"));
            operationMaster.SetValue("SCHEDULED_DATE_TIME", BindControls("MED_OPERATION_MASTER", "SCHEDULED_DATE_TIME"));
            operationMaster.SetValue("OPER_ROOM_NO", BindControls("MED_OPERATION_MASTER", "OPER_ROOM_NO"));
            operationMaster.SetValue("SEQUENCE", BindControls("MED_OPERATION_MASTER", "SEQUENCE"));
            operationMaster.SetValue("ANES_DOCTOR", BindControls("MED_OPERATION_MASTER", "ANES_DOCTOR"));
            operationMaster.SetValue("DIAG_BEFORE_OPERATION", BindControls("MED_OPERATION_MASTER", "DIAG_BEFORE_OPERATION"));
            operationMaster.SetValue("OPERATION_NAME", BindControls("MED_OPERATION_MASTER", "OPERATION_NAME"));
            operationMaster.SetValue("OPER_STATUS_CODE", 2);

            if (currentOperSchedule != null)
            {
                currentOperSchedule.SetValue("OPER_STATUS_CODE", 2);
            }

            if (patVisit == null)
            {
                patVisit = new MED_PAT_VISIT();
            }
            patVisit.SetValue("PATIENT_ID", patientID);
            patVisit.SetValue("VISIT_ID", visitID);
            patVisit.SetValue("INP_NO", BindControls("MED_PATS_IN_HOSPITAL", "INP_NO"));

            if (patMasterIndex == null)
            {
                patMasterIndex = new MED_PAT_MASTER_INDEX();
            }
            patMasterIndex.SetValue("PATIENT_ID", patientID);
            patMasterIndex.SetValue("NAME", BindControls("MED_PAT_MASTER_INDEX", "NAME"));
            patMasterIndex.SetValue("SEX", BindControls("MED_PAT_MASTER_INDEX", "SEX"));
            patMasterIndex.SetValue("DATE_OF_BIRTH", BindControls("MED_PAT_MASTER_INDEX", "DATE_OF_BIRTH"));

            string strOperName = BindControls("MED_OPERATION_MASTER", "OPER_NAME");

            if (!string.IsNullOrEmpty(strOperName))
            {
                string[] operNameArr = strOperName.Split('+');
                for (int i = 0; i < operNameArr.Length; i++)
                {
                    MED_OPERATION_NAME operName = new MED_OPERATION_NAME();
                    operName.SetValue("PATIENT_ID", operationMaster.PATIENT_ID);
                    operName.SetValue("VISIT_ID", operationMaster.VISIT_ID);
                    operName.SetValue("OPER_ID", operationMaster.OPER_ID);
                    operName.SetValue("OPER_NO", i + 1);
                    operName.SetValue("OPER_NAME", operNameArr[i].ToString());
                    operNameNewList.Add(operName);
                }
            }

            MED_ANESTHESIA_PLAN      anesPlan     = OperationInfoService.GetAnesPlan(patientID, visitID, operID);
            MED_ANESTHESIA_PLAN_PMH  anesPlanPmh  = OperationInfoService.GetAnesPlanPmh(patientID, visitID, operID);
            MED_ANESTHESIA_PLAN_EXAM anesPlanExam = OperationInfoService.GetAnesPlanExam(patientID, visitID, operID);

            if (anesPlan == null)
            {
                anesPlan = new MED_ANESTHESIA_PLAN();
                anesPlan.SetValue("PATIENT_ID", patientID);
                anesPlan.SetValue("VISIT_ID", visitID);
                anesPlan.SetValue("OPER_ID", operID);
            }
            if (anesPlanPmh == null)
            {
                anesPlanPmh = new MED_ANESTHESIA_PLAN_PMH();
                anesPlanPmh.SetValue("PATIENT_ID", patientID);
                anesPlanPmh.SetValue("VISIT_ID", visitID);
                anesPlanPmh.SetValue("OPER_ID", operID);
            }
            if (anesPlanExam == null)
            {
                anesPlanExam = new MED_ANESTHESIA_PLAN_EXAM();
                anesPlanExam.SetValue("PATIENT_ID", patientID);
                anesPlanExam.SetValue("VISIT_ID", visitID);
                anesPlanExam.SetValue("OPER_ID", operID);
            }
            OperationInfoService.SavePatientOperation(currentOperSchedule, patVisit, patMasterIndex, null, operNameNewList, operationMaster, anesPlan, anesPlanPmh, anesPlanExam, null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存患者信息
        /// </summary>
        protected override SaveResult SaveData()
        {
            bool result = true;

            if (_masterRow != null && _anesthesiaPlanRow != null)
            {
                _masterRow.OPER_ROOM_NO          = OPER_ROOM_NO;
                _masterRow.SEQUENCE              = SEQUENCE;
                _masterRow.BED_NO                = BED_NO;
                _masterRow.DEPT_CODE             = DEPT_CODE;
                _masterRow.DIAG_BEFORE_OPERATION = DIAG_BEFORE_OPERATION;
                // 手术名称(新分隔符)
                string operName = string.Empty;
                if (OPERATION_NAME != null)
                {
                    foreach (string operDict in OPERATION_NAME)
                    {
                        operName += operDict + CommonSplit;
                    }
                }
                if (operName.Length > 0)
                {
                    operName = operName.Substring(0, operName.Length - CommonSplit.Length);
                }
                _masterRow.OPERATION_NAME = operName;

                _masterRow.OPER_SCALE        = OPER_SCALE;
                _masterRow.OPER_POSITION     = OPER_POSITION;
                _masterRow.EMERGENCY_IND     = EMERGENCY_IND;
                _masterRow.ISOLATION_IND     = ISOLATION_IND;
                _masterRow.RADIATE_IND       = RADIATE_IND;
                _masterRow.PATIENT_CONDITION = PATIENT_CONDITION;
                // 麻醉方法多选处理
                //string anesMethod = string.Empty;
                //if (ANES_METHOD != null)
                //{
                //    foreach (string item in ANES_METHOD)
                //    {
                //        anesMethod += item + CommonSplit;
                //    }
                //}
                //if (anesMethod.Length > 0)
                //{
                //    anesMethod = anesMethod.Substring(0, anesMethod.Length - CommonSplit.Length);
                //}
                //_masterRow.ANES_METHOD = anesMethod;

                _masterRow.ANES_METHOD = ANES_METHOD_NAME;

                _masterRow.ANAESTHESIA_TYPE = ANAESTHESIA_TYPE;

                #region 人员保存特殊处理
                if (SURGEON == null && SURGEON_NAME != null)
                {
                    SURGEON = SURGEON_NAME;
                }
                _masterRow.SURGEON = SURGEON;
                if (FIRST_OPER_ASSISTANT == null && FIRST_OPER_ASSISTANT_NAME != null)
                {
                    FIRST_OPER_ASSISTANT = FIRST_OPER_ASSISTANT_NAME;
                }
                _masterRow.FIRST_OPER_ASSISTANT = FIRST_OPER_ASSISTANT;
                if (SECOND_OPER_ASSISTANT == null && SECOND_OPER_ASSISTANT_NAME != null)
                {
                    SECOND_OPER_ASSISTANT = SECOND_OPER_ASSISTANT_NAME;
                }
                _masterRow.SECOND_OPER_ASSISTANT = SECOND_OPER_ASSISTANT;
                if (CPB_DOCTOR == null && CPB_DOCTOR_NAME != null)
                {
                    CPB_DOCTOR = CPB_DOCTOR_NAME;
                }
                _masterRow.CPB_DOCTOR = CPB_DOCTOR;
                if (FIRST_CPB_ASSISTANT == null && FIRST_CPB_ASSISTANT_NAME != null)
                {
                    FIRST_CPB_ASSISTANT = FIRST_CPB_ASSISTANT_NAME;
                }
                _masterRow.FIRST_CPB_ASSISTANT = FIRST_CPB_ASSISTANT;
                if (FIRST_OPER_NURSE == null && FIRST_OPER_NURSE_NAME != null)
                {
                    FIRST_OPER_NURSE = FIRST_OPER_NURSE_NAME;
                }
                _masterRow.FIRST_OPER_NURSE = FIRST_OPER_NURSE;
                if (SECOND_OPER_NURSE == null && SECOND_OPER_NURSE_NAME != null)
                {
                    SECOND_OPER_NURSE = SECOND_OPER_NURSE_NAME;
                }
                _masterRow.SECOND_OPER_NURSE = SECOND_OPER_NURSE;
                if (FIRST_SUPPLY_NURSE == null && FIRST_SUPPLY_NURSE_NAME != null)
                {
                    FIRST_SUPPLY_NURSE = FIRST_SUPPLY_NURSE_NAME;
                }
                _masterRow.FIRST_SUPPLY_NURSE = FIRST_SUPPLY_NURSE;
                if (SECOND_SUPPLY_NURSE == null && SECOND_SUPPLY_NURSE_NAME != null)
                {
                    SECOND_SUPPLY_NURSE = SECOND_SUPPLY_NURSE_NAME;
                }
                _masterRow.SECOND_SUPPLY_NURSE = SECOND_SUPPLY_NURSE;
                if (ANES_DOCTOR == null && ANES_DOCTOR_NAME != null)
                {
                    ANES_DOCTOR = ANES_DOCTOR_NAME;
                }
                _masterRow.ANES_DOCTOR = ANES_DOCTOR;
                if (FIRST_ANES_ASSISTANT == null && FIRST_ANES_ASSISTANT_NAME != null)
                {
                    FIRST_ANES_ASSISTANT = FIRST_ANES_ASSISTANT_NAME;
                }
                _masterRow.FIRST_ANES_ASSISTANT = FIRST_ANES_ASSISTANT;
                if (SECOND_ANES_ASSISTANT == null && SECOND_ANES_ASSISTANT_NAME != null)
                {
                    SECOND_ANES_ASSISTANT = SECOND_ANES_ASSISTANT_NAME;
                }
                _masterRow.SECOND_ANES_ASSISTANT = SECOND_ANES_ASSISTANT;
                if (THIRD_ANES_ASSISTANT == null && THIRD_ANES_ASSISTANT_NAME != null)
                {
                    THIRD_ANES_ASSISTANT = THIRD_ANES_ASSISTANT_NAME;
                }
                _masterRow.THIRD_ANES_ASSISTANT = THIRD_ANES_ASSISTANT;
                #endregion

                _masterRow.ASA_GRADE        = ASA_GRADE;
                _masterRow.WOUND_TYPE       = WOUND_TYPE;
                _masterRow.MINIMAL_INVASIVE = this.MINIMAL_INVASIVE;
                _masterRow.LOCAL_ANESTHESIA = this.LOCAL_ANESTHESIA;
                // 局麻手术
                if (this.isAfterOperInfo)
                {
                    if (1 == this.LOCAL_ANESTHESIA)
                    {
                        _masterRow.IN_DATE_TIME     = this.IN_DATE_TIME;
                        _masterRow.START_DATE_TIME  = this.START_DATE_TIME;
                        _masterRow.END_DATE_TIME    = this.END_DATE_TIME;
                        _masterRow.OUT_DATE_TIME    = this.OUT_DATE_TIME;
                        _masterRow.OPER_STATUS_CODE = 35;
                    }
                    else
                    {
                        _masterRow.IN_DATE_TIME     = null;
                        _masterRow.START_DATE_TIME  = null;
                        _masterRow.END_DATE_TIME    = null;
                        _masterRow.OUT_DATE_TIME    = null;
                        _masterRow.OPER_STATUS_CODE = 0;
                    }
                }

                TransactionParamsters tp = TransactionParamsters.Create();
                tp.Append(_masterRow);

                List <MED_OPERATION_NAME> listOperationName = new List <MED_OPERATION_NAME>();
                int operNo = 1;
                foreach (var item in OPERATION_NAME)
                {
                    MED_OPERATION_NAME operationName = new MED_OPERATION_NAME();
                    operationName.PATIENT_ID = _masterRow.PATIENT_ID;
                    operationName.VISIT_ID   = _masterRow.VISIT_ID;
                    operationName.OPER_ID    = _masterRow.OPER_ID;
                    operationName.OPER_NO    = operNo++;
                    operationName.OPER_NAME  = item;
                    listOperationName.Add(operationName);
                }
                tp.Append(listOperationName);
                _anesthesiaPlanRow.OPER_ID           = _anesthesiaPlanRow.OPER_ID;
                _anesthesiaPlanRow.RETURN_TO_SURGERY = RETURN_TO_SURGERY;
                _anesthesiaPlanRow.PLAN_WHEREABORTS  = PLAN_WHEREABORTS;
                tp.Append(_anesthesiaPlanRow);
                result = CommonService.ClientInstance.UpdateByTransaction(tp.ToString());
            }
            if (result)
            {
                saveResult = SaveResult.Success;
            }

            return(saveResult);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存手术室外麻醉
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int SaveOutOperatingRoomAnesRecordData(OutOperatingRoomAnesRecordEntity model)
        {
            if (model == null)
            {
                return(0);
            }

            try
            {
                if (string.IsNullOrEmpty(model.PATIENT_ID))
                {
                    model.PATIENT_ID = model.INP_NO;
                }
                //获取master主表是否有改挑手术
                MED_OPERATION_MASTER operationMaster = dapper.Set <MED_OPERATION_MASTER>().Single(
                    x => x.PATIENT_ID == model.PATIENT_ID && x.VISIT_ID == model.VISIT_ID && x.OPER_ID == model.OPER_ID);

                int result = 0;
                if (operationMaster != null)
                {
                    operationMaster.DEPT_CODE             = model.DEPT_CODE;
                    operationMaster.DIAG_BEFORE_OPERATION = model.DIAG_BEFORE_OPERATION;
                    operationMaster.OPERATION_NAME        = model.OPERATION_NAME;
                    operationMaster.ANES_METHOD           = model.ANES_METHOD;
                    operationMaster.ANES_DOCTOR           = model.ANES_DOCTOR;
                    operationMaster.FIRST_ANES_ASSISTANT  = model.FIRST_ANES_ASSISTANT;
                    operationMaster.FIRST_OPER_NURSE      = model.FIRST_OPER_NURSE;
                    operationMaster.SECOND_OPER_NURSE     = model.SECOND_OPER_NURSE;
                    operationMaster.ASA_GRADE             = model.ASA_GRADE;
                    operationMaster.EMERGENCY_IND         = Convert.ToInt32(model.EMERGENCY_IND);
                    operationMaster.IN_DATE_TIME          = model.IN_DATE_TIME;
                    operationMaster.START_DATE_TIME       = model.START_DATE_TIME;
                    operationMaster.END_DATE_TIME         = model.END_DATE_TIME;
                    operationMaster.OUT_DATE_TIME         = model.OUT_DATE_TIME;
                    operationMaster.LOCAL_ANESTHESIA      = 1;
                    operationMaster.OPER_STATUS_CODE      = 35;
                    operationMaster.OPER_ROOM             = model.OPER_ROOM;
                    operationMaster.OPER_ROOM_NO          = model.OPER_ROOM_NO;
                    operationMaster.OPER_SCALE            = model.OPER_SCALE;
                    operationMaster.SURGEON = model.SURGEON;
                    operationMaster.FIRST_OPER_ASSISTANT = model.FIRST_OPER_ASSISTANT;
                    result = dapper.Set <MED_OPERATION_MASTER>().Update(operationMaster) > 0 ? 1 : 0;
                }
                else
                {
                    MED_OPERATION_MASTER newModel = new MED_OPERATION_MASTER();
                    newModel.PATIENT_ID            = model.PATIENT_ID;
                    newModel.VISIT_ID              = model.VISIT_ID;
                    newModel.OPER_ID               = model.OPER_ID;
                    newModel.DEPT_CODE             = model.DEPT_CODE;
                    newModel.DIAG_BEFORE_OPERATION = model.DIAG_BEFORE_OPERATION;
                    newModel.OPERATION_NAME        = model.OPERATION_NAME;

                    newModel.ANES_METHOD          = model.ANES_METHOD;
                    newModel.ANES_DOCTOR          = model.ANES_DOCTOR;
                    newModel.FIRST_ANES_ASSISTANT = model.FIRST_ANES_ASSISTANT;
                    newModel.FIRST_OPER_NURSE     = model.FIRST_OPER_NURSE;
                    newModel.SECOND_OPER_NURSE    = model.SECOND_OPER_NURSE;
                    newModel.ASA_GRADE            = model.ASA_GRADE;
                    newModel.EMERGENCY_IND        = Convert.ToInt32(model.EMERGENCY_IND);
                    newModel.IN_DATE_TIME         = model.IN_DATE_TIME;
                    newModel.SCHEDULED_DATE_TIME  = model.SCHEDULED_DATE_TIME;
                    newModel.START_DATE_TIME      = model.START_DATE_TIME;
                    newModel.END_DATE_TIME        = model.END_DATE_TIME;
                    newModel.OUT_DATE_TIME        = model.OUT_DATE_TIME;
                    newModel.LOCAL_ANESTHESIA     = 1;
                    newModel.OPER_STATUS_CODE     = 35;
                    newModel.OPER_ROOM            = model.OPER_ROOM;
                    newModel.OPER_ROOM_NO         = model.OPER_ROOM_NO;
                    newModel.OPER_SCALE           = model.OPER_SCALE;
                    newModel.SURGEON = model.SURGEON;
                    newModel.FIRST_OPER_ASSISTANT = model.FIRST_OPER_ASSISTANT;
                    result = dapper.Set <MED_OPERATION_MASTER>().Insert(newModel) == true ? 1 : 0;
                }

                //手术名称表(先删再增)
                //删除模版
                dapper.Set <MED_OPERATION_NAME>().Delete(d => d.PATIENT_ID == model.PATIENT_ID && d.VISIT_ID == model.VISIT_ID &&
                                                         d.OPER_ID == model.OPER_ID);

                if (!string.IsNullOrEmpty(model.OPERATION_NAME))
                {
                    string[] operNames = model.OPERATION_NAME.Split('+');
                    for (int i = 1; i <= operNames.Length; i++)
                    {
                        MED_OPERATION_NAME operNameModel = new MED_OPERATION_NAME();
                        operNameModel.PATIENT_ID = model.PATIENT_ID;
                        operNameModel.VISIT_ID   = model.VISIT_ID;
                        operNameModel.OPER_ID    = model.OPER_ID;
                        operNameModel.OPER_NO    = i;
                        operNameModel.OPER_NAME  = operNames[i - 1];
                        dapper.Set <MED_OPERATION_NAME>().Insert(operNameModel);
                    }
                }

                //室外麻醉手术在输入出手术室时间点击保存后,需要把对应的schedule表状态改为4,
                string OPER_STATUS_CODE = ""
                ; MED_OPERATION_SCHEDULE scheduleModel = dapper.Set <MED_OPERATION_SCHEDULE>().Single(
                    x => x.PATIENT_ID == model.PATIENT_ID && x.VISIT_ID == model.VISIT_ID && x.OPER_ID == model.OPER_ID);
                if (scheduleModel != null)
                {
                    OPER_STATUS_CODE = scheduleModel.OPER_STATUS_CODE.ToString();
                    scheduleModel.OPER_STATUS_CODE = 4;
                    scheduleModel.ModelStatus      = ModelStatus.Modeified;
                    dapper.Set <MED_OPERATION_SCHEDULE>().Update(scheduleModel);
                }


                //修改扩展 体重
                MED_ANESTHESIA_PLAN_PMH phmModel = dapper.Set <MED_ANESTHESIA_PLAN_PMH>().Single(
                    x => x.PATIENT_ID == model.PATIENT_ID && x.VISIT_ID == model.VISIT_ID && x.OPER_ID == model.OPER_ID);
                if (phmModel != null)
                {
                    phmModel.WEIGHT = model.WEIGHT;
                    dapper.Set <MED_ANESTHESIA_PLAN_PMH>().Update(phmModel);
                }
                else
                {
                    phmModel            = new MED_ANESTHESIA_PLAN_PMH();
                    phmModel.PATIENT_ID = model.PATIENT_ID;
                    phmModel.VISIT_ID   = model.VISIT_ID;
                    phmModel.OPER_ID    = model.OPER_ID;
                    phmModel.WEIGHT     = model.WEIGHT;
                    dapper.Set <MED_ANESTHESIA_PLAN_PMH>().Save(phmModel);
                }
                dapper.SaveChanges();

                //调用HISHIS203回写手术主表信息
                //if (OPER_STATUS_CODE != "4")  //回写之后不再回写
                //{
                //    if (SyncHIS203(model.PATIENT_ID, model.VISIT_ID,model.OPER_ID) != "")
                //    {
                //        return 2;
                //    }
                //}
            }
            catch (Exception ex)
            {
                return(0);
            }
            return(1);
        }