Esempio n. 1
0
        public IHttpActionResult Post(DC_IpdRegModel baseRequest)
        {
            baseRequest.CreateBy   = SecurityHelper.CurrentPrincipal.EmpNo;
            baseRequest.CreateDate = DateTime.Now;
            baseRequest.OrgId      = SecurityHelper.CurrentPrincipal.OrgId;
            switch (baseRequest.isAdd)
            {
            case "1":
                baseRequest.IpdFlag = "I";
                break;

            case "2":
                baseRequest.IpdFlag = "O";
                break;

            default:
                baseRequest.IpdFlag = "I";
                break;
            }

            if (baseRequest.isAdd == "1")
            {
                var response = service.SaveIpdRegIn(baseRequest);//收案
                return(Ok(response));
            }
            else if (baseRequest.isAdd == "2")
            {
                var response = service.SaveIpdRegOut(baseRequest);//结案
                return(Ok(response));
            }
            else if (baseRequest.isAdd == "3")
            {
                var response = service.SaveUpdateIpdRegIn(baseRequest);//修改收案资料
                return(Ok(response));
            }
            return(null);
        }
        /// <summary>
        /// 基本资料
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public BaseResponse <DC_RegFileModel> GetBasicInfoById(long id)
        {
            BaseResponse <DC_RegFileModel> response = new BaseResponse <DC_RegFileModel>();

            DC_IpdRegModel model = (from r in unitOfWork.GetRepository <DC_IPDREG>().dbSet.Where(m => m.FEENO == id) select new DC_IpdRegModel {
                FeeNo = r.FEENO, RegNo = r.REGNO
            }).FirstOrDefault();

            if (model.FeeNo > 0)
            {
                response.Data = (from ipd in unitOfWork.GetRepository <DC_IPDREG>().dbSet.Where(m => m.FEENO == model.FeeNo)
                                 join reg in unitOfWork.GetRepository <DC_REGFILE>().dbSet on ipd.REGNO equals reg.REGNO into r
                                 from ipd_reg in r.DefaultIfEmpty()
                                 join orgs in unitOfWork.GetRepository <LTC_ORG>().dbSet on ipd.ORGID equals orgs.ORGID into o
                                 from org in o.DefaultIfEmpty()
                                 join e in unitOfWork.GetRepository <LTC_EMPFILE>().dbSet on ipd.NURSEAIDES equals e.EMPNO into em
                                 from emp in em.DefaultIfEmpty()
                                 select new DC_RegFileModel
                {
                    OrgId = ipd_reg.ORGID,
                    RegNo = ipd_reg.REGNO,
                    RegName = ipd_reg.REGNAME,
                    ResidentNo = ipd.RESIDENTNO,
                    Sex = ipd_reg.SEX,
                    BirthPlace = ipd_reg.BIRTHPLACE,
                    OriginPlace = ipd_reg.ORIGINPLACE,
                    BirthDate = ipd_reg.BIRTHDATE,
                    IdNo = ipd_reg.IDNO,
                    PType = ipd_reg.PTYPE,
                    Phone = ipd_reg.PHONE,
                    LivingAddress = ipd_reg.LIVINGADDRESS,
                    PermanentAddress = ipd_reg.PERMANENTADDRESS,
                    Language = ipd_reg.LANGUAGE,
                    Education = ipd_reg.EDUCATION,
                    LivCondition = ipd_reg.LIVCONDITION,
                    MerryState = ipd_reg.MERRYSTATE,
                    Profession = ipd_reg.PROFESSION,
                    Religion = ipd_reg.RELIGION,
                    EconomicSources = ipd_reg.ECONOMICSOURCES,
                    SourceType = ipd_reg.SOURCETYPE,
                    ObstacleManual = ipd_reg.OBSTACLEMANUAL,
                    DiseaseInfo = ipd_reg.DISEASEINFO,
                    SuretyName = ipd_reg.SURETYNAME,
                    SuretyAge = ipd_reg.SURETYAGE,
                    SuretyUnit = ipd_reg.SURETYUNIT,
                    SuretyAddress = ipd_reg.SURETYADDRESS,
                    SuretyEmail = ipd_reg.SURETYEMAIL,
                    SuretyTitle = ipd_reg.SURETYTITLE,
                    SP = ipd_reg.SURETYPHONE,
                    SuretyMobile = ipd_reg.SURETYMOBILE,
                    ContactName1 = ipd_reg.CONTACTNAME1,
                    ContactAge1 = ipd_reg.CONTACTAGE1,
                    ContactTitle1 = ipd_reg.CONTACTTITLE1,
                    ContactEmail1 = ipd_reg.CONTACTEMAIL1,
                    ContactAddress1 = ipd_reg.CONTACTADDRESS1,
                    CP1 = ipd_reg.CONTACTPHONE1,
                    ContactName2 = ipd_reg.CONTACTNAME2,
                    ContactAge2 = ipd_reg.CONTACTAGE2,
                    ContactTitle2 = ipd_reg.CONTACTTITLE2,
                    ContactEmail2 = ipd_reg.CONTACTEMAIL2,
                    ContactAddress2 = ipd_reg.CONTACTADDRESS2,
                    CP2 = ipd_reg.CONTACTPHONE2,
                    EcologicalMap = ipd_reg.ECOLOGICALMAP,
                    InDate = ipd.INDATE,
                    ContactMobile1 = ipd_reg.CONTACTMOBILE1,
                    ContactMobile2 = ipd_reg.CONTACTMOBILE2,
                    ContactUnit1 = ipd_reg.CONTACTUNIT1,
                    ContactUnit2 = ipd_reg.CONTACTUNIT2,
                    NickName = ipd_reg.NICKNAME,
                    OrgName = org.ORGNAME,
                    NurseAidesName = emp.EMPNAME
                }).FirstOrDefault();
                response.Data.Age = (DateTime.Now.Year - Convert.ToDateTime(response.Data.BirthDate).Year);
            }

            return(response);
        }