//获取病历信息
        public void GetPatientRecordInfo(string TaskCode, string WorkID, out M_PatientRecord info, out M_PatientRecordAppend pra, out M_PatientRecordCPR prCPR)
        {
            M_PatientRecordBLL prBLL = new M_PatientRecordBLL();
            M_AttemperData result = prBLL.GetAttemperData(TaskCode,"");//根据任务编码获取调度信息

            info = new M_PatientRecord();//病历主表信息
            info.TaskCode = TaskCode;
            info.PatientOrder = 1;
            info.CallOrder = result.CallOrder;
            info.Name = result.Name;
            info.Sex = result.Sex;
            info.AgeType = "岁";
            info.ForHelpTelephone = result.ForHelpPhone;
            info.ContactTelephone = result.ContactTelephone;
            info.PatientVersion = result.AlarmType;
            info.OriginalTaskType = result.AlarmType;
            info.ForArea = result.Area;
            info.LocalAddress = result.LocalAddress;
            info.OutStationCode = result.StationCode;
            info.Station = result.Station;
            info.SendAddress = result.SendAddress;
            info.DrivingTime = result.DrivingTime;
            info.ArriveSceneTime = result.ArriveSceneTime;
            info.LeaveSceneTime = result.LeaveSceneTime;
            info.ArriveDestinationTime = result.ArriveDestinationTime;
            info.Driver = result.Driver;
            info.StretcherBearersI = result.StretcherBearers;
            info.DoctorAndNurse = result.Doctor + result.Nurse;
            P_UserBLL bll = new P_UserBLL();
            P_User user = bll.GetListBy(u => u.WorkCode == WorkID).Select(u => u.ToExtModle()).FirstOrDefault(); //查找用户名 密码
            info.AgentCode = user.ID.ToString();
            info.AgentWorkID = WorkID;
            info.AgentName = user.Name;
            info.BeginFillPatientTime = DateTime.Now;
            info.MedicalRecordGenerationTime = DateTime.Now;
            info.FormCompleteLogo = false;
            //obj.FormCompleteTime = null;
            info.ChargeOrder = 0;
            info.SubCenterIFSpotChecks = false;
            info.CenterIFSpotChecks = false;
            info.SubmitLogo = false;
            info.SubmitTime = null;
            info.MedicalStateCode = 0;
            info.LastUpdatePerson = user.Name;//填写病历的人员
            info.LastUpdateTime = DateTime.Now;
            info.CPRIFSuccess = "";//心肺复苏选择
            info.IFRefuseTreatment = "治疗记录";//是否拒绝治疗(救治记录)
            info.RescueType = "";//抢救类型(救治记录)
            info.IMEI = "PAD";//从PAD填写

            pra = new M_PatientRecordAppend();//
            pra.TaskCode = TaskCode;
            pra.PatientOrder = 1;

            prCPR = new M_PatientRecordCPR();//
            prCPR.TaskCode = TaskCode;
            prCPR.PatientOrder = 1;
            prCPR.CenterIFAuditForXFFS = false;
        }
Exemplo n.º 2
0
        public bool PADAddPatientRecord(string TaskCode, int PatientOrder, string EvenType, string TaskOrder, M_PatientRecord pr, M_PatientRecordAppend pra, string WorkCode, string PersonName, ref string errorMsg)
        {
            try
            {
                if (pr == null)
                    pr = new M_PatientRecord();
                if (pra == null)
                    pra = new M_PatientRecordAppend();

                if (TaskCode == "")
                {
                    TaskCode = m_DAL.GetTaskCodeByTaskOrder(TaskOrder);
                }
                if (TaskCode=="")
                {
                    errorMsg = "任务流水号错误!未在任务中找到该流水号。";
                    return false;
                }
                pr.TaskCode = TaskCode;
                pr.PatientOrder = PatientOrder;
                pr.AgentWorkID = WorkCode;
                pr.AgentName = PersonName;
                pr.PatientVersion = EvenType;
                pra.TaskCode = TaskCode;
                pra.PatientOrder = PatientOrder;
                object objpr = null;
                M_PatientRecordAppend mpra = null;
                M_PatientRecordCPR mprCPR = new M_PatientRecordCPR();;
                M_PatientRecord mpr = null;
                mprCPR.TaskCode = TaskCode;
                mprCPR.PatientOrder = PatientOrder;
                mprCPR.CenterIFAuditForXFFS = false;
                pr.MedicalRecordGenerationTime = DateTime.Now;
                pr.IMEI = "PAD";
                m_DAL.GetPatientInfo(TaskCode, PatientOrder, out objpr, out mpra);
                if (objpr != null)
                {
                    mpr = (M_PatientRecord)objpr;
                    ReflectionUtility.UpdateObjectProperty(mpr, pr);
                    ReflectionUtility.UpdateObjectProperty(mpra, pra);
                    m_DAL.Update(pr, pra);
                }
                else
                {
                    string HJTel = "";
                    string Area = "";
                    string EventType = "";
                    new MobileTaskDAL().GetMobileTaskInfo(TaskCode, out HJTel, out Area, out EventType);
                    pr.ForHelpTelephone = HJTel;
                    pr.OriginalTaskType = EventType;
                    pr.ForArea = Area;
                    pr.MedicalStateCode = 0;
                    pr.FormCompleteLogo = false;
                    pr.SubmitLogo = false;
                    pr.SubCenterIFSpotChecks = false;
                    pr.CenterIFSpotChecks = false;
                    pr.LastUpdatePerson = PersonName;
                    pr.LastUpdateTime = DateTime.Now;
                    m_DAL.Insert(pr, pra, mprCPR, null, null);
                }
                return true;
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return false;
            }
        }
Exemplo n.º 3
0
        public bool SaveAuditCPR()
        {
            M_PatientRecordBLL bll = new M_PatientRecordBLL();

            string AuditCPR = Request.Form["AuditCPR"].ToString();
            M_PatientRecordCPR info = new M_PatientRecordCPR();
            info = JsonHelper.GetJsonInfoBy<M_PatientRecordCPR>(AuditCPR);

            bool save = false;
            if (info != null)
            {
                try
                {
                    save = bll.UpdateAuditCPR(info);//修改病历审核
                }
                catch
                {
                    save = false;
                }
            }
            return save;
        }
Exemplo n.º 4
0
        private static object m_SyncRoot = new Object(); //互斥对象

        #endregion Fields

        #region Methods

        /// <summary>
        /// 病历页面初始化
        /// </summary>
        /// <param name="TaskCode">任务编码</param>
        /// <param name="PatientOrder">序号</param>
        /// <param name="state">填写状态</param>
        /// <returns></returns>
        public ActionResult AddPatientRecord(string TaskCode, int PatientOrder, string state)
        {
            //, int PatientOrder//测试
            M_PatientRecordBLL prBLL = new M_PatientRecordBLL();
            M_DictionaryBLL dBLL = new M_DictionaryBLL();
            //int PatientOrder = 1;//测试

            M_AttemperData result = prBLL.GetAttemperData(TaskCode, state);//根据任务编码获取调度信息
            ViewBag.Attemper = result;

            ViewData["TaskCode"] = TaskCode == null ? "2012102023555200020101" : TaskCode;
            M_PatientRecord prInfo;//病历主表信息
            M_PatientRecordAppend pra;//病历附表--体检等信息
            M_PatientRecordCPR prCPR;//病历附表--心肺复苏
            if (state == "new")
            {
                int AddPatientOrder = prBLL.GetPatientMaxOrder(TaskCode);
                ViewData["PatientOrder"] = AddPatientOrder;
                prInfo = new M_PatientRecord();
                pra = new M_PatientRecordAppend();
                prCPR = new M_PatientRecordCPR();
                ViewBag.PRInfo = prInfo;//病历主表信息--传到页面
                ViewBag.PRAppendInfo = pra;//病历附表--体检等信息--传到页面
                ViewBag.PRCPRInfo = prCPR;//病历附表--心肺复苏--传到页面

            }
            else
            {
                object oPatientInfo;//病历主表
                prBLL.GetPatientInfo(TaskCode, PatientOrder, out oPatientInfo, out pra, out prCPR);
                if (PatientOrder > 0)
                {
                    prInfo = (M_PatientRecord)oPatientInfo;
                    ViewBag.PRInfo = prInfo;//病历主表信息--传到页面
                    ViewBag.PRAppendInfo = pra;//病历附表--体检等信息--传到页面
                    ViewBag.PRCPRInfo = prCPR;//病历附表--心肺复苏--传到页面
                    ViewData["PatientOrder"] = PatientOrder;
                    if (SuperRole("SuperRole"))
                    {
                        this.ViewData["SuperRole"] = "SuperRole";//登录人有超级权限
                    }
                    else
                        this.ViewData["SuperRole"] = "";

                    string role = UserOperateContext.Current.getMaxPerForRole();//获取登录人角色(医生、护士、司机)
                    this.ViewData["PatientRole"] = role;//
                }
            }
            ViewData["state"] = state == null ? "new" : state;

            if (SuperRole("PRAuditCPR"))
            {
                this.ViewData["PRAuditCPR"] = "PRAuditCPR";//登录人有“心肺复苏审核”权限
            }
            else
                this.ViewData["PRAuditCPR"] = "";

            if (SuperRole("SubCenterSpotChecks"))
            {
                this.ViewData["SubCenterSpotChecks"] = "SubCenterSpotChecks";//登录人有"分中心抽查"权限
            }
            else
                this.ViewData["SubCenterSpotChecks"] = "";

            if (SuperRole("CenterSpotChecks"))
            {
                this.ViewData["CenterSpotChecks"] = "CenterSpotChecks";//登录人有"中心抽查"权限
            }
            else
                this.ViewData["CenterSpotChecks"] = "";

            P_User pUser = new P_User();
            pUser = UserOperateContext.Current.Session_UsrInfo;//获取登录人信息
            ViewData["AgentCode"] = pUser.ID;
            ViewData["AgentWorkID"] = pUser.WorkCode;
            ViewData["AgentName"] = pUser.Name;
            ViewData["BeginFillPatientTime"] = DateTime.Now.ToString();//开始填写病历时间

            #region 为病历页面的CheckBoxList项目赋值
            CheckViewModel model = new CheckViewModel();
            //model.DiseasesClassification = dBLL.GetCheckBoxModelByTableName("M_ZCaseTemplate");//病种分类
            //model.GongShiRen = dBLL.GetCheckBoxModel("GongShiRen");//供史人
            //model.AnamnesisllnessHistory = dBLL.GetCheckBoxModel("PastMedicalHistory");//既往病史
            model.BodyFigure = dBLL.GetCheckBoxModel("PiFu");//皮肤
            model.Head = dBLL.GetCheckBoxModel("Head");//头部
            model.Neck = dBLL.GetCheckBoxModel("Neck");//颈部
            model.Chest = dBLL.GetCheckBoxModel("Chest");//胸部
            model.Lung = dBLL.GetCheckBoxModel("Lung");//肺脏
            model.LungLeft = dBLL.GetCheckBoxModel("LungLeft");//左肺
            model.LungRight = dBLL.GetCheckBoxModel("LungLeft");//右肺
            model.FuBu = dBLL.GetCheckBoxModel("FuBu");//腹部
            model.JiZhu = dBLL.GetCheckBoxModel("JiZhu");//脊柱
            model.Limb = dBLL.GetCheckBoxModel("Limb");//四肢
            #endregion

            #region 为病历页面的RadioButtonList从数据库传值

            var ProvideMedicalHistoryPeople = new object();//供史人
            var DiseasesClassification = new object();//病种分类
            var PastMedicalHistory = new object();//既往病史
            var BabinskiSign = new object();//神经系统--巴氏征
            var ChestExtrusionTest = new object();//胸廓挤压试验
            var PelvicExtrusionTest = new object();//骨盆挤压试验

            lock (m_SyncRoot)
            {
                ProvideMedicalHistoryPeople = CacheHelper.GetCache("ProvideMedicalHistoryPeople");
                DiseasesClassification = CacheHelper.GetCache("DiseasesClassification");
                PastMedicalHistory = CacheHelper.GetCache("PastMedicalHistory");
                BabinskiSign = CacheHelper.GetCache("BabinskiSign");
                ChestExtrusionTest = CacheHelper.GetCache("ChestExtrusionTest");
                PelvicExtrusionTest = CacheHelper.GetCache("PelvicExtrusionTest");
                if (ProvideMedicalHistoryPeople == null)
                {
                    ProvideMedicalHistoryPeople = dBLL.GetCheckBoxOrRadioButtonList("Checkbox", "ProvideMedicalHistoryPeople", "checkbox");
                    CacheHelper.SetCache("ProvideMedicalHistoryPeople", ProvideMedicalHistoryPeople);
                }
                if (DiseasesClassification == null)
                {
                    DiseasesClassification = dBLL.GetCheckBoxListByTableName("M_ZCaseTemplate", "DiseasesClassification", "checkbox");
                    CacheHelper.SetCache("DiseasesClassification", DiseasesClassification);
                }
                if (PastMedicalHistory == null)
                {
                    PastMedicalHistory = dBLL.GetCheckBoxOrRadioButtonList("Checkbox", "PastMedicalHistory", "checkbox");
                    CacheHelper.SetCache("PastMedicalHistory", PastMedicalHistory);
                }
                if (BabinskiSign == null)
                {
                    BabinskiSign = dBLL.GetCheckBoxOrRadioButtonList("Checkbox", "BabinskiSign", "checkbox");
                    CacheHelper.SetCache("BabinskiSign", BabinskiSign);
                }
                if (ChestExtrusionTest == null)
                {
                    ChestExtrusionTest = dBLL.GetCheckBoxOrRadioButtonList("Radio", "ChestExtrusionTest", "radio");
                    CacheHelper.SetCache("ChestExtrusionTest", ChestExtrusionTest);
                }
                if (PelvicExtrusionTest == null)
                {
                    PelvicExtrusionTest = dBLL.GetCheckBoxOrRadioButtonList("Radio", "PelvicExtrusionTest", "radio");
                    CacheHelper.SetCache("PelvicExtrusionTest", PelvicExtrusionTest);
                }
            }
            this.ViewData["ProvideMedicalHistoryPeople"] = ProvideMedicalHistoryPeople;
            this.ViewData["DiseasesClassification"] = DiseasesClassification;
            this.ViewData["PastMedicalHistory"] = PastMedicalHistory;
            this.ViewData["BabinskiSign"] = BabinskiSign;
            this.ViewData["ChestExtrusionTest"] = ChestExtrusionTest;
            this.ViewData["PelvicExtrusionTest"] = PelvicExtrusionTest;

            #endregion

            return View(model);
        }
Exemplo n.º 5
0
        public bool Update(object info, M_PatientRecordAppend pra
            , M_PatientRecordCPR prCPR, List<M_PatientRecordDiag> prDiag
            , List<M_PatientRecordECGImpressions> prECG)
        {
            using (var tran = db.Database.BeginTransaction())
            {
                try
                {
                    #region 修改病历主表

                    M_PatientRecord pInfo = (M_PatientRecord)info;
                    List<M_PatientRecordTrace> crackList = new List<M_PatientRecordTrace>();//病历修改记录
                    int j = 0;//病历修改记录主键
                    DateTime modifyTime = DateTime.Now;//修改时间
                    string modifyPerson = pInfo.LastUpdatePerson;//修改人

                    M_PatientRecord originInfo = dalContext.IM_PatientRecordDAL.GetModelWithOutTrace(a => a.PatientOrder == pInfo.PatientOrder && a.TaskCode == pInfo.TaskCode);

                    var entry = db.Entry(pInfo);
                    if (entry.State == EntityState.Detached)
                    {

                        //如果已经被上下文追踪
                        if (originInfo != null)
                        {
                            //originInfo = pInfo;//修改病历主表
                            pInfo.ForHelpTelephone = originInfo.ForHelpTelephone;
                            pInfo.OriginalTaskType = originInfo.OriginalTaskType;//原事件类型--不修改
                            pInfo.ForArea = originInfo.ForArea;
                            pInfo.AgentCode = originInfo.AgentCode;
                            pInfo.AgentWorkID = originInfo.AgentWorkID;//填写人工号
                            pInfo.AgentName = originInfo.AgentName;//填写人姓名
                            pInfo.BeginFillPatientTime = originInfo.BeginFillPatientTime;//开始填写病历时间
                            pInfo.MedicalRecordGenerationTime = originInfo.MedicalRecordGenerationTime;//病历生成时间
                            if (originInfo.FormCompleteLogo == true)
                            {
                                pInfo.FormCompleteLogo = originInfo.FormCompleteLogo;//归档标识
                                pInfo.FormCompleteTime = originInfo.FormCompleteTime;//归档时间
                            }
                            pInfo.ChargeOrder = originInfo.ChargeOrder;
                            if (originInfo.SubmitLogo == true)
                            {
                                pInfo.SubmitLogo = originInfo.SubmitLogo;//提交标志
                                pInfo.SubmitTime = originInfo.SubmitTime;//提交时间
                                pInfo.MedicalStateCode = originInfo.MedicalStateCode;//不修改病历状态
                            }
                            pInfo.SubCenterIFSpotChecks = originInfo.SubCenterIFSpotChecks;//分中心是否抽查
                            pInfo.SubCenterPerson = originInfo.SubCenterPerson;
                            pInfo.SubCenterSpotChecksTime = originInfo.SubCenterSpotChecksTime;
                            pInfo.SubCenterSpotChecksResult = originInfo.SubCenterSpotChecksResult;
                            pInfo.SubCenterSpotChecksRmark = originInfo.SubCenterSpotChecksRmark;
                            pInfo.CenterIFSpotChecks = originInfo.CenterIFSpotChecks;//中心是否抽查
                            pInfo.CenterSpotChecksPerson = originInfo.CenterSpotChecksPerson;
                            pInfo.CenterSpotChecksTime = originInfo.CenterSpotChecksTime;
                            pInfo.CenterSpotChecksResult = originInfo.CenterSpotChecksResult;
                            pInfo.CenterSpotChecksRmark = originInfo.CenterSpotChecksRmark;

                            //pInfo.IMEI = originInfo.IMEI;

                            db.M_PatientRecord.Attach(pInfo);//将给定实体附加到集的基础上下文中,将实体以“未更改”的状态放置到上下文;
                            db.Entry(pInfo).State = EntityState.Modified;

                        }
                        //else//如果不在当前上下文追踪
                        //{
                        //    db.Entry(pInfo).State = EntityState.Modified;
                        //}

                    }
                    #endregion

                    #region 修改病历附表--体检等
                    M_PatientRecordAppend praInfo = dalContext.IM_PatientRecordAppendDAL.GetModelWithOutTrace(a => a.PatientOrder == pra.PatientOrder && a.TaskCode == pra.TaskCode);
                    if (praInfo != null)
                    {
                        pra.PhysicalExaminationSupplement = praInfo.PhysicalExaminationSupplement;//体检补充描述,应该没有,数据库应该删除
                        db.M_PatientRecordAppend.Attach(pra);//将给定实体附加到集的基础上下文中,将实体以“未更改”的状态放置到上下文;
                        db.Entry(pra).State = EntityState.Modified;//修改病历附表--体检等
                    }
                    #endregion

                    #region 修改病历附表--心肺复苏
                    M_PatientRecordCPR prCPRInfo = dalContext.IM_PatientRecordCPRDAL.GetModelWithOutTrace(a => a.PatientOrder == prCPR.PatientOrder && a.TaskCode == prCPR.TaskCode);
                    if (prCPRInfo != null)
                    {
                        prCPR.EmergencyTime = prCPRInfo.EmergencyTime;//急救时长(页面没有显示,最后删除)
                        prCPR.ECGMonitoringTime = prCPRInfo.ECGMonitoringTime;//心电监护时间(页面没有显示,最后删除)
                        prCPR.BeforeResuscitationECGDiagnosis = prCPRInfo.BeforeResuscitationECGDiagnosis;
                        prCPR.BeforeResuscitationSaO2 = prCPRInfo.BeforeResuscitationSaO2;
                        prCPR.IFLeaveHospital = prCPRInfo.IFLeaveHospital;//中心审核人员填写
                        prCPR.LeaveHospitalDate = prCPRInfo.LeaveHospitalDate;
                        prCPR.LeaveHospitalCPC = prCPRInfo.LeaveHospitalCPC;
                        prCPR.VerifyResults = prCPRInfo.VerifyResults;
                        prCPR.VerifyPerson = prCPRInfo.VerifyPerson;
                        prCPR.VerifyTime = prCPRInfo.VerifyTime;
                        prCPR.RegistrationPerson = prCPRInfo.RegistrationPerson;
                        prCPR.RegistrationTime = prCPRInfo.RegistrationTime;
                        prCPR.CenterIFAuditForXFFS = prCPRInfo.CenterIFAuditForXFFS;//中心审核心肺复苏
                        prCPR.CenterAuditPerson = prCPRInfo.CenterAuditPerson;
                        prCPR.CenterAuditTime = prCPRInfo.CenterAuditTime;
                        prCPR.CenterAuditResult = prCPRInfo.CenterAuditResult;
                        prCPR.CenterNotThroughReason = prCPRInfo.CenterNotThroughReason;
                        db.M_PatientRecordCPR.Attach(prCPR);//将给定实体附加到集的基础上下文中,将实体以“未更改”的状态放置到上下文;
                        db.Entry(prCPR).State = EntityState.Modified;//修改病历附表--心肺复苏
                    }
                    #endregion

                    #region 修改初步诊断子表
                    var dqry0 = from infos in db.M_PatientRecordDiag
                                where infos.TaskCode == pInfo.TaskCode && infos.PatientOrder == pInfo.PatientOrder
                                select infos;
                    foreach (var inf in dqry0)
                        db.M_PatientRecordDiag.Remove(inf);//删除初步诊断子表
                    //db.M_PatientRecordDiag.RemoveRange(prDiag);//删除初步诊断子表
                    if (prDiag != null)
                    {
                        db.M_PatientRecordDiag.AddRange(prDiag);//插入初步诊断子表
                    }
                    #endregion

                    #region 修改心电图印象子表
                    var dqry1 = from infos in db.M_PatientRecordECGImpressions
                                where infos.TaskCode == pInfo.TaskCode && infos.PatientOrder == pInfo.PatientOrder
                                select infos;
                    foreach (var inf in dqry1)
                        db.M_PatientRecordECGImpressions.Remove(inf);//删除心电图印象
                    //db.M_PatientRecordECGImpressions.RemoveRange(prECG);//删除心电图印象
                    if (prECG != null)
                    {
                        db.M_PatientRecordECGImpressions.AddRange(prECG);//插入心电图印象子表
                    }
                    #endregion

                    #region 提交病历后修改病历痕迹
                    int flag = 0;//病历状态:0.普通保存(还没有提交);1.提交;2.提交后的保存
                    //提交后保存的
                    if (originInfo.MedicalStateCode == 1)
                    {
                        flag = 2;//提交后的保存
                        #region 插入病历主表痕迹
                        //获得所有property的信息
                        PropertyInfo[] proOrigin = originInfo.GetType().GetProperties();
                        //PropertyInfo[] proNew = pInfo.GetType().GetProperties();
                        for (int i = 0; i < proOrigin.Length; i++)
                        {
                            object obj1 = proOrigin[i].GetValue(originInfo, null);
                            object obj2 = proOrigin[i].GetValue(info, null);
                            obj1 = obj1 == null ? "" : obj1;
                            obj2 = obj2 == null ? "" : obj2;
                            //proOrigin[i].Name != "LastModifyTime" && proOrigin[i].Name != "LastModifyPerson"
                            if (!obj1.Equals(obj2) && proOrigin[i].Name != "FormCompleteLogo" && proOrigin[i].Name != "FormCompleteTime"
                                && proOrigin[i].Name != "SubmitLogo" && proOrigin[i].Name != "SubmitTime" && proOrigin[i].Name != "MedicalStateCode"
                                && proOrigin[i].Name != "OutStationCode")
                            {
                                j = j + 1;
                                M_PatientRecordTrace crackInfo = new M_PatientRecordTrace();
                                var query = from a in db.M_PatientRecordTrace
                                            select a.ID;
                                if (query.Count() > 0 && j == 1)
                                {
                                    crackInfo.ID = query.Max() + 1;
                                    j = crackInfo.ID;
                                }
                                else if (j > 1)
                                { crackInfo.ID = j; }
                                else
                                { crackInfo.ID = 1; }
                                crackInfo.ModifyTime = modifyTime;//修改时间
                                crackInfo.ModifyPerson = modifyPerson;//修改人
                                crackInfo.TaskCode = pInfo.TaskCode;//任务编码
                                crackInfo.PatientOrder = pInfo.PatientOrder;//序号
                                crackInfo.ModifyItem = GetDescriptionByTableName("M_PatientRecord", proOrigin[i].Name);//修改项
                                crackInfo.OriginalValue = obj1.ToString();//原值
                                crackInfo.NewValue = obj2.ToString();//新值
                                crackInfo.OwnershipType = 1;
                                crackList.Add(crackInfo);
                            }
                        }
                        #endregion

                        #region 如果病历提交插入病历附表--体检等修改痕迹
                        //获得所有property的信息
                        PropertyInfo[] proOrigin1 = praInfo.GetType().GetProperties();
                        //PropertyInfo[] proNew1 = pra.GetType().GetProperties();
                        for (int i = 0; i < proOrigin1.Length; i++)
                        {
                            object obj1 = proOrigin1[i].GetValue(praInfo, null);
                            object obj2 = proOrigin1[i].GetValue(pra, null);
                            obj1 = obj1 == null ? "" : obj1;
                            obj2 = obj2 == null ? "" : obj2;
                            if (!obj1.Equals(obj2) && proOrigin1[i].Name != "OpenReactionScore" && proOrigin1[i].Name != "LanguageReactionScore" && proOrigin1[i].Name != "MotionResponseScore"
                                && proOrigin1[i].Name != "GCSScore" && proOrigin1[i].Name != "PositionScore" && proOrigin1[i].Name != "DamageWayScore"
                                && proOrigin1[i].Name != "CirculationChangeScore" && proOrigin1[i].Name != "BreathingChangeScore" && proOrigin1[i].Name != "ConsciousnessChangeScore"
                                && proOrigin1[i].Name != "TIScore" && proOrigin1[i].Name != "HeartRatePerMinuteScore" && proOrigin1[i].Name != "BreathingScore"
                                && proOrigin1[i].Name != "MuscleTensionScore" && proOrigin1[i].Name != "LaryngealReflexScore" && proOrigin1[i].Name != "SkinColorScore"
                                && proOrigin1[i].Name != "ApgarScore" && proOrigin1[i].Name != "SymptomPendingInvestigationCodes" && proOrigin1[i].Name != "FirstImpressionCodes"
                                && proOrigin1[i].Name != "ECGImpressionCodes" && proOrigin1[i].Name != "ECGImpressionRetestICodes" && proOrigin1[i].Name != "ECGImpressionRetestIICodes")
                            {
                                j = j + 1;
                                M_PatientRecordTrace crackInfo = new M_PatientRecordTrace();
                                var query = from a in db.M_PatientRecordTrace
                                            select a.ID;
                                if (query.Count() > 0 && j == 1)
                                {
                                    crackInfo.ID = query.Max() + 1;
                                    j = crackInfo.ID;
                                }
                                else if (j > 1)
                                { crackInfo.ID = j; }
                                else
                                { crackInfo.ID = 1; }
                                crackInfo.ModifyTime = modifyTime;//修改时间
                                crackInfo.ModifyPerson = modifyPerson;//修改人
                                crackInfo.TaskCode = pra.TaskCode;//任务编码
                                crackInfo.PatientOrder = pra.PatientOrder;//序号
                                crackInfo.ModifyItem = GetDescriptionByTableName("M_PatientRecordAppend", proOrigin1[i].Name);//修改项
                                crackInfo.OriginalValue = obj1.ToString();//原值
                                crackInfo.NewValue = obj2.ToString();//新值
                                crackInfo.OwnershipType = 2;
                                crackList.Add(crackInfo);
                            }
                        }
                        #endregion

                        #region 如果病历提交插入病历附表--心肺复苏
                        //获得所有property的信息
                        PropertyInfo[] proOrigin2 = prCPRInfo.GetType().GetProperties();
                        //PropertyInfo[] proNew2 = prCPR.GetType().GetProperties();
                        for (int i = 0; i < proOrigin2.Length; i++)
                        {
                            object obj1 = proOrigin2[i].GetValue(prCPRInfo, null);
                            object obj2 = proOrigin2[i].GetValue(prCPR, null);
                            obj1 = obj1 == null ? "" : obj1;
                            obj2 = obj2 == null ? "" : obj2;
                            if (!obj1.Equals(obj2))
                            {
                                j = j + 1;
                                M_PatientRecordTrace crackInfo = new M_PatientRecordTrace();
                                var query = from a in db.M_PatientRecordTrace
                                            select a.ID;
                                if (query.Count() > 0 && j == 1)
                                {
                                    crackInfo.ID = query.Max() + 1;
                                    j = crackInfo.ID;
                                }
                                else if (j > 1)
                                { crackInfo.ID = j; }
                                else
                                { crackInfo.ID = 1; }
                                crackInfo.ModifyTime = modifyTime;//修改时间
                                crackInfo.ModifyPerson = modifyPerson;//修改人
                                crackInfo.TaskCode = prCPRInfo.TaskCode;//任务编码
                                crackInfo.PatientOrder = prCPRInfo.PatientOrder;//序号
                                crackInfo.ModifyItem = GetDescriptionByTableName("M_PatientRecordCPR", proOrigin2[i].Name);//修改项
                                crackInfo.OriginalValue = obj1.ToString();//原值
                                crackInfo.NewValue = obj2.ToString();//新值
                                crackInfo.OwnershipType = 3;
                                crackList.Add(crackInfo);
                            }
                        }
                        #endregion

                    }
                    #endregion

                    if (crackList.Count > 0)
                    {
                        db.M_PatientRecordTrace.AddRange(crackList);//插入病历修改记录表
                    }

                    db.SaveChanges();//将在此上下文中所做的所有更改保存到基础数据库
                    tran.Commit(); //提交事务
                    return true;
                }
                catch (Exception ex)
                {
                    LogUtility.Error("M_PatientRecordDAL/Update(WEB)", ex.ToString());
                    if (tran != null)
                        tran.Rollback();  //回滚事务
                    return false;
                }
            }
        }
Exemplo n.º 6
0
        public bool Insert(object info, M_PatientRecordAppend pra
            , M_PatientRecordCPR prCPR, List<M_PatientRecordDiag> prDiag
            , List<M_PatientRecordECGImpressions> prECG)
        {
            using (var tran = db.Database.BeginTransaction())
            {
                try
                {
                    M_PatientRecord pInfo = (M_PatientRecord)info;

                    db.M_PatientRecord.Add(pInfo);//插入病历主表

                    if (pra != null)
                    {
                        db.M_PatientRecordAppend.Add(pra);//插入病历附表--体检等
                    }
                    if (prCPR != null)
                    {
                        //prCPR.RegistrationTime = DateTime.Now;//登记时间
                        db.M_PatientRecordCPR.Add(prCPR);//插入病历附表--心肺复苏
                    }
                    if (prDiag != null)
                    {
                        db.M_PatientRecordDiag.AddRange(prDiag);//插入初步诊断子表
                    }
                    if (prECG != null)
                    {
                        db.M_PatientRecordECGImpressions.AddRange(prECG);//插入心电图印象子表
                    }

                    db.SaveChanges();//将在此上下文中所做的所有更改保存到基础数据库
                    tran.Commit(); //提交事务
                    //transaction.Complete();//这一句如果注释后,则上面的保存不会被提交到DB中
                    return true;
                }
                catch (Exception ex)
                {
                    LogUtility.Error("M_PatientRecordDAL/Insert()", ex.ToString());
                    if (tran != null)
                        tran.Rollback();  //回滚事务
                    return false;
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取病历主表及附表信息
        /// </summary>
        /// <param name="taskCode"></param>
        /// <param name="patientOrder"></param>
        /// <param name="info"></param>
        /// <param name="pra"></param>
        /// <param name="prCPR"></param>
        public void GetPatientInfo(string taskCode, int patientOrder, out object info
            , out M_PatientRecordAppend pra, out M_PatientRecordCPR prCPR)
        {
            info = (from pi in db.M_PatientRecord
                    where pi.TaskCode == taskCode && pi.PatientOrder == patientOrder
                    select pi).FirstOrDefault();//病历主表

            pra = (from pi in db.M_PatientRecordAppend
                   where pi.TaskCode == taskCode && pi.PatientOrder == patientOrder
                   select pi).FirstOrDefault();//病历附表--体检等信息

            prCPR = (from pi in db.M_PatientRecordCPR
                     where pi.TaskCode == taskCode && pi.PatientOrder == patientOrder
                     select pi).FirstOrDefault();//心肺复苏
        }
Exemplo n.º 8
0
 public bool UpdateAuditCPR(M_PatientRecordCPR info)
 {
     using (var tran = db.Database.BeginTransaction())
     {
         try
         {
             M_PatientRecordCPR prCPRInfo = dalContext.IM_PatientRecordCPRDAL.GetModelWithOutTrace(a => a.PatientOrder == info.PatientOrder && a.TaskCode == info.TaskCode);
             if (prCPRInfo != null)
             {
                 info.Witness = prCPRInfo.Witness;
                 info.CarToBeforeCPR = prCPRInfo.CarToBeforeCPR;
                 info.CarToBeforeDefibrillation = prCPRInfo.CarToBeforeDefibrillation;
                 info.EmergencyTime = prCPRInfo.EmergencyTime;
                 info.ECGMonitoringTime = prCPRInfo.ECGMonitoringTime;
                 info.CardiacArrestReason = prCPRInfo.CardiacArrestReason;
                 info.CardiacArrestReasonSupplement = prCPRInfo.CardiacArrestReasonSupplement;
                 info.BeforeResuscitationECGDiagnosis = prCPRInfo.BeforeResuscitationECGDiagnosis;
                 info.BeforeResuscitationSaO2 = prCPRInfo.BeforeResuscitationSaO2;
                 info.AfterResuscitationBP = prCPRInfo.AfterResuscitationBP;
                 info.AfterResuscitationSaO2 = prCPRInfo.AfterResuscitationSaO2;
                 info.PulsationAppearTime = prCPRInfo.PulsationAppearTime;
                 info.BreatheAppearTime = prCPRInfo.BreatheAppearTime;
                 info.AfterResuscitationECGDiagnosis = prCPRInfo.AfterResuscitationECGDiagnosis;
                 info.IFAdmittedToHospital = prCPRInfo.IFAdmittedToHospital;
                 //info.DoctorFollowUp = prCPRInfo.DoctorFollowUp;
                 db.M_PatientRecordCPR.Attach(info);//将给定实体附加到集的基础上下文中,将实体以“未更改”的状态放置到上下文;
                 db.Entry(info).State = EntityState.Modified;//修改病历附表--心肺复苏
             }
             db.SaveChanges();//将在此上下文中所做的所有更改保存到基础数据库
             tran.Commit(); //提交事务
             return true;
         }
         catch (Exception ex)
         {
             LogUtility.Error("M_PatientRecordDAL/UpdateAuditCPR()", ex.ToString());
             if (tran != null)
                 tran.Rollback();  //回滚事务
             return false;
         }
     }
 }