public override void ProcessMessage() { if (string.IsNullOrEmpty(InObject.pharmacyid) || !InObject.pharmacyid.Contains('*')) { throw new Exception("传入参数格式错误"); } string chuFangHM = InObject.pharmacyid.Split('*')[1]; //处方id 多个时使用#分割 string bingRenID = InObject.pharmacyid.Split('*')[0]; //病人id string pharmacyid = string.Empty; //药房id string winno = string.Empty; //窗口id #region 入参判断 if (string.IsNullOrEmpty(chuFangHM)) { throw new Exception("处方号码不能为空"); } if (string.IsNullOrEmpty(bingRenID)) { throw new Exception("病人id不能为空"); } #endregion string sqlCKXX = "select a.chufangid, a.chuangkouid chuangkouid,b.yingyongid yaofangid from mz_chufang1 a ,my_chuangkou b where a.chuangkouid = b.chuangkouid and a.chufangid in(select max(chufangid) from mz_chufang1 where chufanghm in('{0}') group by chufanghm) and a.bingrenid = '{1}' "; DataTable dtCKXX = DBVisitor.ExecuteTable(string.Format(sqlCKXX, chuFangHM, bingRenID)); if (dtCKXX.Rows.Count > 0) { pharmacyid = dtCKXX.Rows[0]["yaofangid"].ToString(); winno = dtCKXX.Rows[0]["chuangkouid"].ToString(); InObject.pharmacyid = pharmacyid; InObject.winno = winno; InObject.orderno = dtCKXX.Rows[0]["chufangid"].ToString(); string sqlJiuZhenKH = "select jiuzhenkh from gy_bingrenxx where bingrenid ='{0}'"; InObject.patientid = (string)DBVisitor.ExecuteScalar(string.Format(sqlJiuZhenKH, bingRenID)); //InObject.patientid = bingRenID; OutObject = Unity.runService <DISP_PREPARE_IN, DISP_PREPARE_OUT>(InObject); if (OutObject.ResultCode == "0") { if (OutObject.Result.state == "2") { OutObject.ResultContent = "已配药完成"; string sqlPYBZ = "update mz_chufang1 set peiyaobz = 1 where chufangid = '{0}'"; DBVisitor.ExecuteNonQuery(string.Format(sqlPYBZ, InObject.orderno)); } else { //OutObject.ResultContent = "正在配药中,请稍后!"; } } } else { throw new Exception("未找到相应的处方信息"); } }
public override void ProcessMessage() { string chuFangHM = InObject.pharmacyid.Split('*')[1]; //处方id 多个时使用|分割 string bingRenID = InObject.pharmacyid.Split('*')[0]; //病人id #region 基本入参判断 if (string.IsNullOrEmpty(chuFangHM)) { throw new Exception("处方号码不能为空"); } if (string.IsNullOrEmpty(bingRenID)) { throw new Exception("病人ID不能为空"); } #endregion string sqlCFXX = "select a.chufangid, b.yingyongid yaofangid,a.zhidanren fayaoyaoshi,a.chuangkouid fayaochuangkou from mz_chufang1 a ,my_chuangkou b where a.chuangkouid = b.chuangkouid and a.chufangid in(select max(chufangid) from mz_chufang1 where chufanghm in('{0}') group by chufanghm) and bingrenid = '{1}' "; DataTable dtCFXX = DBVisitor.ExecuteTable(string.Format(sqlCFXX, chuFangHM, bingRenID)); if (dtCFXX.Rows.Count > 0) { InObject.pharmacyid = dtCFXX.Rows[0]["yaofangid"].ToString(); InObject.winno = dtCFXX.Rows[0]["fayaochuangkou"].ToString(); InObject.dispoper = dtCFXX.Rows[0]["fayaoyaoshi"].ToString(); patientid pattemp = new patientid(); string sqlJiuZhenKH = "select jiuzhenkh from gy_bingrenxx where bingrenid ='{0}'"; pattemp.pid = (string)DBVisitor.ExecuteScalar(string.Format(sqlJiuZhenKH, bingRenID)); //pattemp.pid = bingRenID; pattemp.orderno = dtCFXX.Rows[0]["chufangid"].ToString(); InObject.patientidlist.Add(pattemp); OutObject = Unity.runService <DISP_FINISH_IN, DISP_FINISH_OUT>(InObject); } else { throw new Exception("未找到相关的处方信息!"); } }
public override void ProcessMessage() { string chuFangHM = InObject.pharmacyid.Split('*')[1]; //处方id 多个时使用|分割 string bingRenID = InObject.pharmacyid.Split('*')[0]; //病人id #region 基本入参判断 if (string.IsNullOrEmpty(chuFangHM)) { throw new Exception("处方ID不能为空"); } if (string.IsNullOrEmpty(bingRenID)) { throw new Exception("病人ID不能为空"); } #endregion chuFangHM = chuFangHM.Replace("#", "','"); string sqlChuFang = "select chufangid,chufanghm,to_char(kaidanrq,'yyyy-mm-dd') kaidanrq,chuangkouid,bingrenxm from mz_chufang1 where bingrenid ='{0}' and chufangid in(select max(chufangid) from mz_chufang1 where chufanghm in('{1}') group by chufanghm) "; DataTable dtChuFang = DBVisitor.ExecuteTable(string.Format(sqlChuFang, bingRenID, chuFangHM)); string name = string.Empty; string shiBaiCF = string.Empty;//发送失败的处方号码 if (dtChuFang.Rows.Count > 0) { name = dtChuFang.Rows[0]["bingrenxm"].ToString(); for (int i = 0; i < dtChuFang.Rows.Count; i++) { DISP_START_IN SCtemp = new DISP_START_IN(); HKC.Schemas.Start.order dtemp = new HKC.Schemas.Start.order(); string no = dtChuFang.Rows[i]["chufangid"].ToString(); string odate = dtChuFang.Rows[i]["kaidanrq"].ToString(); string winno = dtChuFang.Rows[i]["chuangkouid"].ToString(); string sqlJiuZhenKH = "select jiuzhenkh from gy_bingrenxx where bingrenid ='{0}'"; SCtemp.pid = (string)DBVisitor.ExecuteScalar(string.Format(sqlJiuZhenKH, bingRenID)); SCtemp.name = name; SCtemp.codekey = InObject.codekey; dtemp.no = no; dtemp.odate = odate; dtemp.winno = winno; SCtemp.orderinfo.Add(dtemp); string yfid = "select yingyongid from my_chuangkou where chuangkouid = '{0}' "; DataTable dtYFID = DBVisitor.ExecuteTable(string.Format(yfid, winno)); if (dtYFID.Rows.Count > 0) { SCtemp.pharmacyid = dtYFID.Rows[0]["yingyongid"].ToString(); } else { //获取药房id失败 shiBaiCF += "," + no; continue; } DISP_START_OUT outTemp = Unity.runService <DISP_START_IN, DISP_START_OUT>(SCtemp); //上传失败 if (outTemp.ResultCode != "0") { shiBaiCF += "," + no; continue; } } if (!string.IsNullOrEmpty(shiBaiCF)) { //返回失败的处方号码 throw new Exception("处方号为:" + shiBaiCF.Trim(',').ToString() + "的处方上传失败!"); } } else { throw new Exception("未找到相关的处方信息"); } }