/// <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"); } }
/// <summary> /// 创建一份简易的档案 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private bool createRkzlx(out string ErrMsg) { try { ErrMsg = ""; //所属机构 string comboBox_ssjg_str = comboBox_ssjg.SelectedValue != null?comboBox_ssjg.SelectedValue.ToString() : ""; //数据存储 string comboBox_sjcc_str = comboBox_sjcc.SelectedValue != null?comboBox_sjcc.SelectedValue.ToString() : ""; string sqlwhere = " and 1=2 "; //创建人口资料学表结构 DataTable dt_T_DA_JKDA_RKXZL = initTable("sql056", sqlwhere); dt_T_DA_JKDA_RKXZL.Rows.Add(); //健康档案号 健康档案人口学资料(T_DA_JKDA_RKXZL) 按照时间自动生成 dt_T_DA_JKDA_RKXZL.Rows[0]["D_GRDABH"] = textBox_jkdah.Text; //档案状态 健康档案人口学资料(T_DA_JKDA_RKXZL) dt_T_DA_JKDA_RKXZL.Rows[0]["D_DAZT"] = "1"; //姓名 健康档案人口学资料(T_DA_JKDA_RKXZL) string name_bh = ""; if (textBox_xm.Text.Trim().Length != 0) { name_bh = textBox_xm.Text; } dt_T_DA_JKDA_RKXZL.Rows[0]["D_XM"] = name_bh; //性别 健康档案人口学资料(T_DA_JKDA_RKXZL) dt_T_DA_JKDA_RKXZL.Rows[0]["D_XB"] = xb_mc.Length > 0?(this.xb_mc.ToString().Equals("男") ? "1" : "2"):""; //户主身份证号 与本人身份证号一致 dt_T_DA_JKDA_RKXZL.Rows[0]["D_SFZH"] = this.sfzh; dt_T_DA_JKDA_RKXZL.Rows[0]["D_zjhqt"] = this.sfzh; //联系电话 dt_T_DA_JKDA_RKXZL.Rows[0]["D_LXDH"] = textBox_lxdh.Text; //联系人电话 dt_T_DA_JKDA_RKXZL.Rows[0]["D_LXrDH"] = textBox_lxrdh.Text; //出生日期 健康档案人口学资料(T_DA_JKDA_RKXZL) dt_T_DA_JKDA_RKXZL.Rows[0]["D_CSRQ"] = this.csrq; //标识该条数据是否进行过修改。1:未修改 2:已修改 3:新增 dt_T_DA_JKDA_RKXZL.Rows[0]["zt"] = "3"; //增量标 dt_T_DA_JKDA_RKXZL.Rows[0]["zlbz"] = "1"; //创建者姓名 dt_T_DA_JKDA_RKXZL.Rows[0]["CREATEUSER"] = UserInfo.userId; //创建时间 dt_T_DA_JKDA_RKXZL.Rows[0]["CREATETIME"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //创建者姓名 dt_T_DA_JKDA_RKXZL.Rows[0]["updateUSER"] = UserInfo.userId; //创建时间 dt_T_DA_JKDA_RKXZL.Rows[0]["updateTIME"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Form_daxqBll form_daxqbll = new Form_daxqBll(); //年度 dt_T_DA_JKDA_RKXZL.Rows[0]["nd"] = DateTime.Now.Year.ToString(); //修改创建时间 dt_T_DA_JKDA_RKXZL.Rows[0]["HAPPENTIME"] = DateTime.Now.ToString("yyyy-MM-dd"); //修改创建时间 dt_T_DA_JKDA_RKXZL.Rows[0]["isnewdoc"] = "1"; //所属机构 dt_T_DA_JKDA_RKXZL.Rows[0]["P_RGID"] = comboBox_ssjg_str; //数据存储 dt_T_DA_JKDA_RKXZL.Rows[0]["DATAFROM"] = comboBox_sjcc_str; //居住地址 //省 健康档案人口学资料(T_DA_JKDA_RKXZL) if (comboBox_D_SHENG.SelectedValue != null) { dt_T_DA_JKDA_RKXZL.Rows[0]["D_SHENG"] = comboBox_D_SHENG.SelectedValue.ToString(); } //市 健康档案人口学资料(T_DA_JKDA_RKXZL) if (comboBox_D_SHI.SelectedValue != null) { dt_T_DA_JKDA_RKXZL.Rows[0]["D_SHI"] = comboBox_D_SHI.SelectedValue.ToString(); } //县 健康档案人口学资料(T_DA_JKDA_RKXZL) if (comboBox_D_QU.SelectedValue != null) { dt_T_DA_JKDA_RKXZL.Rows[0]["D_QU"] = comboBox_D_QU.SelectedValue.ToString(); } //镇 健康档案人口学资料(T_DA_JKDA_RKXZL) if (comboBox_D_JD.SelectedValue != null) { dt_T_DA_JKDA_RKXZL.Rows[0]["D_JD"] = comboBox_D_JD.SelectedValue.ToString(); } //村 健康档案人口学资料(T_DA_JKDA_RKXZL) if (comboBox_D_JWH.SelectedValue != null) { dt_T_DA_JKDA_RKXZL.Rows[0]["D_JWH"] = comboBox_D_JWH.SelectedValue.ToString(); } //详细地址 健康档案人口学资料(T_DA_JKDA_RKXZL) dt_T_DA_JKDA_RKXZL.Rows[0]["D_XXDZ"] = lTextBox_D_XXDZ.Text; //年龄 //if (TJClient.Common.Common.CheckIDCard(this.sfzh) == true) //{ // string birth = TJClient.Common.Common.GetBirthdayByIdentityCardId(this.sfzh, true); // string nl = (DateTime.Now.Year - Convert.ToDateTime(birth).Year ).ToString(); // dt_T_DA_JKDA_RKXZL.Rows[0]["NL"] = nl.ToString(); //} dt_T_DA_JKDA_RKXZL.Rows[0]["NL"] = textBox_nl.Text; dt_T_DA_JKDA_RKXZL.Rows[0]["IFUPLOADE"] = "1"; //与户主关系 dt_T_DA_JKDA_RKXZL.Rows[0]["D_YHZGX"] = "1"; //新增 form_daxqbll.Add(dt_T_DA_JKDA_RKXZL, "sql067"); //加入体检 string errMsg = ""; string result = Add_jktj(textBox_jkdah.Text, textBox_sfzh.Text, textBox_xm.Text, xb_mc, csrq, textBox_nl.Text, comboBox_ssjg_str, comboBox_sjcc_str, textBox_lxdh.Text, ref errMsg); if (result.Equals("1") == false) { ErrMsg = errMsg; return(false); } return(true); } catch (Exception ex) { ErrMsg = ex.Message; return(false); } }