Example #1
0
        /// <summary>
        /// 绑定数据值
        /// </summary>
        /// <param name="drp"></param>
        /// <param name="initValue"></param>
        /// <returns></returns>
        public bool setDrp(ComboBox drp, string strwhere, string sqlCode, bool ifkh)
        {
            try
            {
                drpflag = false;
                Form_daxqBll form_daxq = new Form_daxqBll();

                //获取结果集
                DataTable dt = form_daxq.GetMoHuList(strwhere, sqlCode);
                if (dt == null)
                {
                    return(false);
                }
                if (ifkh == true)
                {
                    DataRow dtRow = dt.NewRow();
                    dt.Rows.InsertAt(dtRow, 0);
                }

                drp.DisplayMember = "B_NAME";
                drp.ValueMember   = "B_RGID";
                drp.DataSource    = dt;
                drpflag           = true;
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 初始化表结构
        /// </summary>
        /// <param name="dt_table"></param>
        /// <returns></returns>
        public DataTable initTable(string sqlcode, string sqlwhere)
        {
            DataTable    dt        = new DataTable();
            Form_daxqBll form_daxq = new Form_daxqBll();

            //获取数据库表结构
            dt = form_daxq.GetMoHuList(sqlwhere, sqlcode);
            //dt = form_daxq.GetMoHuList("and 1=2", sqlcode);
            return(dt);
        }
Example #3
0
        /// <summary>
        /// 生成体检
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public string Add_jktj(string grdabh, string sfzh_para, string xm_para, string xb_para, string csrq_para, string nl, string p_rgid, string datafrom, string lxdh, ref string errMsg)
        {
            Form_daxqBll form_daxqbll = new Form_daxqBll();
            string       strtmbm      = grdabh;

            try
            {
                //生成体检人员信息
                DataTable dt_tjryxx = new DataTable();
                dt_tjryxx = form_daxqbll.GetMoHuList(string.Format(" and JKDAH='{0}' ", grdabh), "sql_select_TJRYXX");

                //已经存在
                if (dt_tjryxx != null && dt_tjryxx.Rows.Count > 0)
                {
                    //判断条码信息是否存在
                    DataTable dt_tjry_txm_tem = form_daxqbll.GetMoHuList(string.Format(" and JKDAH='{0}' ", grdabh), "sql_select_people_txm");
                    if (dt_tjry_txm_tem != null && dt_tjry_txm_tem.Rows.Count > 0)
                    {
                        errMsg = "已经存在体检信息!";
                        return("0");
                    }
                    //体检编号
                    strtmbm = dt_tjryxx.Rows[0]["TJBM"] != null ? dt_tjryxx.Rows[0]["TJBM"].ToString() : grdabh;
                }
                else
                {
                    dt_tjryxx.Rows.Add();
                    dt_tjryxx.Rows[0]["YLJGBM"] = UserInfo.Yybm;                     //医疗机构编码
                    dt_tjryxx.Rows[0]["TJJHBM"] = DateTime.Now.ToString("yyyyMMdd"); //体检计划编码
                    dt_tjryxx.Rows[0]["TJPCH"]  = DateTime.Now.ToString("hhmmss");   //体检批次号

                    //取得顺番号
                    DataTable dt_SFH = form_daxqbll.GetMoHuList("", "sql076");
                    if (dt_SFH != null && dt_SFH.Rows.Count > 0 && dt_SFH.Rows[0]["SFH"] != null && dt_SFH.Rows[0]["SFH"].ToString().Length > 0)
                    {
                        dt_tjryxx.Rows[0]["SFH"] = int.Parse(dt_SFH.Rows[0]["SFH"].ToString()) + 1;//顺番号
                    }
                    else
                    {
                        dt_tjryxx.Rows[0]["SFH"] = "0";//顺番号
                    }

                    dt_tjryxx.Rows[0]["SXHM"] = "0";
                    string strTJBM = grdabh.PadLeft(12, '0');
                    dt_tjryxx.Rows[0]["TJBM"]  = strTJBM.Substring(strTJBM.Length - 12);                                      //个人体检编号
                    dt_tjryxx.Rows[0]["JKDAH"] = grdabh;                                                                      //个人健康档案号
                    //dt_tjryxx.Rows[0]["GRBM"] = "0";//个人编码
                    dt_tjryxx.Rows[0]["XM"]         = xm_para;                                                                //姓名
                    dt_tjryxx.Rows[0]["XB"]         = xb_para.Length > 0 ? (xb_para.ToString().Equals("男") ? "1" : "2") : ""; //性别
                    dt_tjryxx.Rows[0]["SFZH"]       = sfzh_para;                                                              //身份证号
                    dt_tjryxx.Rows[0]["CSRQ"]       = csrq_para;                                                              //出生日期
                    dt_tjryxx.Rows[0]["LXDH"]       = lxdh;                                                                   //出生日期
                    dt_tjryxx.Rows[0]["FL"]         = "2";                                                                    //体检人员分类
                    dt_tjryxx.Rows[0]["BZ"]         = "";                                                                     //备注
                    dt_tjryxx.Rows[0]["TJBH_TEM"]   = grdabh;                                                                 //临时个人体检编号
                    dt_tjryxx.Rows[0]["CREATETIME"] = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");                           //创建时间
                    dt_tjryxx.Rows[0]["CREATEUSER"] = UserInfo.userId;                                                        //创建者
                    dt_tjryxx.Rows[0]["UPDATETIME"] = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");                           //更新时间
                    dt_tjryxx.Rows[0]["UPDATEUSER"] = UserInfo.userId;                                                        //更新者
                    dt_tjryxx.Rows[0]["SCZT"]       = "2";                                                                    //数据上传状态
                    dt_tjryxx.Rows[0]["ZLBZ"]       = "1";                                                                    //增量标志
                    dt_tjryxx.Rows[0]["nd"]         = DateTime.Now.Year.ToString();                                           //年度
                    dt_tjryxx.Rows[0]["ISSH"]       = "0";                                                                    //登记
                    dt_tjryxx.Rows[0]["ISNEWDOC"]   = "1";                                                                    //登记

                    //所属机构
                    dt_tjryxx.Rows[0]["PRGID"] = p_rgid;

                    //数据存储
                    dt_tjryxx.Rows[0]["DATAFROM"] = datafrom;

                    //增加体检人员信息
                    form_daxqbll.Add(dt_tjryxx, "sql_add_people");
                }

                //生成lis信息
                DataTable dt_tmList = new DataTable(); //sql030
                dt_tmList = form_daxqbll.GetMoHuList(string.Format(" and  YLJGBM ='{0}' ", UserInfo.Yybm), "sql030");

                if (dt_tmList != null && dt_tmList.Rows.Count > 0)
                {
                    //主表
                    DataTable dt_reqmain = new DataTable();
                    dt_reqmain = form_daxqbll.GetMoHuList(" and 1=2 ", "sql070");
                    //明细表
                    DataTable dt_reqdetail = new DataTable();
                    dt_reqdetail = form_daxqbll.GetMoHuList(" and 1=2 ", "sql071");

                    for (int i = 0; i < dt_tmList.Rows.Count; i++)
                    {
                        //string sqh = grdabh.ToString().PadLeft(10, '0') + dt_tmList.Rows[i]["TMBM"].ToString();
                        string sqh = strtmbm.ToString().PadLeft(10, '0') + dt_tmList.Rows[i]["TMBM"].ToString();
                        //sqh = DateTime .Now.Year .ToString ().Substring (2,2)+ sqh.Substring(sqh.Length - 12, 12);

                        //体检人员条形码对应表(T_JK_TJRY_TXM)
                        DataTable t_jk_tjry_txm = new DataTable();
                        t_jk_tjry_txm.Columns.Add("YLJGBM"); //医疗机构编码
                        t_jk_tjry_txm.Columns.Add("TXMBH");  //条形码号码
                        t_jk_tjry_txm.Columns.Add("TMBM");   //条码分类
                        t_jk_tjry_txm.Columns.Add("JKDAH");  //个人健康档案号
                        t_jk_tjry_txm.Columns.Add("SFZH");   //身份证号
                        t_jk_tjry_txm.Columns.Add("BZ");     //备注
                        t_jk_tjry_txm.Columns.Add("ZLBZ");   //增量标志
                        t_jk_tjry_txm.Columns.Add("nd");     //年度
                        t_jk_tjry_txm.Rows.Add();
                        //增加体检人员条形码对应关系
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["YLJGBM"] = UserInfo.Yybm;                        //医疗机构编码
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["TXMBH"]  = sqh;                                  //条形码号码
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["TMBM"]   = dt_tmList.Rows[i]["TMBM"].ToString(); //条码分类
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["JKDAH"]  = grdabh;                               //个人健康档案号
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["SFZH"]   = sfzh_para;                            //身份证号
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["BZ"]     = "**";                                 //备注
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["ZLBZ"]   = "1";                                  //增量标志
                        t_jk_tjry_txm.Rows[t_jk_tjry_txm.Rows.Count - 1]["nd"]     = DateTime.Now.Year.ToString();         //年度

                        //增加体检人员条形码对应关系
                        form_daxqbll.Add(t_jk_tjry_txm, "sql_add_people_txm");


                        dt_reqmain.Rows.Add();
                        //主表
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["sqh"]      = sqh;                                                                    //申请号
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["ksdh"]     = "";                                                                     //送检科室代码
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["sqys"]     = "";                                                                     //申请医生代码
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["sqsj"]     = DateTime.Now.ToString("yyyy-MM-dd");                                    //申请时间
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["jsys"]     = "";                                                                     //接收医生
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["jssj"]     = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");                           //接收时间
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["zt"]       = "1";                                                                    //状态
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["jjzt"]     = "1";                                                                    //计价状态
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["brly"]     = getBrly(UserInfo.Yybm);                                                 //病人来源
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["brdh"]     = grdabh.ToString();                                                      //病历号
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["brxm"]     = xm_para;                                                                //病人姓名
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["brxb"]     = xb_para.Length > 0 ? (xb_para.ToString().Equals("男") ? "1" : "2") : ""; //病人性别
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["brsr"]     = "";                                                                     // csrq_para;//病人生日
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["bz1"]      = dt_tmList.Rows[i]["SQXMDH"].ToString();
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["bz2"]      = dt_tmList.Rows[i]["ybName"] != null? dt_tmList.Rows[i]["ybName"].ToString():"";
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["bz3"]      = "";
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["jzbz"]     = "0";                                          //急诊标志
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["txm"]      = "";
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["ch"]       = "";                                           //床号
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["yblx"]     = "";                                           //样本类型
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["zxys"]     = "";                                           //执行医生
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["zxsj"]     = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); //执行时间
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["bgddh"]    = "";
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["costs"]    = 0;
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["nl"]       = nl;                                           //年龄
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["nldw"]     = "1";                                          //年龄单位
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["zd"]       = "";                                           //临床诊断
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["cysj"]     = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); //采样时间
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["cksj"]     = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["ckzj"]     = "";
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["ckyh"]     = "";
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["sfzh"]     = sfzh_para;                            //身份证号
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["jkdah"]    = grdabh;                               //健康档案号
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["yybm"]     = UserInfo.Yybm;                        //医院编码
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["dataFrom"] = "1";                                  //数据来源
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["zlbz"]     = "1";                                  //增量标志
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["nd"]       = DateTime.Now.Year.ToString();         //年度
                        dt_reqmain.Rows[dt_reqmain.Rows.Count - 1]["TMBM"]     = dt_tmList.Rows[i]["TMBM"].ToString(); //条码编码
                        //生成明细
                        string    tmfl = dt_tmList.Rows[i]["sqxmdh"] != null ? dt_tmList.Rows[i]["sqxmdh"].ToString() : "";
                        DataTable dt_tmList_reqdetail = form_daxqbll.GetMoHuList(string.Format(" and  YLJGBM ='{0}' and SQXMDH='{1}' ", UserInfo.Yybm, tmfl), "sql078");
                        if (dt_tmList_reqdetail != null)
                        {
                            for (int j = 0; j < dt_tmList_reqdetail.Rows.Count; j++)
                            {
                                dt_reqdetail.Rows.Add();
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["sqh"]      = sqh;                                                 //申请号
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["xh"]       = (j + 1).ToString();                                  //序号
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["sqxmdh"]   = dt_tmList_reqdetail.Rows[j]["ITEM_CODE"].ToString(); //申请项目代码
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["sqxmmc"]   = dt_tmList_reqdetail.Rows[j]["ITEM_NAME"].ToString(); //申请项目名称
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["sl"]       = "1";                                                 //数量
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["dj"]       = "0";                                                 //单价
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["zt"]       = "1";                                                 //状态
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["jjzt"]     = "1";                                                 //计价状态
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["bz1"]      = "";                                                  //备注1字段
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["bz2"]      = "";                                                  //
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["costs"]    = 0;                                                   //
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["numbk1"]   = 0;                                                   //
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["numbk2"]   = 0;                                                   //
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["dtbk1"]    = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");        //
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["dtbk2"]    = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");        //
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["yybm"]     = UserInfo.Yybm;                                       //医院编码
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["dataFrom"] = "1";                                                 //数据来源
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["zlbz"]     = "1";                                                 //增量标志
                                dt_reqdetail.Rows[dt_reqdetail.Rows.Count - 1]["nd"]       = DateTime.Now.Year.ToString();                        //年度
                            }
                        }
                    }

                    //检验主表
                    form_daxqbll.Add(dt_reqmain, "sql074");

                    //检验明细表
                    form_daxqbll.Add(dt_reqdetail, "sql075");
                }
                return("1");
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                return("-1");
            }
        }