Example #1
0
        // GET: ScanRate
        public ActionResult Index(PartDataModel model, int?PageIndex, int?PageSize = 30)
        {
            try
            {
                List <ResScnRateDto> listend = new List <ResScnRateDto>();

                ViewBag.totalcount = 0;
                ViewBag.Line       = CommonHelp.list;
                if (PageIndex == null && model.StartTime < model.EndTime && !string.IsNullOrEmpty(model.Line))
                {
                    string key = Guid.NewGuid().ToString() + model.Line;
                    CommonHelp.key = key;
                    if (CommonBuffer.Exist(key))
                    {
                        CommonHelp.Listone <ResScnRateDto> .List = CommonBuffer.Get <List <ResScnRateDto> >(key);
                        ViewBag.count = CommonHelp.Listone <ResScnRateDto> .List.Count;
                        ViewBag.Data  = CommonHelp.Listone <ResScnRateDto> .List.Take(30).ToList();
                    }
                    else
                    {
                        CommonHelp.Listone <ResScnRateDto> .List = CommonBuffer.FindT(key, DapperService.SqlHelp.ScanRate, model);
                        ViewBag.count = CommonHelp.Listone <ResScnRateDto> .List.Count;
                        ViewBag.Data  = CommonHelp.Listone <ResScnRateDto> .List.Take(30).ToList();
                    }
                }
                if (PageIndex != null)
                {
                    var model1 = new PageInfoModel <ResScnRateDto>();
                    model1.List      = CommonHelp.Listone <ResScnRateDto> .List;
                    model1.PageSize  = PageSize;
                    model1.PageIndex = PageIndex;
                    var res = CommonHelp.PageList(model1);
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
Example #2
0
        /// <summary>
        /// 获取主要的一些调查问卷信息
        /// 作者:姚东
        /// 时间:20100925
        /// </summary>
        /// <returns></returns>
        public DataTable GetSurveyList()
        {
            string sql = @"select top 4 st.sID,
                case when len(st.SurveyName) <= 34 then 
                st.SurveyName else
                left(st.SurveyName,34)+'......' end as SurveyName,                
                convert(nvarchar(max),pt.PageContent) as PageContent,
                u.UserName,st.CreateDate,st.AnswerAmount,st.Point
                from UT_QS_SurveyTable as st
                inner join 
                UT_QS_PageTable as pt
                on st.sid = pt.sid
                and pt.PageNo=1
                inner join UT_Sys_User as u
                on st.uid = u.userid
                where st.IsDel=0 and st.state=1 and st.active=1 and datediff(day,getdate(),isnull(st.EndDate,'2199-12-31'))>=0 
                and (st.MaxAnswerAmount=0 or st.MaxAnswerAmount<>0 and st.AnswerAmount<st.MaxAnswerAmount) and ApprovalStaus=1 
                order by st.createdate desc";

            DataTable dt = NDDBAccess.Fill(sql);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string str = CommonHelp.StripHTML(dr["PageContent"].ToString());

                    if (str.Length > 120)
                    {
                        dr["PageContent"] = str.Substring(0, 120) + "...";
                    }
                    else
                    {
                        dr["PageContent"] = str;
                    }
                }
            }

            return(dt);
        }
Example #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            var controlXmlData = new OutpatientRegisterControlXmlDto()
            {
                TotalAmount = 3,
                Nums        = 1,
            };
            var detailRow = new List <OutpatientRegisterDataXmlRow>();

            detailRow.Add(new OutpatientRegisterDataXmlRow()
            {
                DirectoryName = "挂号费",
                MedicalInsuranceProjectCode = "ZL110100001",
                BusinessId  = CommonHelp.GuidToStr(Guid.NewGuid().ToString()),
                HappenTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                InputTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                Num         = 1,
                Price       = 3,
                Operator    = "李茜",
                TotalAmount = 3
            });
            var xmlData = new OutpatientRegisterDataXmlDto()
            {
                RegisterType = "1",
                MedicalInsuranceDepartmentCode = "02010000",
                OperatorTime       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                OperatorName       = "李茜",
                BaseDepartmentName = "内科",
                BaseDepartmentCode = "4617180898677846617",
                DetailRow          = detailRow
            };
            var controlXml = XmlHelp.YinHaiXmlSerialize(controlXmlData);
            var dataXml    = XmlHelp.YinHaiXmlSerialize(xmlData);
            var resultData = yinHaiService.OutpatientRegister(controlXml,
                                                              dataXml, UserId);
            var resultDto = JsonConvert.DeserializeObject <DealModel>(resultData.Data.ToString());

            var userData = XmlHelp.YinHaiDeSerializerXml <OutpatientRegisterOutputXmlDto>(resultDto.TransactionOutputXml);
            //MessageBoxShow(resultData);
        }
Example #4
0
        public ApiJsonResultData MedicalInsuranceXmlUpload([FromUri] MedicalInsuranceXmlUiParam param)
        {
            return(new ApiJsonResultData(ModelState, new UiInIParam()).RunWithTry(y =>
            {
                var userBase = webServiceBasicService.GetUserBaseInfo(param.UserId);

                var hospitalizationFeeList = hisSqlRepository.InpatientInfoDetailQuery(
                    new InpatientInfoDetailQueryParam()
                {
                    BusinessId = param.BusinessId
                });


                var rowXml = hospitalizationFeeList.Where(d => d.UploadMark == 0).Select(c => new HospitalizationFeeUploadRowXml()
                {
                    SerialNumber = c.DetailId
                }).ToList();


                var xmlData = new HospitalizationFeeUploadXml()
                {
                    MedicalInsuranceHospitalizationNo = "44116476",
                    RowDataList = rowXml,
                };
                var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
                //
                var transactionId = Guid.Parse("79D71ACA-EDBB-419C-A382-2271922E708D").ToString("N");
                var saveXmlData = new SaveXmlData();
                saveXmlData.OrganizationCode = userBase.OrganizationCode;
                saveXmlData.AuthCode = userBase.AuthCode;
                saveXmlData.BusinessId = param.BusinessId;
                saveXmlData.TransactionId = transactionId;
                saveXmlData.MedicalInsuranceBackNum = "CXJB004";
                saveXmlData.BackParam = CommonHelp.EncodeBase64("utf-8", strXmlBackParam);
                saveXmlData.IntoParam = CommonHelp.EncodeBase64("utf-8", strXmlBackParam);
                saveXmlData.MedicalInsuranceCode = "31";
                saveXmlData.UserId = userBase.UserId;
                webServiceBasic.HIS_InterfaceList("38", JsonConvert.SerializeObject(saveXmlData));
            }));
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool IsZiLvXiaoZu = false;

            //授权返回
            if (code.Length > 0)
            {
                WX_User      u        = WXFWHelp.GetWXUserInfoWithUpdateLocal(code);
                JH_Auth_User userInfo = new JH_Auth_UserB().GetEntity(d => d.WXopenid == u.Openid && d.IsWX == 1);
                if (userInfo != null)//已绑定手机号和姓名
                {
                    WXFWHelp.UpdateCookieAfterSignIn(userInfo);
                    IsZiLvXiaoZu = userInfo.ZiLvXiaoZu?.Trim().Length > 0;
                }
                else//未绑定手机号和姓名
                {
                    DateTime expires = DateTime.Now.AddMinutes(30);
                    CommonHelp.SetCookie("openid", u.Openid, expires);
                    Response.Redirect("/WX/BindPhone.html");
                }
            }
            string redirect_uri = CommonHelp.GetCookieString("pagehistory");

            if (redirect_uri.Trim().Length > 0)
            {
                Response.Redirect(HttpUtility.UrlDecode(redirect_uri));
            }
            else//默认返回页面
            {
                if (IsZiLvXiaoZu)
                {
                    Response.Redirect("/WX/ZLXZ/Home.html");
                }
                else
                {
                    Response.Redirect("/WX/BGXT/Index.html");
                }
            }
        }
Example #6
0
        /// <summary>
        /// 处方上传数据更新
        /// </summary>
        /// <param name="param"></param>
        /// <param name="batchConfirmFail"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public int UpdateHospitalizationFee(List <UpdateHospitalizationFeeParam> param, bool batchConfirmFail, UserInfoDto user)
        {
            int resultData = 0;

            using (var sqlConnection = new SqlConnection(_connectionString))
            {
                string querySql = null;
                try
                {
                    sqlConnection.Open();
                    if (param.Any())
                    {
                        if (batchConfirmFail == false)
                        {
                            foreach (var item in param)
                            {
                                querySql +=
                                    $@"update [dbo].[HospitalizationFee] set [UploadMark]=1,BatchNumber='{item.BatchNumber}',UploadAmount={item.UploadAmount},
                               TransactionId='{item.TransactionId}',UploadUserId='{user.UserId}',UploadUserName='******',UploadTime=GETDATE()
                               where id='{item.Id}' and IsDelete=0;";
                            }
                        }
                        else //更新批次确认失败
                        {
                            var updateId = CommonHelp.ListToStr(param.Select(c => c.Id.ToString()).ToList());
                            querySql = $"update [dbo].[HospitalizationFee] set [UploadMark]=0 where id in ({updateId});";
                        }
                        resultData = sqlConnection.Execute(querySql);
                        sqlConnection.Close();
                    }
                    return(resultData);
                }
                catch (Exception e)
                {
                    _log.Debug(querySql);
                    throw new Exception(e.Message);
                }
            }
        }
Example #7
0
        public ActionResult <string> Login(Object PostData)
        {
            JObject JsonData = JObject.FromObject(PostData);
            string  username = JsonData["UserName"] == null ? "" : JsonData["UserName"].ToString();
            string  password = JsonData["password"] == null ? "" : JsonData["password"].ToString();
            Dictionary <string, string> results3 = JsonConvert.DeserializeObject <Dictionary <string, string> >(PostData.ToString());

            Model.ErrorMsg = "";
            JH_Auth_QY qyModel = new JH_Auth_QYB().GetALLEntities().First();

            password = CommonHelp.GetMD5(password);
            JH_Auth_User        userInfo = new JH_Auth_User();
            List <JH_Auth_User> userList = new JH_Auth_UserB().GetEntities(d => (d.UserName == username || d.mobphone == username) && d.UserPass == password).ToList();

            if (userList.Count() == 0)
            {
                Model.ErrorMsg = "用户名或密码不正确";
            }
            else
            {
                userInfo = userList[0];
                if (userInfo.IsUse != "Y")
                {
                    Model.ErrorMsg = "用户被禁用,请联系管理员";
                }
                if (Model.ErrorMsg == "")
                {
                    Model.Result  = JwtHelper.CreateJWT(username, "Admin");
                    Model.Result1 = userInfo.UserName;
                    Model.Result2 = qyModel.FileServerUrl;
                    Model.Result4 = userInfo;

                    CacheHelp.Remove(userInfo.UserName);
                }
            }


            return(ControHelp.CovJson(Model));;
        }
Example #8
0
        public MainWindow()
        {
            CommonHelp.RegisterDll();
            InitializeComponent();
            try
            {
                im = new InstanceManager(this);
                //加载配置文件
                //检查catchdata
                AppUpdate();
                im.configManager.setConfig();
                im.userdatasummery.usbti.setData(Programe.ProgrameData.SimulationDataType, Programe.ProgrameData.SimulationDataDuration, Programe.ProgrameData.SimulationTeamEffect);
                //im.logger.Log("GFHelper启动");

                //初始化练级地图信息
            }
            catch (Exception e)
            {
                MessageBox.Show("GFHelper启动失败!错误原因: " + e.ToString());
            }
            //倒计时线程
        }
Example #9
0
        public ROZZJiaGongDetail(Query.ConditionPronoteHeader condition)
        {
            InitializeComponent();
            //IList<Model.PronoteHeader> list = pronoteHeaderManager.GetByDateMa(condition.StartDate, condition.EndDate, condition.Customer, condition.CusXOId, condition.Product, condition.PronoteHeaderIdStart, condition.PronoteHeaderIdEnd, condition.SourceTpye, null, false, condition.ProNameKey, condition.ProCusNameKey, condition.PronoteHeaderIdKey,true, false, false);
            IList <Model.PronoteHeader> list = pronoteHeaderManager.GetByDateMa(condition.StartDate, condition.EndDate, condition.Customer, condition.CusXOId, condition.Product, condition.PronoteHeaderIdStart, condition.PronoteHeaderIdEnd, condition.SourceTpye, null, false, condition.ProNameKey, condition.ProCusNameKey, condition.PronoteHeaderIdKey, false, false, false, condition.HandbookId);   //已经有了condition.SourceTpye条件

            if (list == null || list.Count <= 0)
            {
                throw new global::Helper.InvalidValueException("無數據");
            }
            foreach (Model.PronoteHeader detail in list)
            {
                if (!string.IsNullOrEmpty(detail.InvoiceXOId))
                {
                    detail.InvoiceXO = this.xomanamager.Get(detail.InvoiceXOId);
                }
                detail.MRSDetails = this.mrsdetailManager.Get(detail.MRSdetailsId);
                //if (detail.MRSDetails != null)
                //    detail.Plannum = detail.MRSDetails.MRSdetailsQuantity;

                if (string.IsNullOrEmpty(detail.CustomerProductName))
                {
                    detail.CustomerProductName = CommonHelp.GetCustomerProductNameByPronoteHeaderId(detail, detail.ProductId, detail.HandbookProductId);
                }
            }
            this.DataSource           = list;
            this.xrLabelDataName.Text = Properties.Resources.Pronotedetails;

            if (condition.SourceTpye == 5)
            {
                this.xrLabelDataName.Text = Properties.Resources.GZZhiShi;
            }
            else if (condition.SourceTpye == 4)
            {
                this.xrLabelDataName.Text = Properties.Resources.ZZJiaGong;
            }
            this.bind();
        }
Example #10
0
        public bool checkT()
        {
            try
            {
                string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); //获取主版本号

                im.eyLogin.SetAppKey("D5FA256E997E4E728DCEC4FB5111ACDF");                      // 设置程序秘钥~一定要设置,否则无法正常使用控件
                ProgrameData.UserMcCode = im.eyLogin.GetMachineCode();
                MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
                ProgrameData.UserMcCode = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(ProgrameData.UserMcCode)), 4, 8);
                ProgrameData.UserMcCode = ProgrameData.UserMcCode.Replace("-", "");
                ProgrameData.UserMcCode = ProgrameData.UserMcCode.ToLower();
                ProgrameData.UserMcCode = ProgrameData.UserMcCode.Remove(0, 1);
                ProgrameData.UserMcCode = ProgrameData.UserMcCode.Insert(0, "a");
                int ret0 = im.eyLogin.UserLogin(ProgrameData.UserMcCode, "a123456789", "v1.0.0", im.eyLogin.GetMachineCode());
                if (ret0 == 1)//登陆成功
                {
                    if (ProgrameData.UserClient == true)
                    {
                        im.eyLogin.OpenUserCheck();
                    }

                    return(true);
                }
                else
                {
                    MessageBox.Show("验证网络连接失败!");
                    MessageBox.Show("机器码 : " + ProgrameData.UserMcCode);
                    MessageBox.Show(CommonHelp.UnicodeToString(im.eyLogin.GetLastMessages()));
                    return(false);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                throw;
            }
        }
 public static List <AssembleSearchDto> list = new List <AssembleSearchDto>();//{ get; set; }
 // 页面初次加载
 public ActionResult Index(ForAssemblyModel model, int?PageIndex, int?PageSize = 30)
 {
     try
     {
         ViewBag.totalcount = 0;
         ViewBag.Line       = CommonHelp.list;
         if (PageIndex == null && model.StartTime < model.EndTime && !string.IsNullOrEmpty(model.Area))
         {
             model.EndTime   = Convert.ToDateTime(model.EndTime);
             model.StartTime = Convert.ToDateTime(model.StartTime);
             model.Area      = model.Area;
             if (model.FigureNo.IsNullOrEmpty())
             {
                 model.FigureNo = "";
             }
             list = GetAssemblyList(model).OrderBy(p => p.end_time).ToList();
             foreach (var item in list)
             {
                 item.area = model.Area;
             }
             ViewBag.totalcount = list.Count;
             ViewBag.list       = list.Take(30).ToList();
         }
         if (PageIndex != null)
         {
             var model1 = new PageInfoModel <AssembleSearchDto>();
             model1.List      = list;;
             model1.PageSize  = PageSize;
             model1.PageIndex = PageIndex;
             var res = CommonHelp.PageList(model1);
             return(Json(res, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
     }
     return(View());
 }
Example #12
0
        /// <summary>
        /// 检测数据
        /// </summary>
        /// <returns></returns>
        private bool CheckData()
        {
            if (string.IsNullOrEmpty(txtUserName.Text.Trim()))
            {
                hidInfo.Value = "请输入姓名!";
                return(false);
            }


            if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
            {
                if (!NDHelperDataCheck.IsEmail(txtEmail.Text.Trim()))
                {
                    hidInfo.Value = "电子邮件格式错误!";
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(txtMobilePhone.Text.Trim()))
            {
                if (!CommonHelp.PhoneNumberCheck(txtMobilePhone.Text.Trim()))
                {
                    hidInfo.Value = "手机号码格式错误!";
                    return(false);
                }
            }


            if (!string.IsNullOrEmpty(txtMobilePhone.Text.Trim()))
            {
                if (!UserQuery.CheckMobilePhone(txtMobilePhone.Text.Trim(), SessionState.UserID, (int)CommonEnum.OperationEnum.UPDATE))
                {
                    hidInfo.Value = "该手机号码已经使用,请重新输入手机号码!";
                    return(false);
                }
            }
            return(true);
        }
Example #13
0
 /// <summary>
 /// 从本地读取用户
 /// </summary>
 protected void RedUser()
 {
     try
     {
         DataSet ds = XmlSerializeHelper.XmlToDataTable(db.ReadXML());
         if (ds.Tables[0].Rows.Count > 5)
         {
             DataTable dt = CommonHelp.DtSelectTop(5, ds.Tables[0]);
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 cbox_user.Items.Add(dt.Rows[i]["name"].ToString());
             }
         }
         else
         {
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             {
                 cbox_user.Items.Add(ds.Tables[0].Rows[i]["name"].ToString());
             }
         }
     }
     catch { }
 }
Example #14
0
 private void WriteReport_Start()
 {
     if (UserData.UserDataSummery.battery < 1000)
     {
         return;
     }
     if (UserData.UserDataSummery.globalFreeExp < UserData.UserDataSummery.Furniture_database)
     {
         return;
     }
     if (im.BattleReport.Start_add == true)
     {
         return;
     }
     if (im.BattleReport.time > 0)
     {
         return;
     }
     ProgrameData.TaskList.Add(TaskList.BattleReport_Write);
     im.BattleReport.Start_add  = true;
     im.BattleReport.Finish_add = false;
     im.BattleReport.StartTime  = CommonHelp.ConvertDateTime_China_Int(DateTime.Now);
 }
Example #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <QueryThreeCataloguePairCodeUploadDto> ThreeCataloguePairCodeUpload(UpdateThreeCataloguePairCodeUploadParam param)
        {
            using (var sqlConnection = new SqlConnection(_connectionString))
            {
                string querySql = null;
                try
                {
                    sqlConnection.Open();
                    if (param.ProjectCodeList.Any())
                    {
                        var projectCodeList = CommonHelp.ListToStr(param.ProjectCodeList);

                        querySql = $@"select a.[Id],a.[ProjectCode],a.[ProjectName],[ProjectCodeType],ProjectLevel,
                                    [RestrictionSign],[Remark],b.DirectoryCode,[DirectoryCategoryCode]
                                    from [dbo].[MedicalInsuranceProject] as a inner join [dbo].[ThreeCataloguePairCode] as b
                                    on a.ProjectCode=b.ProjectCode where b.UploadState=0 and a.ProjectCode in({projectCodeList})
                                    and a.IsDelete=0 and b.IsDelete=0 and OrganizationCode='{param.User.OrganizationCode}'";
                    }
                    else
                    {
                        querySql = $@"select a.[Id],a.[ProjectCode],a.[ProjectName],[ProjectCodeType],ProjectLevel,
                                    [RestrictionSign],[Remark],b.DirectoryCode,[DirectoryCategoryCode]
                                    from [dbo].[MedicalInsuranceProject] as a inner join [dbo].[ThreeCataloguePairCode] as b
                                    on a.ProjectCode=b.ProjectCode where b.UploadState=0 
                                    and a.IsDelete=0 and b.IsDelete=0 and OrganizationCode='{param.User.OrganizationCode}'";
                    }
                    var data = sqlConnection.Query <QueryThreeCataloguePairCodeUploadDto>(querySql).ToList();
                    sqlConnection.Close();
                    return(data);
                }
                catch (Exception e)
                {
                    _log.Debug(querySql);
                    throw new Exception(e.Message);
                }
            }
        }
Example #16
0
        public ROZZJiaGongDetail(IList <Model.PronoteHeader> headerlist, int sourcetype)
        {
            InitializeComponent();
            IList <Model.PronoteHeader> list = headerlist;

            if (list == null || list.Count <= 0)
            {
                throw new global::Helper.InvalidValueException("無數據");
            }
            foreach (Model.PronoteHeader detail in list)
            {
                if (!string.IsNullOrEmpty(detail.InvoiceXOId))
                {
                    detail.InvoiceXO = this.xomanamager.Get(detail.InvoiceXOId);
                }
                detail.MRSDetails = this.mrsdetailManager.Get(detail.MRSdetailsId);
                //if (detail.MRSDetails != null)
                //    detail.Plannum = detail.MRSDetails.MRSdetailsQuantity;

                if (string.IsNullOrEmpty(detail.CustomerProductName))
                {
                    detail.CustomerProductName = CommonHelp.GetCustomerProductNameByPronoteHeaderId(detail, detail.ProductId, detail.HandbookProductId);
                }
            }
            this.DataSource           = list;
            this.xrLabelDataName.Text = Properties.Resources.Pronotedetails;

            if (sourcetype == 5)
            {
                this.xrLabelDataName.Text = Properties.Resources.GZZhiShi;
            }
            else if (sourcetype == 4)
            {
                this.xrLabelDataName.Text = Properties.Resources.ZZJiaGong;
            }
            this.bind();
        }
        /// <summary>
        /// 获取居民入院登记入参
        /// </summary>
        /// <param name="param"></param>
        /// <param name="paramDto"></param>
        /// <returns></returns>
        private ResidentHospitalizationRegisterParam GetResidentHospitalizationRegisterParam(
            ResidentHospitalizationRegisterUiParam param, InpatientInfoDto paramDto)
        {
            var iniParam      = new ResidentHospitalizationRegisterParam();
            var diagnosisData = CommonHelp.GetDiagnosis(param.DiagnosisList);

            iniParam.AdmissionMainDiagnosisIcd10 = diagnosisData.AdmissionMainDiagnosisIcd10;
            iniParam.DiagnosisIcd10Two           = diagnosisData.DiagnosisIcd10Two;
            iniParam.DiagnosisIcd10Three         = diagnosisData.DiagnosisIcd10Three;
            iniParam.AdmissionMainDiagnosis      = diagnosisData.DiagnosisDescribe;
            iniParam.IdentityMark            = param.IdentityMark;
            iniParam.AfferentSign            = param.AfferentSign;
            iniParam.MedicalCategory         = param.MedicalCategory;
            iniParam.FetusNumber             = param.FetusNumber;
            iniParam.HouseholdNature         = param.HouseholdNature;
            iniParam.AdmissionDate           = Convert.ToDateTime(paramDto.AdmissionDate).ToString("yyyyMMdd");
            iniParam.InpatientDepartmentCode = paramDto.InDepartmentName;
            iniParam.BedNumber         = paramDto.AdmissionBed;
            iniParam.HospitalizationNo = paramDto.HospitalizationNo;
            iniParam.Operators         = paramDto.AdmissionOperator;
            iniParam.InsuranceType     = param.InsuranceType;
            //iniParam.BusinessId = param.BusinessId;
            return(iniParam);
        }
Example #18
0
        public ActionResult <string> EXPORTBDTJDATA()
        {
            var           context     = _accessor.HttpContext;
            var           tokenHeader = context.Request.Cookies["szhlcode"].ToString().Replace("Bearer ", "");
            TokenModelJWT tokenModel  = JwtHelper.SerializeJWT(tokenHeader);

            JH_Auth_UserB.UserInfo UserInfo = new JH_Auth_UserB().GetUserInfo(10334, tokenModel.UserName);


            JObject JsonData = new JObject();
            string  P1       = context.Request.Query["P1"].ToString();
            string  P2       = context.Request.Query["P2"].ToString();
            string  sdate    = context.Request.Query["sdate"].ToString();
            string  edate    = context.Request.Query["edate"].ToString();

            JsonData.Add("P1", P1);
            JsonData.Add("P2", P2);
            JsonData.Add("sdate", sdate);
            JsonData.Add("edate", edate);

            new FORMBIManage().GETBDTJDATA(JsonData, Model, P1, P2, UserInfo);

            DataTable dt = Model.Result;

            string       sqlCol   = "CRUserName|发起人,CRDate|发起时间,BranchName|所在部门,";
            DataTable    dtResult = dt.DelTableCol(sqlCol);
            HSSFWorkbook workbook = new HSSFWorkbook();

            workbook = CommonHelp.ExportToExcel(dtResult);
            var stream = new NPOIMemoryStream();

            workbook.Write(stream);
            stream.Flush();
            stream.Position = 0;
            return(File(stream, "application/ms-excel", string.Format("{0}.xls", "导出文件_" + DateTime.Now.Ticks)));
        }
Example #19
0
        public Ro(Model.PCMouldOnlineCheck model)
            : this()
        {
            foreach (var item in model.Detail)
            {
                if (string.IsNullOrEmpty(item.Product.CustomerProductName))
                {
                    item.Product.CustomerProductName = CommonHelp.GetCustomerProductNameByInvoiceXOId(item.InvoiceXOId, item.ProductId);
                }
            }

            this.DataSource = model.Detail;

            this.lblCompanyName.Text = BL.Settings.CompanyChineseName;
            this.lblDate.Text        = model.PCMouldOnlineCheckDate.Value.ToString("yyyy-MM-dd");
            this.lblEmployee.Text    = model.Employee == null ? null : model.Employee.EmployeeName;
            this.lbl_Note.Text       = model.Note;

            this.TCProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.TCInvoiceCusId.DataBindings.Add("Text", this.DataSource, "InvoiceXO." + Model.InvoiceXO.PRO_CustomerInvoiceXOId);
            this.TCOnlineDate.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_OnlineDate, "{0:MM-dd HH:mm}");
            this.TCCheckDate.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_CheckDate, "{0:MM-dd HH:mm}");
            this.TCBurr.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_Burr);
            this.TCBruise.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_Bruise);
            this.TCShrink.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_Shrink);
            this.TCForColor.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_ForColor);
            this.TCFlap.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_Flap);
            this.TCSandwichedConfirm.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_SandwichedConfirm);
            this.TCMark.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_Mark);
            this.TCAbnormal.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_Abnormal);
            this.TCEmployee.DataBindings.Add("Text", this.DataSource, "Employee." + Model.Employee.PROPERTY_EMPLOYEENAME);
            this.TCCustomerProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);

            //2018年8月30日17:49:26
            this.TCAppearance.DataBindings.Add("Text", this.DataSource, Model.PCMouldOnlineCheckDetail.PRO_Appearance);
        }
        /// <summary>
        /// 获取生育入院登记入参
        /// </summary>
        /// <param name="inpatientInfo"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        private WorkerBirthHospitalizationRegisterParam GetWorkerHospitalizationWorkerBirth
            (InpatientInfoDto inpatientInfo, WorkerBirthHospitalizationRegisterUiParam param)
        {
            var iniParam = new WorkerBirthHospitalizationRegisterParam()
            {
                IdentityMark            = param.IdentityMark,
                AfferentSign            = param.AfferentSign,
                MedicalCategory         = param.MedicalCategory,
                FetusNumber             = param.FetusNumber,
                SpouseIdCardNo          = param.SpouseIdCardNo,
                SpouseName              = param.SpouseName,
                AdmissionDate           = Convert.ToDateTime(inpatientInfo.AdmissionDate).ToString("yyyyMMdd"),
                HospitalizationNo       = inpatientInfo.HospitalizationNo,
                Operators               = inpatientInfo.AdmissionOperator,
                InpatientDepartmentCode = inpatientInfo.InDepartmentName,
            };
            var diagnosisData = CommonHelp.GetDiagnosis(param.DiagnosisList);

            iniParam.AdmissionMainDiagnosisIcd10 = diagnosisData.AdmissionMainDiagnosisIcd10;
            iniParam.DiagnosisIcd10Two           = diagnosisData.DiagnosisIcd10Two;
            iniParam.DiagnosisIcd10Three         = diagnosisData.DiagnosisIcd10Three;
            iniParam.AdmissionMainDiagnosis      = diagnosisData.DiagnosisDescribe;
            return(iniParam);
        }
Example #21
0
        public bool readConfig()
        {
            try
            {
                if (!this.im.configManager.Load())
                {
                    MessageBox.Show("配置文件加载失败!");
                    CommonHelp.DownloadUIcfg();
                    Environment.Exit(0);
                }

                SystemInfo.UIcfg = this.im.configManager.getConfigDouble("UIcfg");
                if (SystemInfo.UIcfg < 0.13)
                {
                    MessageBox.Show(string.Format("开始下载UIconfig"));
                    string URLAddress = @"http://45.78.2.254/GF/UIconfig.cfg";
                    try
                    {
                        CommonHelp.client.DownloadFile(URLAddress, "UIconfig.cfg");
                    }
                    catch (Exception a)
                    {
                        MessageBox.Show(string.Format("下载UIconfig发生错误 : {0}", a.ToString()));
                    }
                    MessageBox.Show(string.Format("UIconfig下载完毕"));
                }

                SystemInfo.BattleMap               = this.im.configManager.getConfigString("BattleMap");
                SystemInfo.MainTeam                = this.im.configManager.getConfigString("MainTeam");
                SystemInfo.SupportTeam             = this.im.configManager.getConfigString("SupportTeam");
                SystemInfo.Fix                     = this.im.configManager.getConfigBool("Fix");
                SystemInfo.Fixmaxtime              = this.im.configManager.getConfigInt("Fixmaxtime");
                SystemInfo.Fixmintime              = this.im.configManager.getConfigInt("Fixmintime");
                SystemInfo.ResolutionRatio         = this.im.configManager.getConfigString("ResolutionRatio");
                SystemInfo.DebugMode               = this.im.configManager.getConfigBool("DebugMode");
                SystemInfo.WaitTime                = this.im.configManager.getConfigDouble("WaitTime");
                SystemInfo.Supply                  = this.im.configManager.getConfigBool("Supply");
                SystemInfo.AutoTeam1               = this.im.configManager.getConfigString("AutoTeam1");
                SystemInfo.AutoTeam2               = this.im.configManager.getConfigString("AutoTeam2");
                SystemInfo.AutoTeam3               = this.im.configManager.getConfigString("AutoTeam3");
                SystemInfo.AutoTeam4               = this.im.configManager.getConfigString("AutoTeam4");
                SystemInfo.AutoMap                 = this.im.configManager.getConfigString("AutoMap");
                SystemInfo.RoundInterval           = this.im.configManager.getConfigInt("RoundInterval");
                SystemInfo.BattleLoopUnLockWindows = this.im.configManager.getConfigBool("BattleLoopUnLockWindows");
                SystemInfo.BattleSupport_plus      = this.im.configManager.getConfigBool("BattleSupport_plus");
                SystemInfo.SetMap                  = this.im.configManager.getConfigBool("SetMap");
                SystemInfo.FixMinPercentage        = this.im.configManager.getConfigInt("FixMinPercentage");
                SystemInfo.FixMaxPercentage        = this.im.configManager.getConfigInt("FixMaxPercentage");
                SystemInfo.FixType                 = this.im.configManager.getConfigInt("FixType");
                SystemInfo.Team_SerrorTime         = this.im.configManager.getConfigInt("Team_SerrorTime");
                SystemInfo.EquipmentUpdateType     = this.im.configManager.getConfigString("EquipmentUpdateType");
                SystemInfo.EquipmentUpdatePostion  = this.im.configManager.getConfigString("EquipmentUpdatePostion");
                SystemInfo.EquipmentUpdateCount    = this.im.configManager.getConfigInt("EquipmentUpdateCount");
                SystemInfo.LogisticsTask1          = this.im.configManager.getConfigString("LogisticsTask1");
                SystemInfo.LogisticsTask2          = this.im.configManager.getConfigString("LogisticsTask2");
                SystemInfo.LogisticsTask3          = this.im.configManager.getConfigString("LogisticsTask3");
                SystemInfo.LogisticsTask4          = this.im.configManager.getConfigString("LogisticsTask4");
                //SystemInfo.LogisticFinishWaittingTime = this.im.configManager.getConfigInt("LogisticFinishWaittingTime");
                SystemInfo.Simulator                        = this.im.configManager.getConfigInt("Simulator");
                SystemInfo.BindWindowsType                  = this.im.configManager.getConfigInt("BindWindowsType");
                SystemInfo.LockWindows                      = this.im.configManager.getConfigBool("LockWindows");
                SystemInfo.FindTeamSlectStrSim              = this.im.configManager.getConfigDouble("FindTeamSlectStrSim");
                SystemInfo.FindTeamSlectStrColorOffset      = this.im.configManager.getConfigInt("FindTeamSlectStrColorOffset");
                SystemInfo.BattleMissionSlectStrSim         = this.im.configManager.getConfigDouble("BattleMissionSlectStrSim");
                SystemInfo.BattleMissionSlectStrColorOffset = this.im.configManager.getConfigInt("BattleMissionSlectStrColorOffset");
                SystemInfo.SetMapType                       = this.im.configManager.getConfigInt("SetMapType");
                SystemInfo.SimulatorCheckTime               = this.im.configManager.getConfigInt("SimulatorCheckTime");
                SystemInfo.Time15AddGetFriendBattery        = this.im.configManager.getConfigBool("Time15AddGetFriendBattery");
                SystemInfo.Time3AddGetFriendBattery         = this.im.configManager.getConfigBool("Time3AddGetFriendBattery");
                SystemInfo.GetFriendBatterySecondLoop       = this.im.configManager.getConfigBool("GetFriendBatterySecondLoop");
                SystemInfo.GetFriendBatteryCapt             = this.im.configManager.getConfigBool("GetFriendBatteryCapt");
                SystemInfo.GetFriendBattleryDelayM          = this.im.configManager.getConfigInt("GetFriendBattleryDelayM");
                SystemInfo.GetFriendBattleryDelayH          = this.im.configManager.getConfigInt("GetFriendBattleryDelayH");
            }
            catch (Exception e)
            {
                //im.logger.Log(e);
                MessageBox.Show("配置读取失败!错误原因: " + e.ToString());
                return(false);
            }


            return(true);
        }
        /// <summary>
        /// 职工生育预结算
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public WorkerHospitalizationPreSettlementDto WorkerBirthPreSettlement(WorkerBirthPreSettlementUiParam param)
        {
            //获取操作人员信息
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var queryResidentParam = new QueryMedicalInsuranceResidentInfoParam()
            {
                BusinessId       = param.BusinessId,
                OrganizationCode = userBase.OrganizationCode
            };
            var infoData = new GetInpatientInfoParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            };
            //获取his结算
            var settlementData = _serviceBasicService.GetHisHospitalizationSettlement(infoData);

            //获取医保病人信息
            var residentData = _medicalInsuranceSqlRepository.QueryMedicalInsuranceResidentInfo(queryResidentParam);

            if (string.IsNullOrWhiteSpace(settlementData.LeaveHospitalDate))
            {
                throw new Exception("当前病人在基层中未办理出院,不能办理医保预结算!!!");
            }

            var preSettlement = new WorkerBirthPreSettlementParam()
            {
                MedicalCategory = param.MedicalCategory,
                FetusNumber     = param.FetusNumber,
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceHospitalizationNo,
                LeaveHospitalDate = Convert.ToDateTime(settlementData.LeaveHospitalDate).ToString("yyyyMMdd"),
            };
            //获取诊断
            var diagnosisData = CommonHelp.GetDiagnosis(param.DiagnosisList);

            preSettlement.AdmissionMainDiagnosisIcd10 = diagnosisData.AdmissionMainDiagnosisIcd10;
            preSettlement.DiagnosisIcd10Two           = diagnosisData.DiagnosisIcd10Two;
            preSettlement.DiagnosisIcd10Three         = diagnosisData.DiagnosisIcd10Three;
            //医保结算
            var resultData = _workerMedicalInsuranceRepository.WorkerBirthPreSettlement(preSettlement);

            //报销金额 =统筹支付+补充医疗保险支付金额+专项基金支付金额+
            //公务员补贴+公务员补助+其它支付金额
            decimal reimbursementExpenses = resultData.BasicOverallPay + resultData.SupplementPayAmount + resultData.SpecialFundPayAmount
                                            + resultData.CivilServantsSubsidies + resultData.CivilServantsSubsidy + resultData.OtherPaymentAmount;
            var updateParam = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                ReimbursementExpensesAmount = CommonHelp.ValueToDouble(reimbursementExpenses),
                SelfPayFeeAmount            = resultData.CashPayment,
                OtherInfo    = JsonConvert.SerializeObject(resultData),
                Id           = residentData.Id,
                UserId       = userBase.UserId,
                SettlementNo = resultData.DocumentNo,
                MedicalInsuranceAllAmount  = resultData.TotalAmount,
                PreSettlementTransactionId = userBase.TransKey,
                MedicalInsuranceState      = MedicalInsuranceState.MedicalInsurancePreSettlement
            };

            //存入中间库
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParam);
            var logParam = new AddHospitalLogParam()
            {
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(resultData),
                User            = userBase,
                Remark          = "职工生育住院病人预结算"
            };

            _systemManageRepository.AddHospitalLog(logParam);

            return(resultData);
        }
        /// <summary>
        /// 职工生育结算
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public WorkerHospitalizationPreSettlementDto WorkerBirthSettlement(WorkerBirthSettlementUiParam param)
        {
            //获取操作人员信息
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var infoData = new GetInpatientInfoParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            };
            //获取his结算
            var hisSettlement      = _serviceBasicService.GetHisHospitalizationSettlement(infoData);
            var queryResidentParam = new QueryMedicalInsuranceResidentInfoParam()
            {
                BusinessId       = param.BusinessId,
                OrganizationCode = userBase.OrganizationCode
            };
            //获取医保病人信息
            var residentData = _medicalInsuranceSqlRepository.QueryMedicalInsuranceResidentInfo(queryResidentParam);

            if (residentData.MedicalInsuranceState == MedicalInsuranceState.HisSettlement)
            {
                throw new Exception("当前病人已办理医保结算,不能办理预结算!!!");
            }
            if (residentData.MedicalInsuranceState != MedicalInsuranceState.MedicalInsurancePreSettlement)
            {
                throw new Exception("当前病人未办理预结算,不能办理结算!!!");
            }
            var inpatientInfoParam = new QueryInpatientInfoParam()
            {
                BusinessId = param.BusinessId
            };
            //获取住院病人
            var inpatientInfoData = _hisSqlRepository.QueryInpatientInfo(inpatientInfoParam);

            if (inpatientInfoData == null)
            {
                throw new Exception("该病人未在中心库中,请检查是否办理医保入院!!!");
            }

            var infoParam = new WorkerBirthSettlementParam()
            {
                LeaveHospitalInpatientState = param.LeaveHospitalInpatientState,
                FetusNumber     = param.FetusNumber,
                MedicalCategory = param.MedicalCategory,
                Operator        = userBase.UserName,
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceHospitalizationNo,
                LeaveHospitalDate = Convert.ToDateTime(hisSettlement.LeaveHospitalDate).ToString("yyyyMMdd"),
            };
            //获取诊断
            var diagnosisData = CommonHelp.GetDiagnosis(param.DiagnosisList);

            infoParam.AdmissionMainDiagnosisIcd10 = diagnosisData.AdmissionMainDiagnosisIcd10;
            infoParam.DiagnosisIcd10Two           = diagnosisData.DiagnosisIcd10Two;
            infoParam.DiagnosisIcd10Three         = diagnosisData.DiagnosisIcd10Three;
            infoParam.AdmissionMainDiagnosis      = diagnosisData.DiagnosisDescribe;

            // 医保
            var resultData = _workerMedicalInsuranceRepository.WorkerBirthSettlement(infoParam);
            //报销金额 =统筹支付+补充医疗保险支付金额+专项基金支付金额+
            //公务员补贴+公务员补助+其它支付金额
            decimal reimbursementExpenses = resultData.BasicOverallPay + resultData.SupplementPayAmount + resultData.SpecialFundPayAmount
                                            + resultData.CivilServantsSubsidies + resultData.CivilServantsSubsidy + resultData.OtherPaymentAmount;

            resultData.ReimbursementExpenses = reimbursementExpenses;
            var updateData = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId = userBase.UserId,
                ReimbursementExpensesAmount = CommonHelp.ValueToDouble(reimbursementExpenses),
                SelfPayFeeAmount            = resultData.CashPayment,
                OtherInfo    = JsonConvert.SerializeObject(resultData),
                Id           = residentData.Id,
                SettlementNo = resultData.DocumentNo,
                MedicalInsuranceAllAmount = resultData.TotalAmount,
                SettlementTransactionId   = userBase.UserId,
                MedicalInsuranceState     = MedicalInsuranceState.MedicalInsuranceSettlement
            };

            //存入中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateData);
            //添加日志
            var logParam = new AddHospitalLogParam()
            {
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(resultData),
                User            = userBase,
                Remark          = "职工住院结算",
                RelationId      = residentData.Id,
            };
            //存入基层
            var userInfoData = _residentMedicalInsuranceRepository.GetUserInfo(new ResidentUserInfoParam()
            {
                IdentityMark = residentData.IdentityMark,
                AfferentSign = residentData.AfferentSign,
            });

            // 回参构建
            var xmlData = new HospitalSettlementXml()
            {
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceHospitalizationNo,
                CashPayment      = resultData.CashPayment,
                SettlementNo     = resultData.DocumentNo,
                PaidAmount       = resultData.PaidAmount,
                AllAmount        = resultData.TotalAmount,
                PatientName      = userInfoData.PatientName,
                AccountBalance   = userInfoData.WorkersInsuranceBalance,
                AccountAmountPay = resultData.AccountPayment,
            };


            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = userBase,
                MedicalInsuranceBackNum = resultData.DocumentNo,
                MedicalInsuranceCode    = "41",
                BusinessId = param.BusinessId,
                BackParam  = strXmlBackParam
            };

            //结算存基层
            _webBasicRepository.SaveXmlData(saveXml);

            var updateParamData = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId = param.UserId,
                Id     = residentData.Id,
                MedicalInsuranceState = MedicalInsuranceState.HisSettlement,
                IsHisUpdateState      = true
            };

            //  更新中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParamData);


            //结算后保存信息
            var saveParam = AutoMapper.Mapper.Map <SaveInpatientSettlementParam>(hisSettlement);

            saveParam.Id   = (Guid)inpatientInfoData.Id;
            saveParam.User = userBase;
            saveParam.LeaveHospitalDiagnosisJson = JsonConvert.SerializeObject(param.DiagnosisList);
            _hisSqlRepository.SaveInpatientSettlement(saveParam);
            return(resultData);
        }
Example #24
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";
            string strAction = context.Request["Action"] ?? "";
            string UserName  = context.Request["UserName"] ?? "";
            string strIP     = CommonHelp.getIP(context);

            Msg_Result Model = new Msg_Result()
            {
                Action = strAction.ToUpper(), ErrorMsg = ""
            };

            if (!string.IsNullOrEmpty(strAction))
            {
                #region 企业号应用callback
                if (strAction == "XXJS")
                {
                    String strCorpID = context.Request["corpid"] ?? "";
                    string strCode   = context.Request["Code"] ?? "";
                    try
                    {
                        JH_Auth_QY    jaq = new JH_Auth_QYB().GetALLEntities().FirstOrDefault();
                        JH_Auth_Model jam = new JH_Auth_ModelB().GetEntity(p => p.ModelCode == strCode);
                        //if (jaq != null && jam != null && !string.IsNullOrEmpty(jam.TJId))
                        if (jaq != null && jam != null)
                        {
                            #region POST
                            if (HttpContext.Current.Request.HttpMethod.ToUpper() == "POST")
                            {
                                string signature = HttpContext.Current.Request.QueryString["msg_signature"];//企业号的 msg_signature
                                string timestamp = HttpContext.Current.Request.QueryString["timestamp"];
                                string nonce     = HttpContext.Current.Request.QueryString["nonce"];

                                // 获得客户端RAW HttpRequest
                                StreamReader srResult    = new StreamReader(context.Request.InputStream);
                                string       str         = srResult.ReadToEnd();
                                XmlDocument  XmlDocument = new XmlDocument();
                                XmlDocument.LoadXml(HttpContext.Current.Server.UrlDecode(str));
                                string ToUserName = string.Empty;
                                string strde      = string.Empty;
                                string msgtype    = string.Empty;//微信响应类型
                                foreach (XmlNode xn in XmlDocument.ChildNodes[0].ChildNodes)
                                {
                                    if (xn.Name == "ToUserName")
                                    {
                                        ToUserName = xn.InnerText;
                                    }
                                }
                                var pj = new JH_Auth_WXPJB().GetEntity(p => p.TJID == jam.TJId);
                                Tencent.WXBizMsgCrypt wxcpt = new Tencent.WXBizMsgCrypt(pj.Token, pj.EncodingAESKey, ToUserName);
                                int         n            = wxcpt.DecryptMsg(signature, timestamp, nonce, str, ref strde);
                                XmlDocument XmlDocument1 = new XmlDocument();
                                XmlDocument1.LoadXml(HttpContext.Current.Server.UrlDecode(strde));
                                foreach (XmlNode xn1 in XmlDocument1.ChildNodes[0].ChildNodes)
                                {
                                    if (xn1.Name == "MsgType")
                                    {
                                        msgtype = xn1.InnerText;
                                    }
                                    //CommonHelp.WriteLOG(XmlDocument1.OuterXml);
                                }
                                if (msgtype == "event")//处理事件
                                {
                                    //需要处理进入应用的菜单更改事件
                                    string strEvent    = XmlDocument1.ChildNodes[0]["Event"].InnerText;
                                    string strUserName = XmlDocument1.ChildNodes[0]["FromUserName"].InnerText;
                                    string strAgentID  = XmlDocument1.ChildNodes[0]["AgentID"].InnerText;
                                    string strEventKey = XmlDocument1.ChildNodes[0]["EventKey"].InnerText;

                                    if (strEvent.ToLower() == "enter_agent" || strEvent.ToLower() == "view")
                                    {
                                        //进入应用和点击菜单
                                        //JH_Auth_User jau = new JH_Auth_UserB().GetEntity(p => p.ComId == jaq.ComId && p.UserName == strUserName);
                                        //JH_Auth_QY_Model jhqm = new JH_Auth_QY_ModelB().GetEntity(p => p.ComId == jaq.ComId && p.AgentId == strAgentID);
                                        //if (jau != null && jhqm != null)
                                        //{
                                        //    JH_Auth_YYLog jay = new JH_Auth_YYLog();
                                        //    jay.ComId = jaq.ComId;
                                        //    jay.AgentID = strAgentID;
                                        //    jay.CorpID = strCorpID;
                                        //    jay.CRDate = DateTime.Now;
                                        //    jay.CRUser = strUserName;
                                        //    jay.Event = strEvent;
                                        //    jay.EventKey = strEventKey;
                                        //    jay.ModelCode = strCode;
                                        //    jay.ModelID = jhqm.ModelID;
                                        //    jay.QYName = jaq.QYName;
                                        //    jay.TJID = jam.TJId;
                                        //    jay.Type = msgtype;
                                        //    jay.UserName = strUserName;
                                        //    jay.UserRealName = jau.UserRealName;

                                        //    new JH_Auth_YYLogB().Insert(jay);

                                        //    if (strEvent.ToLower() == "enter_agent")
                                        //    {
                                        //        var jays = new JH_Auth_YYLogB().GetEntities(p => p.ComId == jaq.ComId && p.Event == "enter_agent" && p.AgentID == strAgentID && p.CRUser == strUserName);
                                        //        if (jays.Count() <= 1)
                                        //        {
                                        //        }
                                        //    }
                                        //}
                                    }
                                }
                                if (new List <string> {
                                    "text", "image", "voice", "video", "shortvideo", "link"
                                }.Contains(msgtype))                                                                               //处理消息事件
                                {
                                    if (XmlDocument1.ChildNodes.Count > 0)
                                    {
                                        JH_Auth_WXMSG wxmsgModel = new JH_Auth_WXMSG();
                                        wxmsgModel.AgentID      = int.Parse(XmlDocument1.ChildNodes[0]["AgentID"].InnerText);
                                        wxmsgModel.ComId        = jaq.ComId;
                                        wxmsgModel.ToUserName   = XmlDocument1.ChildNodes[0]["ToUserName"].InnerText;
                                        wxmsgModel.FromUserName = XmlDocument1.ChildNodes[0]["FromUserName"].InnerText;
                                        wxmsgModel.CRDate       = DateTime.Now;
                                        wxmsgModel.CRUser       = XmlDocument1.ChildNodes[0]["FromUserName"].InnerText;
                                        wxmsgModel.MsgId        = XmlDocument1.ChildNodes[0]["MsgId"].InnerText;
                                        wxmsgModel.MsgType      = msgtype;
                                        wxmsgModel.ModeCode     = strCode;
                                        wxmsgModel.Tags         = "微信收藏";

                                        switch (msgtype)
                                        {
                                        case "text":
                                            wxmsgModel.MsgContent = XmlDocument1.ChildNodes[0]["Content"].InnerText;
                                            break;

                                        case "image":
                                            wxmsgModel.PicUrl  = XmlDocument1.ChildNodes[0]["PicUrl"].InnerText;
                                            wxmsgModel.MediaId = XmlDocument1.ChildNodes[0]["MediaId"].InnerText;
                                            break;

                                        case "voice":
                                            wxmsgModel.MediaId = XmlDocument1.ChildNodes[0]["MediaId"].InnerText;
                                            wxmsgModel.Format  = XmlDocument1.ChildNodes[0]["Format"].InnerText;
                                            break;

                                        case "video":
                                            wxmsgModel.MediaId      = XmlDocument1.ChildNodes[0]["MediaId"].InnerText;
                                            wxmsgModel.ThumbMediaId = XmlDocument1.ChildNodes[0]["ThumbMediaId"].InnerText;
                                            break;

                                        case "shortvideo":
                                            wxmsgModel.MediaId      = XmlDocument1.ChildNodes[0]["MediaId"].InnerText;
                                            wxmsgModel.ThumbMediaId = XmlDocument1.ChildNodes[0]["ThumbMediaId"].InnerText;
                                            break;

                                        case "link":
                                            wxmsgModel.Description = XmlDocument1.ChildNodes[0]["Description"].InnerText;
                                            wxmsgModel.Title       = XmlDocument1.ChildNodes[0]["Title"].InnerText;
                                            wxmsgModel.URL         = XmlDocument1.ChildNodes[0]["Url"].InnerText;
                                            wxmsgModel.PicUrl      = XmlDocument1.ChildNodes[0]["PicUrl"].InnerText;
                                            break;
                                        }
                                        if (new List <string>()
                                        {
                                            "link", "text"
                                        }.Contains(msgtype))
                                        {
                                            if (msgtype == "link")
                                            {
                                                var jaw = new JH_Auth_WXMSGB().GetEntity(p => p.ComId == jaq.ComId && p.MsgId == wxmsgModel.MsgId);
                                                if (jaw == null)
                                                {
                                                    string strMedType = ".jpg";
                                                    JH_Auth_UserB.UserInfo UserInfo = new JH_Auth_UserB.UserInfo();
                                                    UserInfo = new JH_Auth_UserB().GetUserInfo(jaq.ComId, wxmsgModel.FromUserName);
                                                    string fileID = CommonHelp.ProcessWxIMGUrl(wxmsgModel.PicUrl, UserInfo, strMedType);

                                                    wxmsgModel.FileId = fileID;
                                                    new JH_Auth_WXMSGB().Insert(wxmsgModel);

                                                    if (strCode == "TSSQ")
                                                    {
                                                        SZHL_TXSX tx1 = new SZHL_TXSX();
                                                        tx1.ComId   = jaq.ComId;
                                                        tx1.APIName = "TSSQ";
                                                        tx1.MsgID   = wxmsgModel.ID.ToString();
                                                        tx1.FunName = "SENDWXMSG";
                                                        tx1.Date    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                                        tx1.CRUser  = wxmsgModel.CRUser;
                                                        tx1.CRDate  = DateTime.Now;
                                                        TXSX.TXSXAPI.AddALERT(tx1); //时间为发送时间
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                new JH_Auth_WXMSGB().Insert(wxmsgModel);
                                            }
                                        }
                                        if (!string.IsNullOrEmpty(wxmsgModel.MediaId))
                                        {
                                            var jaw = new JH_Auth_WXMSGB().GetEntity(p => p.ComId == jaq.ComId && p.MediaId == wxmsgModel.MediaId);
                                            if (jaw == null)
                                            {
                                                string strMedType = ".jpg";
                                                if (strCode == "QYWD" || strCode == "CRM")             //判断模块
                                                {
                                                    if (msgtype == "shortvideo" || msgtype == "video") //视频,小视频
                                                    {
                                                        strMedType = ".mp4";
                                                    }
                                                    if (new List <string>()
                                                    {
                                                        "image", "shortvideo", "video", "voice"
                                                    }.Contains(msgtype))                                                                 //下载到本地服务器
                                                    {
                                                        JH_Auth_UserB.UserInfo UserInfo = new JH_Auth_UserB.UserInfo();
                                                        UserInfo = new JH_Auth_UserB().GetUserInfo(jaq.ComId, wxmsgModel.FromUserName);
                                                        string fileID = CommonHelp.ProcessWxIMG(wxmsgModel.MediaId, strCode, UserInfo, strMedType);
                                                        wxmsgModel.FileId = fileID;
                                                        new JH_Auth_WXMSGB().Insert(wxmsgModel);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion

                            #region GET
                            if (HttpContext.Current.Request.HttpMethod.ToUpper() == "GET")
                            {
                                Auth(jam.Token, jam.EncodingAESKey, jaq.corpId);
                            }
                            #endregion
                        }
                    }
                    catch (Exception ex)
                    {
                        Model.ErrorMsg = ex.ToString();
                        CommonHelp.WriteLOG(ex.ToString());
                    }
                }
                #endregion

                #region 企业会话
                if (strAction == "QYIM")
                {
                    if (HttpContext.Current.Request.HttpMethod.ToUpper() == "POST")
                    {
                        string corpId = context.Request["corpid"] ?? "";

                        try
                        {
                            JH_Auth_QY jaq = new JH_Auth_QYB().GetEntity(p => p.corpId == corpId);
                            if (jaq != null)
                            {
                                string signature = HttpContext.Current.Request.QueryString["msg_signature"];//企业号的 msg_signature
                                string timestamp = HttpContext.Current.Request.QueryString["timestamp"];
                                string nonce     = HttpContext.Current.Request.QueryString["nonce"];

                                // 获得客户端RAW HttpRequest
                                StreamReader srResult = new StreamReader(context.Request.InputStream);
                                string       str      = srResult.ReadToEnd();

                                string strde = string.Empty;

                                var pj = new JH_Auth_WXPJB().GetEntity(p => p.TJID == "tj7882b1f8bc56f05f");

                                Tencent.WXBizMsgCrypt wxcpt = new Tencent.WXBizMsgCrypt(pj.Token, pj.EncodingAESKey, corpId);

                                wxcpt.DecryptMsg(signature, timestamp, nonce, str, ref strde);

                                //string strde = HttpContext.Current.Request.QueryString[0];

                                XmlDocument XmlDocument = new XmlDocument();
                                XmlDocument.LoadXml(HttpContext.Current.Server.UrlDecode(strde));

                                string AgentType  = string.Empty;
                                string ToUserName = string.Empty;
                                string ItemCount  = string.Empty;
                                string PackageId  = string.Empty;
                                string Item       = string.Empty;

                                #region XML文档处理
                                foreach (XmlNode xn in XmlDocument.ChildNodes[0].ChildNodes)
                                {
                                    if (xn.Name == "AgentType")
                                    {
                                        AgentType = xn.InnerText;
                                    }
                                    if (xn.Name == "ToUserName")
                                    {
                                        ToUserName = xn.InnerText;
                                    }
                                    if (xn.Name == "ItemCount")
                                    {
                                        ItemCount = xn.InnerText;
                                    }
                                    if (xn.Name == "PackageId")
                                    {
                                        PackageId = xn.InnerText;
                                    }
                                    if (xn.Name == "Item")
                                    {
                                        Item += xn.InnerXml;

                                        string MsgType = xn.ChildNodes[2].InnerText;

                                        if (MsgType == "event")
                                        {
                                        }
                                        else if (new List <string> {
                                            "text", "image", "voice", "file", "link"
                                        }.Contains(MsgType))
                                        {
                                            #region 内容处理


                                            #endregion
                                        }
                                    }
                                }
                                #endregion

                                HttpContext.Current.Response.Write(PackageId);
                                HttpContext.Current.Response.End();
                            }
                        }
                        catch (Exception ex)
                        {
                            CommonHelp.WriteLOG("QYIM:" + ex.ToString() + "\r\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        }
                    }
                }
                #endregion

                #region 获取唯一code
                if (strAction.ToUpper() == "GetUserCodeByCode".ToUpper())
                {
                    #region 获取Code
                    Model.ErrorMsg = "获取Code错误,请重试";

                    string strCode      = context.Request["code"] ?? "";
                    string strCorpID    = context.Request["corpid"] ?? "";
                    string strModelCode = context.Request["funcode"] ?? "";

                    if (!string.IsNullOrEmpty(strCode))
                    {
                        var qy = new JH_Auth_QYB().GetEntity(p => p.corpId == strCorpID);
                        if (qy != null)
                        {
                            try
                            {
                                //通过微信接口获取用户名
                                WXHelp wx       = new WXHelp(qy);
                                string username = wx.GetUserDataByCode(strCode, strModelCode);
                                if (!string.IsNullOrEmpty(username))
                                {
                                    var jau = new JH_Auth_UserB().GetUserByUserName(qy.ComId, username);
                                    if (jau != null)
                                    {
                                        //如果PCCode为空或者超过60分钟没操作,统统重新生成PCCode,并更新最新操作时间
                                        if (jau.logindate == null)
                                        {
                                            jau.logindate = DateTime.Now;
                                        }
                                        TimeSpan ts = new TimeSpan(jau.logindate.Value.Ticks).Subtract(new TimeSpan(DateTime.Now.Ticks)).Duration();
                                        if (string.IsNullOrEmpty(jau.pccode) || ts.TotalMinutes > 60)
                                        {
                                            string strGuid = CommonHelp.CreatePCCode(jau);
                                            jau.pccode    = strGuid;
                                            jau.logindate = DateTime.Now;
                                            new JH_Auth_UserB().Update(jau);
                                        }
                                        Model.ErrorMsg = "";
                                        Model.Result   = jau.pccode;
                                        Model.Result1  = jau.UserName;
                                        Model.Result2  = ts.TotalMinutes;
                                    }
                                }
                                else
                                {
                                    Model.ErrorMsg = "当前用户不存在";
                                }
                            }
                            catch (Exception ex)
                            {
                                Model.ErrorMsg = ex.ToString();
                            }
                        }
                        else
                        {
                            Model.ErrorMsg = "当前企业号未在电脑端注册";
                        }
                    }
                    else
                    {
                        Model.ErrorMsg = "Code为空";
                    }
                    #endregion
                }
                #endregion
                #region 是否存在
                if (strAction.ToUpper() == "isexist".ToUpper())
                {
                    string strcorpid = context.Request["corpid"] ?? "";
                    if (strcorpid != "")
                    {
                        var qy = new JH_Auth_QYB().GetEntity(p => p.corpId == strcorpid);
                        if (qy == null)
                        {
                            Model.ErrorMsg = "当前企业号未注册此平台";
                        }
                        else
                        {
                            if (context.Request.Cookies["szhlcode"] != null)
                            {
                                //通过Cookies获取Code
                                //string szhlcode = "5ab470be-4988-4bb3-9658-050481b98fca";
                                string szhlcode = context.Request.Cookies["szhlcode"].Value.ToString();
                                //通过Code获取用户名,然后执行接口方法
                                var jau = new JH_Auth_UserB().GetUserByPCCode(szhlcode);
                                if (jau == null)
                                {
                                    Model.ErrorMsg = "用户Code不存在";
                                }
                                else
                                {
                                    if (new JH_Auth_QYB().GetEntity(d => d.ComId == jau.ComId.Value).corpId != strcorpid)
                                    {
                                        Model.ErrorMsg = "企业需要重新选择";
                                    }
                                    //重写CODE
                                }
                            }
                        }
                    }
                    else
                    {
                        Model.ErrorMsg = "企业号连接有误,请重新连接";
                    }
                }
                #endregion
                #region 发送提醒
                if (strAction.ToUpper() == "AUTOALERT")
                {
                    TXSX.TXSXAPI.AUTOALERT();
                }
                #endregion
            }
            else
            {
                #region 获取SuiteTicket
                if (HttpContext.Current.Request.HttpMethod.ToUpper() == "POST")
                {
                    string signature = HttpContext.Current.Request.QueryString["msg_signature"];//企业号的 msg_signature
                    string timestamp = HttpContext.Current.Request.QueryString["timestamp"];
                    string nonce     = HttpContext.Current.Request.QueryString["nonce"];

                    // 获得客户端RAW HttpRequest
                    StreamReader srResult = new StreamReader(context.Request.InputStream);
                    string       str      = srResult.ReadToEnd();

                    XmlDocument XmlDocument = new XmlDocument();
                    XmlDocument.LoadXml(HttpContext.Current.Server.UrlDecode(str));

                    string ToUserName = string.Empty;
                    string Encrypt    = string.Empty;

                    string strde       = string.Empty;
                    string strinfotype = string.Empty;


                    foreach (XmlNode xn in XmlDocument.ChildNodes[0].ChildNodes)
                    {
                        if (xn.Name == "ToUserName")
                        {
                            ToUserName = xn.InnerText;
                        }
                        if (xn.Name == "Encrypt")
                        {
                            Encrypt = xn.InnerText;
                        }
                    }

                    var pj = new JH_Auth_WXPJB().GetEntity(p => p.TJID == ToUserName);

                    Tencent.WXBizMsgCrypt wxcpt = new Tencent.WXBizMsgCrypt(pj.Token, pj.EncodingAESKey, ToUserName);
                    int n = wxcpt.DecryptMsg(signature, timestamp, nonce, str, ref strde);

                    string strtct         = string.Empty;
                    string strSuiteId     = string.Empty;
                    string strtAuthCorpId = string.Empty;

                    XmlDocument XmlDocument1 = new XmlDocument();
                    XmlDocument1.LoadXml(HttpContext.Current.Server.UrlDecode(strde));

                    foreach (XmlNode xn1 in XmlDocument1.ChildNodes[0].ChildNodes)
                    {
                        if (xn1.Name == "SuiteId")
                        {
                            strSuiteId = xn1.InnerText;
                        }
                        if (xn1.Name == "SuiteTicket")
                        {
                            strtct = xn1.InnerText;
                        }
                        if (xn1.Name == "InfoType")
                        {
                            strinfotype = xn1.InnerText;
                        }
                        if (xn1.Name == "AuthCorpId")
                        {
                            strtAuthCorpId = xn1.InnerText;
                        }
                    }
                    if (strinfotype == "suite_ticket")
                    {
                        pj.Ticket = strtct;

                        new JH_Auth_WXPJB().Update(pj);
                    }


                    HttpContext.Current.Response.Write("success");
                    HttpContext.Current.Response.End();
                }

                #endregion
            }

            IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            string Result = JsonConvert.SerializeObject(Model, Newtonsoft.Json.Formatting.Indented, timeConverter).Replace("null", "\"\"");
            context.Response.Write(Result);
        }
        /// <summary>
        /// 职工住院预结算
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public WorkerHospitalizationPreSettlementDto WorkerHospitalizationPreSettlement(UiBaseDataParam param)
        {
            //获取操作人员信息
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var queryResidentParam = new QueryMedicalInsuranceResidentInfoParam()
            {
                BusinessId       = param.BusinessId,
                OrganizationCode = userBase.OrganizationCode
            };
            var infoData = new GetInpatientInfoParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            };
            //获取his预结算
            var hisPreSettlementData = _serviceBasicService.GetHisHospitalizationPreSettlement(infoData);
            var preSettlementData    = hisPreSettlementData.PreSettlementData.FirstOrDefault();
            //获取医保病人信息
            var residentData = _medicalInsuranceSqlRepository.QueryMedicalInsuranceResidentInfo(queryResidentParam);
            //获取医院等级
            var gradeData = _systemManageRepository.QueryHospitalOrganizationGrade(userBase.OrganizationCode);

            if (string.IsNullOrWhiteSpace(preSettlementData.EndDate))
            {
                throw new Exception("当前病人在基层中未办理出院,不能办理医保预结算!!!");
            }
            //获取医保账号
            var userData = _systemManageRepository.QueryHospitalOperator(
                new QueryHospitalOperatorParam()
            {
                UserId = param.UserId
            });
            var preSettlement = new WorkerHospitalizationPreSettlementParam()
            {
                User       = userBase,
                Id         = residentData.Id,
                BusinessId = param.BusinessId,
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceHospitalizationNo,
                LeaveHospitalDate          = Convert.ToDateTime(preSettlementData.EndDate).ToString("yyyyMMdd"),
                AdministrativeArea         = gradeData.AdministrativeArea,
                Operators                  = preSettlementData.Operator,
                IsHospitalizationFrequency = "0",
                OrganizationCode           = gradeData.MedicalInsuranceAccount,
            };
            //医保结算
            var resultData = _workerMedicalInsuranceRepository.WorkerHospitalizationPreSettlement(preSettlement);

            //报销金额 =统筹支付+补充医疗保险支付金额+专项基金支付金额+
            //公务员补贴+公务员补助+其它支付金额
            decimal reimbursementExpenses = resultData.BasicOverallPay + resultData.SupplementPayAmount + resultData.SpecialFundPayAmount
                                            + resultData.CivilServantsSubsidies + resultData.CivilServantsSubsidy + resultData.OtherPaymentAmount;
            var updateParam = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                ReimbursementExpensesAmount = CommonHelp.ValueToDouble(reimbursementExpenses),
                SelfPayFeeAmount            = resultData.CashPayment,
                OtherInfo    = JsonConvert.SerializeObject(resultData),
                Id           = residentData.Id,
                UserId       = userBase.UserId,
                SettlementNo = resultData.DocumentNo,
                MedicalInsuranceAllAmount  = resultData.TotalAmount,
                PreSettlementTransactionId = userBase.TransKey,
                MedicalInsuranceState      = MedicalInsuranceState.MedicalInsurancePreSettlement
            };

            //存入中间库
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParam);
            var logParam = new AddHospitalLogParam()
            {
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(resultData),
                User            = userBase,
                Remark          = "职工住院病人预结算"
            };

            _systemManageRepository.AddHospitalLog(logParam);

            return(resultData);
        }
        /// <summary>
        /// 获取数据源
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="order"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        public void GetSource(String sql, String order, int currentPage, String pagesize)
        {
            sql = String.Format("select  *   from ({0}) a ", sql);

            int maxCount = 0;

            if (String.IsNullOrEmpty(KeyCode))
            {
                DataTable dataTable = Nandasoft.NDDBAccess.Fill(sql);
                if (dataTable != null)
                {
                    maxCount = dataTable.Rows.Count;
                    if (dataTable.Columns.Count >= 2)
                    {
                        KeyCode = dataTable.Columns[0].ColumnName;
                        //KeyCName = dataTable.Columns[1].ColumnName;
                    }
                    else if (dataTable.Columns.Count == 1)
                    {
                        KeyCode = dataTable.Columns[0].ColumnName;
                        //KeyCName = dataTable.Columns[0].ColumnName;
                    }
                }
            }

            else
            {
                String sqlCount = String.Format("select count(*)  from ({0})   Table_source_Grid", sql);//计算记录数
                maxCount = NDConvert.ToInt32(NDDBAccess.Fill(sqlCount).Rows[0][0]);
            }
            String rowNumber = !String.IsNullOrEmpty(order) ? String.Format(" ROW_NUMBER() over(order by {0}) as XIDS, ", order) : String.Format(" ROW_NUMBER() over(order by {0})  as XIDS, ", KeyCode);

            if (String.IsNullOrEmpty(pagesize))
            {
                pagesize = _ddlgridSourceCount.SelectedValue.Trim();
            }
            if (!String.IsNullOrEmpty(order))
            {
                if (sql.ToLower().Contains("order") &&
                    (sql.ToLower().LastIndexOf("where") < sql.ToLower().LastIndexOf("order") ||
                     sql.ToLower().LastIndexOf("from") > sql.ToLower().LastIndexOf("order")))
                {
                    sql += String.Format(" , {0}", order);
                }
                else if (!sql.ToLower().Contains("order"))
                {
                    sql += String.Format(" order by {0}", order);
                }
            }
            _tableSourceCount.Text = String.Format("{0}", maxCount);
            _tableSourceCount.UpdateAfterCallBack = true;
            int pageCout = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(maxCount) / Convert.ToDouble(pagesize)));//总页数

            if (pageCout < currentPage)
            {
                currentPage = pageCout;  //总页数
            }
            if (_gridJump.Items != null) //加载页码
            {
                _gridJump.Items.Clear();
                for (int i = 1; i <= pageCout; i++)
                {
                    var item = new ListItem(String.Format("{0}/{1}", i, pageCout), i.ToString());
                    _gridJump.Items.Add(item);
                }
                _gridJump.UpdateAfterCallBack = true;
                if (_gridJump.SelectedItem != null)
                {
                    _gridJump.SelectedItem.Selected = false;
                }
                if (_gridJump.Items.FindByValue(currentPage.ToString()) != null)
                {
                    _gridJump.Items.FindByValue(currentPage.ToString()).Selected = true;
                }
            }
            sql = sql.Insert(sql.ToLower().IndexOf("select") + 6, rowNumber);
            if (currentPage < 1)
            {
                currentPage = 1;
            }
            else if (currentPage >= pageCout)
            {
                currentPage = pageCout;
            }
            sql = sql.Insert(sql.ToLower().IndexOf("select") + 6, String.Format("  top {0}  ", maxCount));
            String execSql;

            if (!String.IsNullOrEmpty(order))
            {
                execSql = String.Format(
                    "select  Table_source_Grid.*  from ({0})   Table_source_Grid  where XIDS between {1} and  {2} ",
                    sql, (currentPage - 1) * int.Parse(pagesize) + 1, currentPage * int.Parse(pagesize));//分页语句
            }
            else
            {
                execSql = String.Format(
                    "select  Table_source_Grid.*  from ({0})   Table_source_Grid  where XIDS between {1} and  {2} order by XIDS",
                    sql, (currentPage - 1) * int.Parse(pagesize) + 1, currentPage * int.Parse(pagesize));//分页语句
            }



            DataTable dt = NDDBAccess.Fill(execSql);

            //空数据源处理
            if (dt.Rows.Count <= 0)
            {
                dt.Rows.Add(dt.NewRow());
                PIsRowNull = true;
            }

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                if (dt.Columns[i].ColumnName.Trim() == "XIDS")
                {
                    dt.Columns.RemoveAt(i);
                }
            }

            //对html解析
            if (dt.Rows.Count > 0 && Type == "2")
            {
                foreach (DataRow dr in dt.Rows)
                {
                    try
                    {
                        string str = CommonHelp.StripHTML(dr["PageContent"].ToString());

                        if (str.Length > 200)
                        {
                            dr["PageContent"] = str.Substring(0, 200) + "...";
                        }
                        else
                        {
                            dr["PageContent"] = str;
                        }
                    }
                    catch
                    { }
                    finally
                    { }
                }
            }

            if (Type == "2")
            {
                DataColumn dc = new DataColumn();
                dc.ColumnName = "HasAnswered";
                dt.Columns.Add(dc);

                if (HttpContext.Current.Session["UserGUID"] != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (new BLL.Query.IndexQuery().CheckHasAnswered(dr["SID"].ToString(), HttpContext.Current.Session["UserIDClient"].ToString()))
                        {
                            dr["HasAnswered"] = "已参加";
                        }
                        else
                        {
                            dr["HasAnswered"] = "未参加";
                        }
                    }
                }
            }

            _repeaterFolder.DataSource = dt;
            if (!_objPage.IsPostBack)
            {
                foreach (DataColumn column in dt.Columns)
                {
                    PSimpleSearch += column.ColumnName + " like '%<#Search#>%' or ";
                }
            }
            _repeaterFolder.DataBind();
            _repeaterFolder.UpdateAfterCallBack = true;

            if (!String.IsNullOrEmpty(PSimpleSearch))
            {
                PSimpleSearch = PSimpleSearch.Trim().Substring(0, PSimpleSearch.LastIndexOf("or"));
            }
            SetBtnEnaled(currentPage, pageCout);
        }
Example #27
0
        public RO(Model.PCDoubleImpactCheck _pcdic)
        {
            InitializeComponent();
            if (_pcdic == null)
            {
                return;
            }

            details         = pcdicdManager.SelectByPCDoubleICId(_pcdic.PCDoubleImpactCheckID);
            this.DataSource = details.OrderBy(d => d.PCDoubleImpactCheckDetailDate).ToList();
            //this.DataSource = _pcdic.Detail;

            //CompanyInfo
            this.lblCompanyName.Text = BL.Settings.CompanyChineseName;
            switch (_pcdic.PCDoubleImpactCheckType)
            {
            case 0:
                this.lblDataName.Text = Properties.Resources.CSAcjcsd;
                //this.xtcHengWen.Visible = false;
                //this.xtcJiaRe.Visible = false;
                //this.TCattrHotL.Visible = false;
                //this.TCattrHotR.Visible = false;
                //this.TCattrCoolL.Visible = false;
                //this.TCattrCoolR.Visible = false;
                break;

            case 1:
                this.lblDataName.Text = Properties.Resources.BSENcjcsd;
                //this.xtcJIaoLian.Visible = false;
                //this.TCattrJiaoLianL.Visible = false;
                //this.TCattrJiaoLianR.Visible = false;
                break;

            case 2:
                this.lblDataName.Text = Properties.Resources.ASNZScjcsd;
                //this.xtcJIaoLian.Visible = false;
                //this.TCattrJiaoLianL.Visible = false;
                //this.TCattrJiaoLianR.Visible = false;
                //this.xtcHengWen.Visible = false;
                //this.xtcJiaRe.Visible = false;
                //this.TCattrHotL.Visible = false;
                //this.TCattrHotR.Visible = false;
                //this.TCattrCoolL.Visible = false;
                //this.TCattrCoolR.Visible = false;
                break;

            default:
                break;
            }
            //this.lblPriteDate.Text += DateTime.Now.ToShortDateString();

            //Control
            this.lblANSIPCImpactCheckID.Text   = _pcdic.PCDoubleImpactCheckID;
            this.lblANSIPCImpactCheckDate.Text = _pcdic.PCDoubleImpactCheckDate.HasValue ? _pcdic.PCDoubleImpactCheckDate.Value.ToShortDateString() : "";
            this.lblInvoiceCusXOId.Text        = _pcdic.InvoiceCusXOId;
            this.lblPronoteHeaderId.Text       = _pcdic.PronoteHeaderId;
            this.lblProduct.Text                  = _pcdic.Product == null ? "" : _pcdic.Product.ToString();
            this.lblEmployee0.Text                = _pcdic.Employee == null ? "" : _pcdic.Employee.ToString();
            this.RTDescript.Text                  = _pcdic.PCDoubleImpactCheckDesc;
            this.lblCheckStandard.Text            = _pcdic.CheckStandard;
            this.lblChongJiLiDu.Text              = _pcdic.PowerImpact;
            this.lblInvoiceXOQuantity.Text        = _pcdic.InvoiceXOQuantity.HasValue ? _pcdic.InvoiceXOQuantity.ToString() : "";
            this.lblPCDoubleImpactCheckCount.Text = _pcdic.PCDoubleImpactCheckCount.HasValue ? _pcdic.PCDoubleImpactCheckCount.ToString() : "";
            this.lbl_productunit.Text             = _pcdic.ProductUnit == null ? "" : _pcdic.ProductUnit.ToString();
            //this.lbl_CustomerProductName.Text = _pcdic.Product == null ? "" : _pcdic.Product.CustomerProductName;
            if (_pcdic.Product != null)
            {
                if (string.IsNullOrEmpty(_pcdic.Product.CustomerProductName))
                {
                    this.lbl_CustomerProductName.Text = CommonHelp.GetCustomerProductNameByPronoteHeaderId(_pcdic.PronoteHeaderId, _pcdic.ProductId);
                }
                else
                {
                    this.lbl_CustomerProductName.Text = _pcdic.Product.CustomerProductName;
                }
            }

            //Details
            #region ¸ü¸ÄÏêϸÏÔʾ
            foreach (Model.PCDoubleImpactCheckDetail detail in details)
            {
                foreach (var a in detail.GetType().GetProperties())
                {
                    if (a.Name.IndexOf("attr") > -1)
                    {
                        if (a.GetValue(detail, null) != null)
                        {
                            switch (a.GetValue(detail, null).ToString())
                            {
                            case "0":
                                a.SetValue(detail, "¡Ì", null);
                                break;

                            case "1":
                                a.SetValue(detail, "¡÷", null);
                                break;

                            case "2":
                                a.SetValue(detail, "X", null);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            #endregion
            this.TCPCDoubleImpactCheckDetailDate.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_PCDoubleImpactCheckDetailDate, "{0:yyyy-MM-dd HH:mm:ss}");
            // this.TCattrJiaoLianL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJiaoLianL);
            // this.TCattrJiaoLianR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJiaoLianR);
            this.TCattrJPUpL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPUpL);
            this.TCattrJPUpR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPUpR);
            this.TCattrJPDownL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPDownL);
            this.TCattrJPDownR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPDownR);
            this.TCattrJPLeftL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPLeftL);
            this.TCattrJPLeftR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPLeftR);
            this.TCattrJPRightL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPRightL);
            this.TCattrJPRightR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPRightR);
            this.TCattrBiZhong.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrBiZhong);
            this.TCattrShangLiangL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrShangLiangL);
            this.TCattrShangLiangR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrShangLiangR);
            this.TCattrJPZYL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPZYL);
            this.TCattrJPZYR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrJPZYR);
            this.TCattrS_SZhongL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrS_SZhongL);
            this.TCattrS_SZhongR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrS_SZhongR);
            this.TCattrS_SShangL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrS_SShangL);
            this.TCattrS_SShangR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrS_SShangR);
            this.TCattrS_SXiaL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrS_SXiaL);
            this.TCattrS_SXiaR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrS_SXiaR);
            //this.TCattrHotL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrHotL);
            //this.TCattrHotR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrHotR);
            //this.TCattrCoolL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrCoolL);
            //this.TCattrCoolR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrCoolR);
            this.TCEmployee.DataBindings.Add("Text", this.DataSource, "Employee." + Model.Employee.PROPERTY_EMPLOYEENAME);
            //this.lblattrHeat60.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrHeat60);
            //this.lblattrHeat30m.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrHeat30m);
            this.xrBanBie.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_PCDoubleImpactCheckBanBie);
            this.lblHML.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrHM500gL);
            this.lblHMR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrHM500gR);
            this.lblZhuiqiuL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrZhuiQiu68gL);
            this.lblZhuiqiuR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrZhuiQiu68gR);
            this.lblChuantouL.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrChuanTou44_2gL);
            this.lblChuantouR.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrChuanTou44_2gR);
            //this.lblCool1.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrCoolL);
            //this.lblCool2.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrCoolR);

            this.lbl_Test1.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrCoolL);
            this.lbl_Test2.DataBindings.Add("Text", this.DataSource, Model.PCDoubleImpactCheckDetail.PRO_attrCoolR);
        }
Example #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="modelState"></param>
 /// <param name="obj"></param>
 public ApiJsonResultData(ModelStateDictionary modelState, Object obj) : this()
 {
     DataDescribe = CommonHelp.GetPropertyAliasDict(obj);
     this.AddModelState(modelState);
 }
        //导出Excel
        private void btn_ExportExcel_Click(object sender, EventArgs e)
        {
            SetValue();

            IList <Book.Model.PronoteHeader> listPronoteHeader = new BL.PronoteHeaderManager().GetDataForExcel(condition.StartDate, condition.EndDate, condition.Customer, condition.CusXOId, condition.Product, condition.PronoteHeaderIdStart, condition.PronoteHeaderIdEnd, condition.SourceTpye, null, false, condition.ProNameKey, condition.ProCusNameKey, condition.PronoteHeaderIdKey, false, false, false, condition.HandbookId);

            if (listPronoteHeader == null || listPronoteHeader.Count == 0)
            {
                MessageBox.Show("无数据", "提示", MessageBoxButtons.OK);
                return;
            }

            //转换RTF的商品描述到普通String
            System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();

            foreach (var item in listPronoteHeader)
            {
                rtBox.Rtf        = item.ProductDesc;
                item.ProductDesc = rtBox.Text.Trim();

                //放在这里太耗性能,筛选完“保税”后,在查询 商品型号
                //if (string.IsNullOrEmpty(item.CustomerProductName))
                //{
                //    item.CustomerProductName = new produceManager.Help().GetCustomerProductNameByPronoteHeaderId(item, item.ProductId, item.HandbookProductId);
                //}
            }

            var listPronoteHeaderFilter = this.chk_Baoshui.Checked ? listPronoteHeader.Where(l => l.ProductDesc == "保税") : listPronoteHeader;

            foreach (var item in listPronoteHeaderFilter)
            {
                if (string.IsNullOrEmpty(item.CustomerProductName))
                {
                    item.CustomerProductName = CommonHelp.GetCustomerProductNameByPronoteHeaderId(item, item.ProductId, item.HandbookProductId);
                }
            }

            if (listPronoteHeaderFilter == null || listPronoteHeaderFilter.Count() == 0)
            {
                MessageBox.Show("无数据", "提示", MessageBoxButtons.OK);
                return;
            }


            //根据加工单号查询对应的领料单
            //var listPronoteHeaderIds = listPronoteHeaderFilter.GroupBy(l => l.PronoteHeaderID).Select(g => g.Key);
            //string pronoteHeaderIds = string.Empty;
            //foreach (var item in listPronoteHeaderIds)
            //{
            //    pronoteHeaderIds += "'" + item + "',";
            //}

            //pronoteHeaderIds = pronoteHeaderIds.TrimEnd(',');
            //IList<Model.ProduceMaterialdetails> listProduceMaterialdetails = new BL.ProduceMaterialdetailsManager().GetDataByPronoteHeaders(pronoteHeaderIds);


            try
            {
                Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
                excel.Application.Workbooks.Add(true);

                #region 生产加工单

                Microsoft.Office.Interop.Excel.Worksheet sheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Worksheets[1];
                sheet.Name = "生产加工单";
                Microsoft.Office.Interop.Excel.Range r = sheet.get_Range(sheet.Cells[1, 1], sheet.Cells[1, 16]);
                r.MergeCells = true;

                sheet.Rows.AutoFit();
                sheet.Rows.WrapText       = true;
                sheet.Rows.RowHeight      = 15;
                sheet.Rows.Font.Size      = 9;
                sheet.Columns.ColumnWidth = 13;

                sheet.get_Range(sheet.Cells[2, 1], sheet.Cells[2, 16]).Interior.ColorIndex = 15;    //浅灰色
                sheet.get_Range(sheet.Cells[1, 1], sheet.Cells[2, 16]).HorizontalAlignment = -4108; //居中对齐
                sheet.get_Range(sheet.Cells[1, 1], sheet.Cells[listPronoteHeaderFilter.Count() + 2, 16]).Borders.Value = 1;
                sheet.get_Range(sheet.Cells[3, 4], sheet.Cells[listPronoteHeaderFilter.Count() + 2, 4]).NumberFormat   = "yyyy/MM/dd";
                sheet.get_Range(sheet.Cells[3, 2], sheet.Cells[listPronoteHeaderFilter.Count() + 2, 2]).NumberFormat   = "@";

                sheet.get_Range(sheet.Cells[2, 6], sheet.Cells[2, 6]).ColumnWidth   = 30;
                sheet.get_Range(sheet.Cells[2, 10], sheet.Cells[2, 10]).ColumnWidth = 30;

                sheet.Cells[1, 1] = "生产加工单明细表";

                sheet.Cells[2, 1]  = "客户订单编号";
                sheet.Cells[2, 2]  = "客户型号";
                sheet.Cells[2, 3]  = "加工单编号";
                sheet.Cells[2, 4]  = "通知日期";
                sheet.Cells[2, 5]  = "商品编号";
                sheet.Cells[2, 6]  = "商品名称";
                sheet.Cells[2, 7]  = "订单数量";
                sheet.Cells[2, 8]  = "生产数量";
                sheet.Cells[2, 9]  = "原料编号";
                sheet.Cells[2, 10] = "原料名称";
                sheet.Cells[2, 11] = "领料数量";
                sheet.Cells[2, 12] = "生产站";
                sheet.Cells[2, 13] = "手册号";
                sheet.Cells[2, 14] = "手册项号";
                sheet.Cells[2, 15] = "来源单据";
                sheet.Cells[2, 16] = "描述";

                int row = 3;
                foreach (var item in listPronoteHeaderFilter)
                {
                    sheet.Cells[row, 1]  = item.CustomerInvoiceXOId;
                    sheet.Cells[row, 2]  = item.CustomerProductName;
                    sheet.Cells[row, 3]  = item.PronoteHeaderID;
                    sheet.Cells[row, 4]  = item.PronoteDate;
                    sheet.Cells[row, 5]  = item.Id;
                    sheet.Cells[row, 6]  = item.ProductName;
                    sheet.Cells[row, 7]  = item.InvoiceXODetailQuantity;
                    sheet.Cells[row, 8]  = item.DetailsSum;
                    sheet.Cells[row, 9]  = item.MaterialId;
                    sheet.Cells[row, 10] = item.MaterialName;
                    sheet.Cells[row, 11] = item.MaterialQty;
                    sheet.Cells[row, 12] = item.Workhousename;
                    sheet.Cells[row, 13] = item.HandbookId;
                    sheet.Cells[row, 14] = item.HandbookProductId;
                    sheet.Cells[row, 15] = item.MRSHeaderId;
                    sheet.Cells[row, 16] = item.ProductDesc;


                    row++;
                }

                #endregion


                #region 生产领料

                //if (listProduceMaterialdetails != null && listProduceMaterialdetails.Count > 0)
                //{
                //    excel.Worksheets.Add(Missing.Value, sheet, Missing.Value, Missing.Value);
                //    Microsoft.Office.Interop.Excel.Worksheet sheet2 = (Microsoft.Office.Interop.Excel.Worksheet)excel.Worksheets[2];
                //    sheet2.Name = "生产领料";

                //    sheet2.Rows.AutoFit();
                //    sheet2.Rows.WrapText = true;
                //    sheet2.Rows.RowHeight = 15;
                //    sheet2.Rows.Font.Size = 9;
                //    sheet2.Columns.ColumnWidth = 13;

                //    sheet2.get_Range(sheet2.Cells[1, 1], sheet2.Cells[1, 14]).Interior.ColorIndex = 15;   //浅灰色
                //    sheet2.get_Range(sheet2.Cells[1, 1], sheet2.Cells[1, 14]).HorizontalAlignment = -4108;
                //    sheet2.get_Range(sheet2.Cells[1, 1], sheet2.Cells[listProduceMaterialdetails.Count + 1, 14]).Borders.Value = 1;
                //    sheet2.get_Range(sheet2.Cells[2, 2], sheet2.Cells[listProduceMaterialdetails.Count + 1, 2]).NumberFormat = "yyyy/MM/dd";
                //    sheet2.get_Range(sheet2.Cells[1, 4], sheet2.Cells[1, 4]).ColumnWidth = 30;

                //    sheet2.Cells[1, 1] = "编号";
                //    sheet2.Cells[1, 2] = "领料日期";
                //    sheet2.Cells[1, 3] = "商品编号";
                //    sheet2.Cells[1, 4] = "商品名称";
                //    sheet2.Cells[1, 5] = "客户型号";
                //    sheet2.Cells[1, 6] = "手册号";
                //    sheet2.Cells[1, 7] = "手册项号";
                //    sheet2.Cells[1, 8] = "数量";
                //    sheet2.Cells[1, 9] = "生产站";
                //    sheet2.Cells[1, 10] = "已分配量";
                //    sheet2.Cells[1, 11] = "客户订单编号";
                //    sheet2.Cells[1, 12] = "库存";
                //    sheet2.Cells[1, 13] = "描述";
                //    sheet2.Cells[1, 14] = "来源单据";


                //    int row2 = 2;
                //    foreach (var item in listProduceMaterialdetails)
                //    {
                //        sheet2.Cells[row2, 1] = item.ProduceMaterialID;
                //        sheet2.Cells[row2, 2] = item.ProduceMaterialDate;
                //        sheet2.Cells[row2, 3] = item.PID;
                //        sheet2.Cells[row2, 4] = item.ProductName;
                //        sheet2.Cells[row2, 5] = item.CustomerProductName;
                //        sheet2.Cells[row2, 6] = item.HandbookId;
                //        sheet2.Cells[row2, 7] = item.HandbookProductId;
                //        sheet2.Cells[row2, 8] = item.Materialprocessum;
                //        sheet2.Cells[row2, 9] = item.WorkhouseName;
                //        sheet2.Cells[row2, 10] = item.Distributioned;
                //        sheet2.Cells[row2, 11] = item.CusXOId;
                //        sheet2.Cells[row2, 12] = item.ProductStock;
                //        sheet2.Cells[row2, 13] = item.ProduceMaterialdesc;
                //        sheet2.Cells[row2, 14] = item.PronoteHeaderID;

                //        row2++;
                //    }
                //}

                #endregion


                excel.Visible     = true;//是否打开该Excel文件
                excel.WindowState = XlWindowState.xlMaximized;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Excel未生成完畢,請勿操作,并重新點擊按鈕生成數據!", "提示!", MessageBoxButtons.OK);
                return;
            }
        }
        /// <summary>
        /// 获取门诊预结算参数
        /// </summary>
        /// <returns></returns>
        private OutpatientPlanBirthPreSettlementParam GetOutpatientPlanBirthPreSettlementParam(
            OutpatientPlanBirthPreSettlementUiParam param
            )
        {
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var outpatientParam = new GetOutpatientPersonParam()
            {
                User    = userBase,
                UiParam = param,
            };
            var outpatientPerson = _serviceBasicService.GetOutpatientPerson(outpatientParam);

            if (outpatientPerson == null)
            {
                throw new Exception("his中未获取到当前病人!!!");
            }
            var outpatientDetailPerson = _serviceBasicService.GetOutpatientDetailPerson(new OutpatientDetailParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            });
            //获取主诊断
            var    diagnosisData             = outpatientPerson.DiagnosisList.FirstOrDefault(c => c.IsMainDiagnosis == "是");
            var    inpatientDiagnosisDataDto = diagnosisData;
            string mainDiagnosis             = null;

            if (inpatientDiagnosisDataDto != null)
            {
                if (!string.IsNullOrWhiteSpace(inpatientDiagnosisDataDto.ProjectCode))
                {
                    mainDiagnosis = inpatientDiagnosisDataDto.ProjectCode;
                }
                else
                {
                    throw new Exception("未对码诊断:" + "[" + inpatientDiagnosisDataDto.DiseaseName + "]" + "[" + inpatientDiagnosisDataDto.DiseaseCoding + "]");
                }
            }

            var resultData = new OutpatientPlanBirthPreSettlementParam()
            {
                OutpatientNo  = CommonHelp.GuidToStr(param.BusinessId),//outpatientPerson.OutpatientNumber,
                DiagnosisDate = Convert.ToDateTime(outpatientPerson.VisitDate).ToString("yyyyMMddHHmmss"),
                ProjectNum    = outpatientDetailPerson.Count(),
                TotalAmount   = outpatientPerson.MedicalTreatmentTotalCost,
                AfferentSign  = param.AfferentSign,
                IdentityMark  = param.IdentityMark,
                AdmissionMainDiagnosisIcd10 = mainDiagnosis,
            };
            var rowDataList = new List <PlanBirthSettlementRow>();
            //升序
            var dataSort = outpatientDetailPerson.OrderBy(c => c.BillTime).ToArray();
            int num      = 0;

            foreach (var item in dataSort)
            {
                if (string.IsNullOrWhiteSpace(item.MedicalInsuranceProjectCode))
                {
                    throw new Exception("[" + item + "]名称:" + item.DirectoryName + "未对码!!!");
                }
                if (!string.IsNullOrWhiteSpace(item.MedicalInsuranceProjectCode))
                {
                    var row = new PlanBirthSettlementRow()
                    {
                        ColNum           = num,
                        ProjectCode      = item.MedicalInsuranceProjectCode,
                        ProjectName      = item.DirectoryName,
                        UnitPrice        = item.UnitPrice,
                        Quantity         = item.Quantity,
                        TotalAmount      = item.Amount,
                        Formulation      = item.Formulation,
                        ManufacturerName = item.DrugProducingArea,
                        Dosage           = item.Dosage,
                        Specification    = item.Specification,
                        Usage            = item.Usage
                    };

                    rowDataList.Add(row);
                    num++;
                }
            }

            resultData.RowDataList = rowDataList;


            return(resultData);
        }