/// <summary> /// 转诊预约接口转发(桐庐) 和区域卫生做的对接 _______胡谦 /// </summary> /// <param name="header"></param> /// <param name="body"></param> /// <param name="ehrXml"></param> public void DoBusiness(string header, string body, ref string ehrXml) { log.InfoFormat("DoBusiness##" + header + "###" + body); string ZHUANZHENYYLXDM = ConfigurationManager.AppSettings["ZHUANZHENYYLXDM"]; int i = 0; string guid = Guid.NewGuid().ToString("N").ToUpper(); log.InfoFormat("[{2}][{0}].IN {1}", header, LogUnity.I.ShowXml(body), guid); Header head = new Header(); head = MessageParse.ToXmlObject <Header>(header); Body inobject = MessageParse.ToXmlObject <Body>(body); BASEINFO baseinfo = new BASEINFO(); baseinfo.CAOZUORQ = head.RequestTime; baseinfo.CAOZUOYDM = head.UserId; baseinfo.JIGOUDM = head.OrganizationId; baseinfo.MACDZ = head.lient_Mac; Result result = new Result(); result.Code = "0"; result.Msg = "OK"; //modify by 沈宝 try { switch (head.DocumentID) { #region 挂号科室信息 case "GUAHAOKSXX": string ksdm = inobject.KESHIDM; string sql = "select * from v_ksxx_mcp"; if (!string.IsNullOrEmpty(ksdm)) { sql += $" where KESHIDM='{ksdm}'"; } DataTable dt = DBVisitor.ExecuteTable(sql); Body_GUAHAOKSXX outObj = new Body_GUAHAOKSXX { Result = new Result(), KESHIMX = new List <Entity.KESHIXX>() }; outObj.Result = result; foreach (DataRow dr in dt.Rows) { Entity.KESHIXX ksxx = new Entity.KESHIXX { JIUZHENDD = dr["WEIZHI"].ToString(), KESHIDM = dr["KESHIDM"].ToString(), KESHIJS = dr["KESHIJS"].ToString(), KESHIMC = dr["KESHIMC"].ToString(), KESHIPX = "" }; outObj.KESHIMX.Add(ksxx); } ehrXml = MessageParse.GetXml(outObj); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; #endregion #region 医生信息 case "YISHENGJSXX": string ysdm = inobject.YISHENGDM; sql = "select * from v_zgxx_mcp "; if (!string.IsNullOrEmpty(ysdm)) { sql += $" where ZHIGONGID='{ysdm}'"; } dt = DBVisitor.ExecuteTable(sql); Body_YISHENGJSXX jsxxObj = new Body_YISHENGJSXX { Result = new Result(), YISHENGMX = new List <Entity.YISHENGXX>() }; jsxxObj.Result = result; foreach (DataRow dr in dt.Rows) { Entity.YISHENGXX ysxx = new Entity.YISHENGXX { YISHENGDM = dr["ZHIGONGID"].ToString(), YISHENGXM = dr["ZHIGONGXM"].ToString(), YISHENGXB = dr["XB"].ToString(), ZHENGJIANLX = "1", ZHENGJIANHM = dr["shenfenzh"].ToString(), YISHENGPX = "", YISHENGZC = dr["ZHICHENG"].ToString(), YISHENGTC = dr["YISHENGSC"].ToString(), YISHENGJS = dr["DISCRIPTION"].ToString(), ZHAOPIAN = "", }; jsxxObj.YISHENGMX.Add(ysxx); } ehrXml = MessageParse.GetXml(jsxxObj); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; #endregion #region 排班信息 排班 上午和下午要分两条转 排班ID 要不一样 case "YIYUANPBXX": //mody by 沈宝2017/1/9 string ysdmpb = inobject.YISHENGDM == "" ? "1" : "2"; if (ysdmpb == "1") { string sql1 = (inobject.KESHIDM == "" ? "" : "and YIZHOUKSDM = " + inobject.KESHIDM); //过滤条件可是代码为空时传全部; sql = $" select * from V_YIYUANYZPBXX_MCP where YIZHOUPNLBDM='1' and YUYUELX='{ZHUANZHENYYLXDM}'{sql1}"; //YUYUELX 10是分配给转诊预约的,测试时用2 } else { string sql1 = (inobject.KESHIDM == "" ? "" : "and YIZHOUKSDM = " + inobject.KESHIDM); sql = $" select * from V_YIYUANYZPBXX_MCP where YUYUELX='{ZHUANZHENYYLXDM}'{sql1}"; } dt = DBVisitor.ExecuteTable(sql); Body_YIYUANPBXX pbxxObj = new Body_YIYUANPBXX { Result = new Result(), PAIBANLB = new List <Entity.PAIBANMX>() }; pbxxObj.Result = result; int pd = Convert.ToInt32(inobject.GUAHAOBC); //modify by 沈宝 foreach (DataRow dr in dt.Rows) { DateTime schedulingDate = ToolUnity.RqtoXq(dr["YIZHOUXQ"].ToString()); #region 午的排班 if (pd == 1) { Entity.PAIBANMX pbmx1 = new Entity.PAIBANMX { HAOYUANFPLX = "0", KESHIDM = dr["YIZHOUKSDM"].ToString(), KESHIMC = dr["YIZHOUKSMC"].ToString(), JIUZHENDD = dr["GUAHAOKSWZMC"].ToString(), KESHIJS = "", KESHIPX = "", YISHENGDM = dr["YIZHOUYSDM"].ToString(), YISHENGXM = dr["YIZHOUPBLBDM"].ToString() == "1" ? dr["YIZHOUPBLBMC"].ToString() : dr["YIZHOUYSXM"].ToString(), //dr["YIZHOUPNLBDM"]=="1"?dr[]: dr["YIZHOUYSXM"].ToString(), ZHENLIAOF = dr["ZHENLIAOFEI"].ToString(), ZHENLIAOJSF = "0", PAIBANRQ = schedulingDate.ToString("yyyy-MM-dd"), TINGZHENBZ = "0", GUAHAOBC = "1", GUAHAOLB = dr[" "].ToString(), YIZHOUPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|1", DANGTIANPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|1" }; if (int.Parse(dr["YIZHOUSWZGXH"].ToString()) > 0) { pbxxObj.PAIBANLB.Add(pbmx1); } } else if (pd == 2) { #endregion #region 午的排班 Entity.PAIBANMX pbmx2 = new Entity.PAIBANMX { HAOYUANFPLX = "0", KESHIDM = dr["YIZHOUKSDM"].ToString(), KESHIMC = dr["YIZHOUKSMC"].ToString(), JIUZHENDD = dr["GUAHAOKSWZMC"].ToString(), KESHIJS = "", KESHIPX = "", YISHENGDM = dr["YIZHOUYSDM"].ToString(), YISHENGXM = dr["YIZHOUPBLBDM"].ToString() == "1" ? dr["YIZHOUPBLBMC"].ToString() : dr["YIZHOUYSXM"].ToString(), // dr["YIZHOUYSXM"].ToString(), ZHENLIAOF = dr["ZHENLIAOFEI"].ToString(), ZHENLIAOJSF = "0", PAIBANRQ = schedulingDate.ToString("yyyy-MM-dd"), TINGZHENBZ = "0", GUAHAOBC = "2", GUAHAOLB = dr["YIZHOUPBLBDM"].ToString(), YIZHOUPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|2", DANGTIANPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|2" }; //pbmx2.YIZHOUPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|2"; if (int.Parse(dr["YIZHOUXWZGXH"].ToString()) > 0) { pbxxObj.PAIBANLB.Add(pbmx2); } } else if (pd == 4 || pd == 0) { #endregion #region 全天的排班 Entity.PAIBANMX pbmx1 = new Entity.PAIBANMX { HAOYUANFPLX = "0", KESHIDM = dr["YIZHOUKSDM"].ToString(), KESHIMC = dr["YIZHOUKSMC"].ToString(), JIUZHENDD = dr["GUAHAOKSWZMC"].ToString(), KESHIJS = "", KESHIPX = "", YISHENGDM = dr["YIZHOUYSDM"].ToString(), YISHENGXM = dr["YIZHOUPBLBDM"].ToString() == "1" ? dr["YIZHOUPBLBMC"].ToString() : dr["YIZHOUYSXM"].ToString(), // dr["YIZHOUYSXM"].ToString(), ZHENLIAOF = dr["ZHENLIAOFEI"].ToString(), ZHENLIAOJSF = "0", PAIBANRQ = schedulingDate.ToString("yyyy-MM-dd"), TINGZHENBZ = "0", GUAHAOBC = pd.ToString(), GUAHAOLB = dr["YIZHOUPBLBDM"].ToString(), YIZHOUPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|1", DANGTIANPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|1" }; if (int.Parse(dr["YIZHOUSWZGXH"].ToString()) > 0) { pbxxObj.PAIBANLB.Add(pbmx1); } PAIBANMX pbmx2 = new Entity.PAIBANMX { HAOYUANFPLX = "0", KESHIDM = dr["YIZHOUKSDM"].ToString(), KESHIMC = dr["YIZHOUKSMC"].ToString(), JIUZHENDD = dr["GUAHAOKSWZMC"].ToString(), KESHIJS = "", KESHIPX = "", YISHENGDM = dr["YIZHOUYSDM"].ToString(), YISHENGXM = dr["YIZHOUPBLBDM"].ToString() == "1" ? dr["YIZHOUPBLBMC"].ToString() : dr["YIZHOUYSXM"].ToString(), //dr["YIZHOUYSXM"].ToString(), ZHENLIAOF = dr["ZHENLIAOFEI"].ToString(), ZHENLIAOJSF = "0", PAIBANRQ = schedulingDate.ToString("yyyy-MM-dd"), TINGZHENBZ = "0", GUAHAOBC = pd.ToString(), GUAHAOLB = dr["YIZHOUPBLBDM"].ToString(), YIZHOUPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|2", DANGTIANPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|2" }; //pbmx2.YIZHOUPBID = dr["YIZHOUPBID"].ToString() + "|" + dr["YIZHOUYSDM"].ToString() + "|2"; if (int.Parse(dr["YIZHOUXWZGXH"].ToString()) > 0) { pbxxObj.PAIBANLB.Add(pbmx2); } #endregion } else { //inobject.GUAHAOBC = '3';晚上排班; pbxxObj.Result.Msg = "无晚上排班"; } } ehrXml = MessageParse.GetXml(pbxxObj); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; #endregion #region 号源信息 case "GUAHAOHYXX": //已挂号号源信息 sql = "SELECT * from V_GUAHAOYSYHYXX_MCP A where 1=1 "; if (!string.IsNullOrEmpty(inobject.KESHIDM)) { sql += $" and PAIBANKSDM='{inobject.KESHIDM}'"; } if (!string.IsNullOrEmpty(inobject.YISHENGDM)) { sql += $" and PAIBANYSGH='{inobject.YISHENGDM}'"; } DataTable YghDt = DBVisitor.ExecuteTable(sql); //挂号号源信息 预约类型代码10开放给转诊预约---测试的时候用2 正式使用的时候是10 sql = $"SELECT* FROM V_YIYUANGHHYXX_MCP WHERE YUYUELXDM= '{ZHUANZHENYYLXDM}'"; if (!string.IsNullOrEmpty(inobject.KESHIDM)) { sql += $" and YIZHOUKSDM='{inobject.KESHIDM}'"; } if (!string.IsNullOrEmpty(inobject.YISHENGDM)) { sql += $" and YIZHOUYSDM='{inobject.YISHENGDM}'"; } if (!string.IsNullOrEmpty(inobject.GUAHAOBC)) { if (inobject.GUAHAOBC != "0" && inobject.GUAHAOBC != "4") { sql += $" and PAIBANLX='{inobject.GUAHAOBC}'"; } } DataTable ghhyDt = DBVisitor.ExecuteTable(sql); if (ghhyDt.Rows.Count < 1) { result.Msg = "无所要查询号源信息"; } DataTable HouZhenSj = DBVisitor.ExecuteTable("select * from mz_houzhensj a"); Body_GUAHAOHYXX hyxxOut = new Body_GUAHAOHYXX { Result = new Result() }; hyxxOut.Result = result; hyxxOut.HAOYUANMX = new List <Entity.HAOYUANXX>(); foreach (DataRow variable in ghhyDt.Rows) { #region //上午号源 if (int.Parse(variable["SHANGWUYYXH"].ToString()) > 0) { string[] guaHaoSwXh = variable["SHANGWUYYXHMX"].ToString().Split('^'); foreach (var SwXhmx in guaHaoSwXh) { if (!string.IsNullOrEmpty(SwXhmx)) { //判断号源是否被占用 DataRow[] dr = YghDt.Select( $"PAIBANID='{variable["YIZHOUPBID"].ToString()}' and PAIBANKSDM='{variable["YIZHOUKSDM"].ToString()}'" + $" and PAIBANYSGH='{variable["YIZHOUYSDM"].ToString()}' and PAIBANGHLB='{variable["YIZHOUPBLBDM"].ToString()}'" + $" and HAOYUANSYSJ='1' and HAOYUANSYXH='{SwXhmx}'"); if (dr.Length == 0) { Entity.HAOYUANXX hymx1 = new Entity.HAOYUANXX { PAIBANRQ = variable["schedulingdate"].ToString().Substring(0, 10), GUAHAOBC = "1", GUAHAOLB = variable["YIZHOUPBLBDM"].ToString(), YISHENGDM = variable["YIZHOUYSDM"].ToString(), KESHIDM = variable["YIZHOUKSDM"].ToString(), YIZHOUPBID = variable["YIZHOUPBID"].ToString() + "|" + variable["YIZHOUYSDM"].ToString() + "|1", DANGTIANPBID = variable["YIZHOUPBID"].ToString() + "|" + variable["YIZHOUYSDM"].ToString() + "|1", HAOYUANLB = "1", GUAHAOXH = SwXhmx, HAOYUANID = variable["YIZHOUPBID"].ToString() + "|" + variable["YIZHOUYSDM"].ToString() + "|1|" + SwXhmx }; DataRow[] HzSjDr = HouZhenSj.Select( $"qishighxh<={SwXhmx} and jieshughxh>={SwXhmx} and shangxiawbz=0 and yishengid='{variable["YIZHOUYSDM"].ToString()}' and KESHIID='{variable["YIZHOUKSDM"].ToString()}'"); if (HzSjDr.Length > 0) { hymx1.JIUZHENSJ = HzSjDr[0]["KAISHISJ"].ToString() + "-" + HzSjDr[0]["JIESHUSJ"].ToString(); } else { hymx1.JIUZHENSJ = "07:30-12:00"; } hyxxOut.HAOYUANMX.Add(hymx1); } } } } #endregion #region 午号源 if (int.Parse(variable["XIAWUYYXH"].ToString()) > 0) { string[] guaHaoXwXh = variable["xiawuyyyhmx"].ToString().Split('^'); foreach (var XwXhmx in guaHaoXwXh) { if (!string.IsNullOrEmpty(XwXhmx)) { //判断号源是否被占用 DataRow[] dr = YghDt.Select( $"PAIBANID='{variable["YIZHOUPBID"].ToString()}' and PAIBANKSDM='{variable["YIZHOUKSDM"].ToString()}'" + $" and PAIBANYSGH='{variable["YIZHOUYSDM"].ToString()}' and PAIBANGHLB='{variable["YIZHOUPBLBDM"].ToString()}'" + $" and HAOYUANSYSJ='1' and HAOYUANSYXH='{XwXhmx}'"); if (dr.Length == 0) { Entity.HAOYUANXX hymx2 = new Entity.HAOYUANXX { PAIBANRQ = variable["schedulingdate"].ToString().Substring(0, 10), GUAHAOBC = "1", GUAHAOLB = variable["YIZHOUPBLBDM"].ToString(), YISHENGDM = variable["YIZHOUYSDM"].ToString(), KESHIDM = variable["YIZHOUKSDM"].ToString(), YIZHOUPBID = variable["YIZHOUPBID"].ToString() + "|" + variable["YIZHOUYSDM"].ToString() + "|2", DANGTIANPBID = variable["YIZHOUPBID"].ToString() + "|" + variable["YIZHOUYSDM"].ToString() + "|2", HAOYUANLB = "1", GUAHAOXH = XwXhmx, HAOYUANID = variable["YIZHOUPBID"].ToString() + "|" + variable["YIZHOUYSDM"].ToString() + "|2|" + XwXhmx }; //候诊时间 DataRow[] HzSjDr = HouZhenSj.Select( $"qishighxh<={XwXhmx} and jieshughxh>={XwXhmx} and shangxiawbz=1 and yishengid='{variable["YIZHOUYSDM"].ToString()}' and KESHIID='{variable["YIZHOUKSDM"].ToString()}'"); if (HzSjDr.Length > 0) { hymx2.JIUZHENSJ = HzSjDr[0]["KAISHISJ"].ToString() + "-" + HzSjDr[0]["JIESHUSJ"].ToString(); } else { hymx2.JIUZHENSJ = "13:30-17:00"; } hyxxOut.HAOYUANMX.Add(hymx2); } } } } #endregion } ehrXml = MessageParse.GetXml(hyxxOut); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; #endregion #region 预约挂号 case "YUYUEGH": inobject.YUYUEXX.YIZHOUPBID = inobject.YUYUEXX.YIZHOUPBID.Split('|')[0] == "" ? inobject.YUYUEXX.DANGTIANPBID.Split('|')[0] : inobject.YUYUEXX.YIZHOUPBID.Split('|')[0]; Body_YUYUEGH yyghOut = new Body_YUYUEGH(); yyghOut.Result = new Result(); yyghOut.Result = result; sql = $"select * from V_YIYUANYZPBXX_MCP where YIZHOUPBID='{inobject.YUYUEXX.YIZHOUPBID}'";//YUYUELX 10是分配给转诊预约的,测试时用2 dt = DBVisitor.ExecuteTable(sql); if (dt.Rows.Count == 0) { result.Code = "-1"; result.Msg = $"找不到排班信息"; yyghOut.Result = result; ehrXml = MessageParse.GetXml(yyghOut); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } GUAHAOYY_IN ghyy = new GUAHAOYY_IN(); ghyy.BASEINFO = new BASEINFO(); ghyy.BASEINFO = baseinfo; ghyy.JIUZHENKLX = inobject.YUYUEXX.JIUZHENKLX == "2" ? "3" : "2"; ghyy.JIUZHENKH = inobject.YUYUEXX.JIUZHENKH; ghyy.ZHENGJIANLX = "1"; ghyy.ZHENGJIANHM = inobject.YUYUEXX.ZHENGJIANHM; ghyy.XINGMING = inobject.YUYUEXX.XINGMING; ghyy.YIZHOUPBID = inobject.YUYUEXX.YIZHOUPBID; ghyy.DANGTIANPBID = inobject.YUYUEXX.YIZHOUPBID; ghyy.RIQI = inobject.YUYUEXX.PAIBANRQ; ghyy.GUAHAOBC = inobject.YUYUEXX.GUAHAOBC; ghyy.GUAHAOLB = inobject.YUYUEXX.GUAHAOLB; ghyy.KESHIDM = inobject.YUYUEXX.KESHIDM; ghyy.YISHENGDM = inobject.YUYUEXX.YISHENGDM; ghyy.GUAHAOXH = inobject.YUYUEXX.GUAHAOXH; ghyy.LIANXIDH = inobject.YUYUEXX.LIANXIDH; ghyy.YUYUELY = "10"; string TradeMsg = MessageParse.GetXml(ghyy); string TradeMsgOut = ""; int j = RunService("HIS4.Biz.GUAHAOYY", TradeMsg, ref TradeMsgOut); // ehrXml = TradeMsgOut; GUAHAOYY_OUT yyout = new GUAHAOYY_OUT(); yyout = MessageParse.ToXmlObject <GUAHAOYY_OUT>(TradeMsgOut); if (yyout.OUTMSG.ERRNO != "0") { result.Code = "-1"; result.Msg = yyout.OUTMSG.ERRMSG; yyghOut.Result = result; ehrXml = MessageParse.GetXml(yyghOut); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } yyghOut.GUAHAOYY = new GUAHAOYY(); GUAHAOYY Outghyy = new GUAHAOYY { YUYUEID = yyout.QUHAOMM, QUHAOMM = yyout.QUHAOMM, JIUZHENSJ = yyout.JIUZHENSJ, GUAHAOXH = yyout.GUAHAOXH }; yyghOut.GUAHAOYY = Outghyy; yyghOut.FEIYONGMX = new List <Entity.FEIYONGXX>(); Entity.FEIYONGXX fyxx1 = new Entity.FEIYONGXX { XIANGMUXH = dt.Rows[0]["ZHENLIAOFEIDM"].ToString(), XIANGMUMC = dt.Rows[0]["ZHENLIAOFEIMC"].ToString(), FEIYONGLX = "04", DANJIA = dt.Rows[0]["ZHENLIAOFEI"].ToString(), XIANGMUDW = "次", SHULIANG = "1", JINE = dt.Rows[0]["ZHENLIAOFEI"].ToString(), YIBAODJ = "", YIBAODM = "", YIBAOZFBL = "" }; yyghOut.FEIYONGMX.Add(fyxx1); Entity.FEIYONGXX fyxx2 = new Entity.FEIYONGXX { XIANGMUXH = dt.Rows[0]["ZHENLIAOJSFDM"].ToString(), XIANGMUMC = dt.Rows[0]["ZHENLIAOJSFMC"].ToString(), FEIYONGLX = "14", DANJIA = dt.Rows[0]["ZHENLIAOJSF"].ToString(), XIANGMUDW = "次", SHULIANG = "1", JINE = dt.Rows[0]["ZHENLIAOJSF"].ToString(), YIBAODJ = "", YIBAODM = "", YIBAOZFBL = "" }; yyghOut.FEIYONGMX.Add(fyxx2); ehrXml = MessageParse.GetXml(yyghOut); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); break; #endregion #region 预约退号 case "YUYUETH": Body_YUYUETH yyth = new Body_YUYUETH(); yyth.Result = result; GUAHAOYYTH_IN yythIn = new GUAHAOYYTH_IN(); yythIn.BASEINFO = new BASEINFO(); yythIn.BASEINFO = baseinfo; yythIn.JIUZHENKLX = inobject.JIUZHENKLX == "2" ? "3" : "2"; yythIn.JIUZHENKH = inobject.JIUZHENKH; yythIn.ZHENGJIANLX = "1"; yythIn.ZHENGJIANHM = inobject.ZHENGJIANHM; yythIn.XINGMING = inobject.XINGMING; yythIn.YUYUELY = "10"; yythIn.QUHAOMM = inobject.QUHAOMM; TradeMsg = MessageParse.GetXml(yythIn); TradeMsgOut = ""; j = RunService("HIS4.Biz.GUAHAOYYTH", TradeMsg, ref TradeMsgOut); GUAHAOYYTH_OUT yythout = new GUAHAOYYTH_OUT(); yythout = MessageParse.ToXmlObject <GUAHAOYYTH_OUT>(TradeMsgOut); if (yythout.OUTMSG.ERRNO != "0") { result.Code = "-1"; result.Msg = yythout.OUTMSG.ERRMSG; yyth.Result = result; ehrXml = MessageParse.GetXml(yyth); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } ehrXml = MessageParse.GetXml(yyth); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); break; #endregion #region 病情自述 //modify by 沈宝 case "BINGQINGZS": Body_BINGQINGZS bqzs = new Body_BINGQINGZS(); bqzs.Result = result; BINGQINGZS_IN bqzs_in = new BINGQINGZS_IN(); bqzs_in.BASEINFO = new BASEINFO(); bqzs_in.BASEINFO = baseinfo; bqzs_in.YILIAOJGDM = inobject.YILIAOJGDM; if (string.IsNullOrEmpty(bqzs_in.YILIAOJGDM)) { result.Code = "-1"; result.Msg = "医疗机构不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.JIUZHENKLX = inobject.JIUZHENKLX; bqzs_in.JIUZHENKH = inobject.JIUZHENKH; bqzs_in.ZHENGJIANLX = inobject.ZHENGJIANLX; if (string.IsNullOrEmpty(bqzs_in.ZHENGJIANLX)) { result.Code = "-1"; result.Msg = "证件类型不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.ZHENGJIANHM = inobject.ZHENGJIANHM; if (string.IsNullOrEmpty(bqzs_in.ZHENGJIANHM)) { result.Code = "-1"; result.Msg = "证件号码不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.XINGMING = inobject.XINGMING; if (string.IsNullOrEmpty(bqzs_in.XINGMING)) { result.Code = "-1"; result.Msg = "姓名不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.YUYUEID = inobject.YUYUEID; //预约ID 是返回的信息的唯一标示; if (string.IsNullOrEmpty(bqzs_in.YUYUEID)) { result.Code = "-1"; result.Msg = "预约ID不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.GUAHAOXH = inobject.GUAHAOXH; if (string.IsNullOrEmpty(bqzs_in.GUAHAOXH)) { result.Code = "-1"; result.Msg = "挂号序号不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.RIQI = inobject.RIQI; if (string.IsNullOrEmpty(bqzs_in.RIQI)) { result.Code = "-1"; result.Msg = "日期不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.YUYUELY = inobject.YUYUELY; if (string.IsNullOrEmpty(bqzs_in.YUYUELY)) { result.Code = "-1"; result.Msg = "预约来源不能为空!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } bqzs_in.GUOMINYW = inobject.GUOMINYW; bqzs_in.BINGQINGMS = inobject.BINGQINGMS; string yuYuesj = @"select * from mz_guahaoyy where yuyueid = '{0}'and yuyuezt='0'"; //预约状态 0 未取,为1 取过,为2 取消;取过挂号单不在病情描述; DataTable dtYuYueJL = DBVisitor.ExecuteTable(string.Format(yuYuesj, bqzs_in.YUYUEID)); if (dtYuYueJL == null || dtYuYueJL.Rows.Count <= 0) { result.Code = "-1"; result.Msg = "未找到预约记录!"; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } else { string bingqingmsgx = @"update mz_guahaoyy set JIWANGSHI='{0}',GUOMINSHI='{1}' where yuyueid = '{2}'"; try { DBVisitor.ExecuteNonQuery(string.Format(bingqingmsgx, bqzs_in.BINGQINGMS, bqzs_in.GUOMINYW, bqzs_in.YUYUEID)); } catch (Exception e) { result.Code = "-1"; result.Msg = e.Message; bqzs.Result = result; ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); return; } } ehrXml = MessageParse.GetXml(bqzs); log.InfoFormat("[{2}][{0}].OUT {1}", head.DocumentID, LogUnity.I.ShowXml(ehrXml), guid); break; #endregion case "PAIBANHYXX": break; } } catch (Exception e) { log.InfoFormat("{0}", e.Message); } }
private void btnjs_Click(object sender, EventArgs e) { if (mxxx == null) { MessageBox.Show("请先取费用明细"); return; } var mzjsin = new MENZHENJS_IN(); mzjsin.BASEINFO = GetBASEINFO(); mzjsin.JIESUANID = yjsout.JIESUANID; mzjsin.JIUZHENKH = renyout.JIUZHENKH; //就诊卡号 mzjsin.BINGRENLB = renyout.BINGRENLB; //病人类别 mzjsin.BINGRENXZ = renyout.BINGRENXZ; //病人性质 mzjsin.YIBAOKLX = "3"; //医保卡类型 mzjsin.YIBAOKMM = ""; //医保卡密码 mzjsin.YIBAOKXX = ""; //医保卡信息 mzjsin.YIBAOBRXX = renyout.YIBAOBRXX; //医保病人信息 mzjsin.YILIAOLB = "00"; //医疗类别 mzjsin.JIESUANLB = "02"; //结算类别 mzjsin.JIBINGMX = mxxx.JIBINGMX; //疾病明细信息 mzjsin.FEIYONGMXTS = mxxx.FEIYONGMXTS; //费用明细条数 mzjsin.FEIYONGMX = mxxx.FEIYONGMX; //费用明细 mzjsin.HISBRXX = renyout.HISBRXX; using (var channelFactory = new SR.HisApplayClient()) { var jieguo = MessageParse.ToXmlObject <MENZHENJS_OUT>(channelFactory.RunService("His1.Biz.MENZHENJS", MessageParse.GetXml(mzjsin))); if (jieguo.OUTMSG.ERRNO == "-1") { MessageBox.Show(jieguo.OUTMSG.ERRMSG); } else { if (mzjsin.BINGRENLB == "1") { txtFEIYONGZE.Text = jieguo.JIESUANJG.FEIYONGZE; // 费用总额 txtZILIJE.Text = jieguo.JIESUANJG.ZILIJE; //自理金额 txtZIFEIJE.Text = jieguo.JIESUANJG.ZIFEIJE; //自费金额 txtZIFUJE.Text = jieguo.JIESUANJG.ZIFUJE; //自负金额 txtYIYUANCDJE.Text = jieguo.JIESUANJG.YIYUANCDJE; //医院承担金额 txtBAOXIAOJE.Text = jieguo.JIESUANJG.BAOXIAOJE; //报销金额 txtXIANJINZF.Text = jieguo.JIESUANJG.XIANJINZF; //现金支付 txtDONGJIEJE.Text = jieguo.JIESUANJG.DONGJIEJE; //冻结金额 txtYOUHUIJE.Text = jieguo.JIESUANJG.YOUHUIJE; //优惠金额 } } } }
private void button1_Click(object sender, EventArgs e) { if (mxxx == null) { MessageBox.Show("请先取费用明细"); return; } mzyjsin = new MENZHENYJS_IN(); mzyjsin.BASEINFO = GetBASEINFO(); mzyjsin.JIUZHENKH = renyout.JIUZHENKH; //就诊卡号 mzyjsin.BINGRENLB = renyout.BINGRENLB; //病人类别 mzyjsin.BINGRENXZ = renyout.BINGRENXZ; //病人性质 mzyjsin.YIBAOKLX = "3"; //医保卡类型 mzyjsin.YIBAOKMM = ""; //医保卡密码 mzyjsin.YIBAOKXX = ""; //医保卡信息 mzyjsin.YIBAOBRXX = renyout.YIBAOBRXX; //医保病人信息 mzyjsin.YILIAOLB = "00"; //医疗类别 mzyjsin.JIESUANLB = "02"; //结算类别 mzyjsin.JIBINGMX = mxxx.JIBINGMX; //疾病明细信息 mzyjsin.FEIYONGMXTS = mxxx.FEIYONGMXTS; //费用明细条数 mzyjsin.FEIYONGMX = mxxx.FEIYONGMX; //费用明细 switch (comboBox1.Text) { case "15": break; case "16": mzyjsin.JIUZHENKH = renyout.YIBAOKH; mzyjsin.YIBAOKLX = "3"; mzyjsin.YIBAOKXX = txt102kaxinxi.Text; mzyjsin.YIBAOBRXX = renyout.YIBAOBRXX; mzyjsin.HISBRXX = renyout.HISBRXX; break; case "55": break; case "56": break; default: break; } mzyjsin.HISBRXX = renyout.HISBRXX; using (var channelFactory = new SR.HisApplayClient()) { yjsout = MessageParse.ToXmlObject <MENZHENYJS_OUT>(channelFactory.RunService("His1.Biz.MENZHENYJS", MessageParse.GetXml(mzyjsin))); if (yjsout.OUTMSG.ERRNO == "-1") { MessageBox.Show(yjsout.OUTMSG.ERRMSG); } else { txtFEIYONGZE.Text = yjsout.JIESUANJG.FEIYONGZE; // 费用总额 txtZILIJE.Text = yjsout.JIESUANJG.ZILIJE; //自理金额 txtZIFEIJE.Text = yjsout.JIESUANJG.ZIFEIJE; //自费金额 txtZIFUJE.Text = yjsout.JIESUANJG.ZIFUJE; //自负金额 txtYIYUANCDJE.Text = yjsout.JIESUANJG.YIYUANCDJE; //医院承担金额 txtBAOXIAOJE.Text = yjsout.JIESUANJG.BAOXIAOJE; //报销金额 txtXIANJINZF.Text = yjsout.JIESUANJG.XIANJINZF; //现金支付 txtDONGJIEJE.Text = yjsout.JIESUANJG.DONGJIEJE; //冻结金额 txtYOUHUIJE.Text = yjsout.JIESUANJG.YOUHUIJE; //优惠金额 } } }
private void txtJZKH_KeyPress(object sender, KeyPressEventArgs e) { if ((Keys)e.KeyChar == Keys.Enter) { using (var channelFactory = new SR.HisApplayClient()) { var tradetype = "HIS1.Biz.RENYUANXX"; var renyuanxx = new HIS1.Schemas.RENYUANXX_IN(); renyuanxx.BASEINFO = GetBASEINFO(); renyuanxx.JIUZHENKH = txtJZKH.Text; //就诊卡号 renyuanxx.BINGRENLB = comboBox1.Text; //病人类别 renyuanxx.YIBAOKLX = ""; //医保卡类型 renyuanxx.YIBAOKMM = ""; //医保卡密码 renyuanxx.YIBAOKXX = ""; //医保卡信息 renyuanxx.YILIAOLB = ""; //医疗类别 renyuanxx.JIESUANLB = ""; //结算类别 renyuanxx.JIUZHENRQ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //就诊日期 switch (comboBox1.Text) { case "15": break; case "16": renyuanxx.YIBAOKLX = "3"; renyuanxx.YIBAOKXX = txt102kaxinxi.Text; break; case "55": break; case "56": break; default: break; } var outxml = channelFactory.RunService(tradetype, MessageParse.GetXml(renyuanxx)); renyout = MessageParse.ToXmlObject <RENYUANXX_OUT>(outxml); if (renyout.OUTMSG.ERRNO != "0") { MessageBox.Show(renyout.OUTMSG.ERRMSG); } else { textBox1.Text = renyout.JIUZHENKH; // 就诊卡号 textBox2.Text = renyout.BINGRENLB; // 病人类别 textBox3.Text = renyout.BINGRENXZ; // 病人性质 textBox4.Text = renyout.YIBAOKH; // 医保卡号 textBox5.Text = renyout.GERENBH; // 个人编号 textBox6.Text = renyout.BINGLIBH; // 病历本号 textBox7.Text = renyout.XINGMING; // 姓名 textBox8.Text = renyout.XINGBIE == "1" ? "男" : "女"; // 性别 textBox9.Text = renyout.MINZU; // 民族 textBox10.Text = renyout.CHUSHENGRQ; // 出生日期 textBox11.Text = renyout.ZHENGJIANLX; // 证件类型 textBox12.Text = renyout.ZHENGJIANHM; // 证件号码 textBox13.Text = renyout.DANWEILX; // 单位类型 textBox14.Text = renyout.DANWEIBH; // 单位编号 textBox15.Text = renyout.DANWEIMC; // 单位名称 textBox16.Text = renyout.JIATINGZZ; // 家庭地址 textBox17.Text = renyout.RENYUANLB; // 人员类别 textBox18.Text = renyout.DANNIANZHYE; // 当年帐户余额 textBox19.Text = renyout.LINIANZHYE; // 历年帐户余额 textBox20.Text = renyout.TESHUBZBZ; // 特殊病种标志 textBox21.Text = renyout.TESHUBZSPBH; // 特殊病种审批编号 textBox22.Text = renyout.YIBAOBRXX; // 医保病人信息 textBox23.Text = renyout.TISHIXX; // 提示信息 textBox24.Text = renyout.DAIYULB; // 待遇类别 textBox25.Text = renyout.CANBAOXZDM; // 参保行政代码 textBox26.Text = renyout.TESHUDYLB; // 特殊待遇类别 foreach (var item in renyout.TESHUBZMX) { textBox26.Text += item.JIBINGICD + "=" + item.JIBINGMC + "|"; } textBox27.Text = renyout.HISBRXX; } } } }
private void btnfymx_Click(object sender, EventArgs e) { if (renyout == null) { MessageBox.Show("请先取病人信息"); return; } var fymx = new MENZHENFYMX_IN(); fymx.BASEINFO = GetBASEINFO(); fymx.JIUZHENKH = txtJZKH.Text; //就诊卡号 fymx.BINGRENLB = comboBox1.Text; //病人类别 fymx.BINGRENXZ = renyout.BINGRENXZ; //病人性质 fymx.YIBAOKLX = "3"; //医保卡类型 fymx.YIBAOKMM = ""; //医保卡密码 fymx.YIBAOKXX = ""; //医保卡信息 fymx.YIBAOBRXX = ""; //医保病人信息 fymx.YILIAOLB = ""; //医疗类别 fymx.JIESUANLB = ""; //结算类别 fymx.HISBRXX = renyout.HISBRXX; switch (comboBox1.Text) { case "15": break; case "16": fymx.JIUZHENKH = renyout.YIBAOKH; fymx.YIBAOKLX = "3"; fymx.YIBAOKXX = txt102kaxinxi.Text; break; case "55": break; case "56": break; default: break; } using (var channelFactory = new SR.HisApplayClient()) { mxxx = MessageParse.ToXmlObject <MENZHENFYMX_OUT>(channelFactory.RunService("His1.Biz.MENZHENFYMX", MessageParse.GetXml(fymx))); if (mxxx.OUTMSG.ERRNO == "-1") { MessageBox.Show(mxxx.OUTMSG.ERRMSG); } else { var table = new DataTable(); foreach (var item in mxxx.FEIYONGMX) { table.Columns.Add("RowNum"); foreach (var col in item.GetType().GetProperties()) { table.Columns.Add(col.Name); } int i = 0; foreach (var mx in mxxx.FEIYONGMX) { i++; var newrow = table.NewRow(); newrow["RowNum"] = i.ToString(); foreach (var mxitem in mx.GetType().GetProperties()) { newrow[mxitem.Name] = mxitem.GetValue(mx, null); } table.Rows.Add(newrow); } break; } dataGridView1.DataSource = table; MessageBox.Show("共取到明细条数: " + mxxx.FEIYONGMXTS); tabControl1.SelectedTab = tabPage2; } } }