public ActionResult QOLShow()
        {
            string    id     = CommonFunc.SafeGetStringFromObj(Request["id"]);
            MT_BC_QOL result = mT_BC_QOLService.LoadEntityAsNoTracking(t => t.id.Contains(id)).FirstOrDefault();

            ViewData.Model = result;
            return(View());
        }
        //新增或修改
        public ActionResult AddAndUpdate()
        {
            string    id = CommonFunc.SafeGetStringFromObj(Request["id"]);
            string    fill_community_code = CommonFunc.SafeGetStringFromObj(Request["community_code"]);
            string    worker    = CommonFunc.SafeGetStringFromObj(Request["worker"]);
            string    real_name = CommonFunc.SafeGetStringFromObj(Request["real_name"]);
            MT_BC_QOL entity    = new MT_BC_QOL();

            if (string.IsNullOrEmpty(id))
            {
                entity.id          = Guid.NewGuid().ToString();
                entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd")));
            }
            else
            {
                entity.id          = id;
                entity.create_time = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd")));
            }
            entity.name           = Request["name"];
            entity.sex            = Request["sex"];
            entity.age            = Request["age"];
            entity.id_card_number = Request["id_card_number"];
            string s = Request["id_card_number"];
            string s1 = "", s2 = "", s3 = "";

            if (s.Length == 15)
            {
                s1 = s.Substring(6, 2);
                s2 = s.Substring(8, 2);
                s3 = s.Substring(10, 2);
                entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj("19" + s1 + "-" + s2 + "-" + s3));
            }
            else if (s.Length == 18)
            {
                s1 = s.Substring(6, 4);
                s2 = s.Substring(10, 2);
                s3 = s.Substring(12, 2);
                entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(s1 + "-" + s2 + "-" + s3));
            }
            //根据身份证号查询个人信息表中是否存在此人信息,如果存在,则使用个人信息中的健康档案号,如果不存在,则创建一个新的17位的健康档案号
            string id_card_number = CommonFunc.SafeGetStringFromObj(Request["id_card_number"]);
            string ddlCommunity   = CommonFunc.SafeGetStringFromObj(Request["ddlCommunity"]);
            string residentId     = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.resident_id).FirstOrDefault());

            if (string.IsNullOrEmpty(residentId))
            {
                entity.resident_id = residentFileService.GetNumberByCode1(ddlCommunity);
            }
            else
            {
                entity.resident_id = residentId;
            }
            if (string.IsNullOrEmpty(Request["birth_date"]))
            {
                entity.birth_date = null;
            }
            else
            {
                entity.birth_date = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(Request["birth_date"]));
            }
            entity.community_code       = Request["ddlCommunity"];
            entity.address              = Request["perment_community_address"];
            entity.phone                = Request["txtIndividualPhone"];
            entity.worker_user_name     = worker;
            entity.worker_user_realname = real_name;
            //------------------------------------特有字段赋值-------------------------------------------------------
            entity.q1  = Request["radio1"];
            entity.q2  = Request["radio2"];
            entity.q3  = Request["radio3"];
            entity.q4  = Request["radio4"];
            entity.q5  = Request["radio5"];
            entity.q6  = Request["radio6"];
            entity.q7  = Request["radio7"];
            entity.q8  = Request["radio8"];
            entity.q9  = Request["radio9"];
            entity.q10 = Request["radio10"];
            entity.q11 = Request["radio11"];
            entity.q12 = Request["radio12"];
            entity.q13 = Request["radio13"];
            entity.q14 = Request["radio14"];
            entity.q15 = Request["radio15"];
            entity.q16 = Request["radio16"];
            entity.q17 = Request["radio17"];
            entity.q18 = Request["radio18"];
            entity.q19 = Request["radio19"];
            entity.q20 = Request["radio20"];
            entity.q21 = Request["radio21"];
            entity.q22 = Request["radio22"];
            entity.q23 = Request["radio23"];
            entity.q24 = Request["radio24"];
            entity.q25 = Request["radio25"];
            entity.q26 = Request["radio26"];
            entity.q27 = Request["radio27"];
            entity.q28 = Request["radio28"];
            entity.q29 = Request["radio29"];
            entity.q30 = Request["radio30"];

            entity.rs1  = Request["rs1"];
            entity.rs2  = Request["rs2"];
            entity.rs3  = Request["rs3"];
            entity.rs4  = Request["rs4"];
            entity.rs5  = Request["rs5"];
            entity.rs6  = Request["rs6"];
            entity.rs7  = Request["rs7"];
            entity.rs8  = Request["rs8"];
            entity.rs9  = Request["rs9"];
            entity.rs10 = Request["rs10"];
            entity.rs11 = Request["rs11"];
            entity.rs12 = Request["rs12"];
            entity.rs13 = Request["rs13"];
            entity.rs14 = Request["rs14"];
            entity.rs15 = Request["rs15"];

            entity.s1  = Request["s1"];
            entity.s2  = Request["s2"];
            entity.s3  = Request["s3"];
            entity.s4  = Request["s4"];
            entity.s5  = Request["s5"];
            entity.s6  = Request["s6"];
            entity.s7  = Request["s7"];
            entity.s8  = Request["s8"];
            entity.s9  = Request["s9"];
            entity.s10 = Request["s10"];
            entity.s11 = Request["s11"];
            entity.s12 = Request["s12"];
            entity.s13 = Request["s13"];
            entity.s14 = Request["s14"];
            entity.s15 = Request["s15"];

            entity.advice = Request["advice"];

            entity.doctor    = Request["doctor"];
            entity.checkdate = CommonFunc.SafeGetDateTimeFromObj(Request["checkdate"]);

            //判断个人信息表中是否存在此人信息
            var dt = residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number);

            Comm_ResidentFile resident = new Comm_ResidentFile();

            resident.id = CommonFunc.SafeGetStringFromObj(dt.Select(t => t.id).FirstOrDefault());

            resident.resident_id            = entity.resident_id;
            resident.resident_name          = Request["name"];
            resident.sex                    = Request["sex"];
            resident.id_card_number         = Request["id_card_number"];
            resident.birth_date             = entity.birth_date;
            resident.community_code         = Request["ddlCommunity"];
            resident.individual_phone       = Request["txtIndividualPhone"];
            resident.permanent_home_address = Request["perment_community_address"];
            resident.nationality_name       = "中国";
            resident.nationality_code       = "156";
            if (dt.Count() < 1)
            {
                resident.id             = Guid.NewGuid().ToString();
                resident.community_code = Request["ddlCommunity"];
                if (entity.create_time == null)
                {
                    resident.create_time = CommonFunc.SafeGetDateTimeFromObj(DateTime.Now.ToString("yyyy-MM-dd"));
                }
                else
                {
                    resident.create_time = CommonFunc.SafeGetDateTimeFromObj(entity.create_time);
                }

                resident.worker_user_name = worker;
                residentFileService.AddEntity(resident);

                Comm_EHR_Abstract ehr1 = new Comm_EHR_Abstract();
                ehr1.id             = Guid.NewGuid().ToString();
                ehr1.resident_id    = entity.resident_id;
                ehr1.community_code = entity.community_code;
                ehr1.create_time    = DateTime.Now;
                ehr1.item_id        = resident.id;
                ehr1.item_type      = Model.Enum.EHRAbstractTypeEnum.ResidentInfo.ToString();

                eHRAbstractService.AddEntity(ehr1);
            }
            else
            {
                //根据身份证号查询个人信息表中是否存在此人信息,存在获取行政区划代码,与现在填写的常住地址作比较,不相同则将其添加到Comm_ResidentFile_Change_Address表中
                string code = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.community_code).FirstOrDefault());

                if (Request["ddlCommunity"] != code)
                {
                    Comm_ResidentFile_Change_Address address = new Comm_ResidentFile_Change_Address();
                    address.id                  = Guid.NewGuid().ToString();
                    address.contact_id          = entity.id;
                    address.resident_id         = entity.resident_id;
                    address.community_code      = code;
                    address.fill_community_code = fill_community_code;
                    address.fill_person         = worker;
                    address.permanent_address   = CommonFunc.SafeGetStringFromObj(residentFileService.LoadEntityAsNoTracking(t => t.id_card_number == id_card_number).Select(t => t.permanent_home_address).FirstOrDefault());
                    address.create_time         = CommonFunc.SafeGetDateTimeFromObj(CommonFunc.SafeGetStringFromObj(DateTime.Now.ToString("yyyy-MM-dd")));

                    residentFileChangeAddressService.AddEntity(address);
                }

                string[] propertyName = new string[] { "resident_name", "sex", "id_card_number", "birth_date", "community_code", "individual_phone", "permanent_home_address" };
                residentFileService.UpdatePartialPropertity(resident, propertyName);
            }
            string msg = "";

            if (string.IsNullOrEmpty(id))
            {
                if (mT_BC_QOLService.AddEntity(entity))
                {
                    Comm_EHR_Abstract ehr = new Comm_EHR_Abstract();
                    ehr.id             = Guid.NewGuid().ToString();
                    ehr.resident_id    = entity.resident_id;
                    ehr.community_code = entity.community_code;
                    ehr.create_time    = DateTime.Now;
                    ehr.item_id        = entity.id;
                    ehr.item_type      = Model.Enum.EHRAbstractTypeEnum.QOL.ToString();
                    if (eHRAbstractService.AddEntity(ehr))
                    {
                        msg = "提交成功";
                    }
                    else
                    {
                        msg = "提交失败";
                    }
                }
            }
            else
            {
                if (mT_BC_QOLService.UpdateEntity(entity))
                {
                    msg = "修改成功";
                }
                else
                {
                    msg = "修改失败";
                }
            }

            return(Content(msg + "," + entity.id));
        }