Пример #1
0
        public override void ProcessMessage()
        {
            if (string.IsNullOrEmpty(InObject.LEIXING))
            {
                throw new Exception("日志类型不能为空!");
            }
            if (string.IsNullOrEmpty(InObject.CONTEXT))
            {
                throw new Exception("日志内容不能为空!");
            }
            string RiZId = "";
            var    maxid = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.HIS00026, " seq_GY_RIZHI_ZZJ.nextval "));

            if (maxid == null)
            {
                throw new Exception(string.Format("获取日志ID失败!"));
            }
            else
            {
                RiZId = maxid.Items["MAXID"].ToString();
            }
            string StrTct = InObject.CONTEXT.Replace("'", "").Trim();

            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.HIS00027, RiZId, InObject.JIUZHENKH, StrTct, InObject.BASEINFO.CAOZUOYDM,
                                                        InObject.IP, InObject.LEIXING, InObject.ERRBZ));
            OutObject = new CAOZUORIJL_OUT();
        }
Пример #2
0
        public override void ProcessMessage()
        {
            if (string.IsNullOrEmpty(InObject.ZHENGJIANHM))
            {
                throw new Exception("证件号码不能为空!");
            }
            if (string.IsNullOrEmpty(InObject.XINGMING))
            {
                throw new Exception("姓名不能为空!");
            }
            if (string.IsNullOrEmpty(InObject.BASEINFO.FENYUANDM))
            {
                throw new Exception("分院代码不能为空!");
            }
            if (string.IsNullOrEmpty(InObject.JIUZHENKLX))
            {
                throw new Exception("就诊卡类型不能为空");
            }
            if (string.IsNullOrEmpty(InObject.JIUZHENKH))
            {
                throw new Exception("就诊卡号不能为空");
            }
            //判断是否存在传入身份证号的病人信息
            string fydmwhere = "";

            if (InObject.JIUZHENKLX != "2")
            { //如果是社保卡 则不增加医院条件 社保卡 全区都可以用
                fydmwhere = string.Format(" and  FENYUANDM='{0}'", InObject.BASEINFO.FENYUANDM);
            }
            InObject.JIUZHENKH = System.Convert.ToString(InObject.JIUZHENKH.ToUpper()).PadLeft(10, '0');
            var existInfo = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.HIS00004, InObject.ZHENGJIANHM.ToLower(), InObject.JIUZHENKH, InObject.JIUZHENKLX, fydmwhere));

            //if (InObject.JIUZHENKLX == "2" && InObject.BASEINFO.FENYUANDM == "10006" && existInfo == null)
            //{
            //    if (InObject.JIUZHENKH.Length == 10)
            //    {
            //        existInfo = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.HIS00004, InObject.ZHENGJIANHM.ToLower(), InObject.JIUZHENKH.Substring(1, 9), InObject.JIUZHENKLX, fydmwhere));
            //    }
            //}

            if (existInfo == null || existInfo.Items["ZUOFEIPB"].ToString() == "1")
            {
                throw new Exception("查询不到身份证号为【" + InObject.ZHENGJIANHM + "】的签约信息!");
            }
            if (InObject.XINGMING.ToString() != existInfo.Items["BINGRENXM"].ToString())
            {
                throw new Exception(string.Format("传入病人姓名[{0}]与签约账户姓名[{1}]不符", InObject.XINGMING, existInfo.Items["BINGRENXM"]));
            }
            OutObject           = new ZHIFUBAOBDCX_OUT();
            OutObject.ZHIFUBXYH = existInfo.Items["XIEYIHM"].ToString();
        }
Пример #3
0
        /// <summary>
        /// 获取数据库参数配置
        /// </summary>
        /// <param name="sysNum">系统序号</param>
        /// <param name="varName">参数名称</param>
        /// <param name="varNum">参数序号</param>
        /// <param name="initValue">初始值</param>
        /// <returns>返回值</returns>
        public static string DbConfigValue(string sysNum, string varName, string varNum, string initValue)
        {
            string outVar     = "";
            string dynamicSql = string.Format("Select Decode({0},1,Csz1,Csz2) Value From Gy_Xtcs Where Csmc = '{1}' And Xtxh = {2}", varNum, varName, sysNum);
            var    Result     = DBVisitor.ExecuteModel(dynamicSql);

            if (Result != null)
            {
                outVar = Result.Items["VALUE"].ToString();
            }
            else
            {
                outVar = initValue;
            }
            return(outVar);
        }
Пример #4
0
        public override void ProcessMessage()
        {
            //取得预约信息
            OutObject = new SHEBEIYYQX_OUT();
            if (InObject.YUYUESQDBH == null || InObject.YUYUESQDBH == "")
            {
                throw new Exception(string.Format("预约申请单编号为空!"));
            }
            var listyyxx = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00004, InObject.YUYUESQDBH.ToString()));

            if (listyyxx == null)
            {
                OutObject.OUTMSG.ERRNO  = "-2";
                OutObject.OUTMSG.ERRMSG = string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString());
                return;
                //throw new Exception(string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString()));
            }
            if (listyyxx.Items.Count == 0)
            {
                OutObject.OUTMSG.ERRNO  = "-2";
                OutObject.OUTMSG.ERRMSG = string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString());
                return;
                //throw new Exception(string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString()));
            }

            if (System.Configuration.ConfigurationManager.AppSettings["JianChaJKMS"] == "1")
            {
                var resource = new HISYY_Cancel();
                resource.RequestNo = listyyxx.Items["YYH"].ToString();
                resource.YYH       = "";
                resource.JCH       = "";
                string url = System.Configuration.ConfigurationManager.AppSettings["LAIDAURL"];
                string xml = XMLHandle.EntitytoXML <HISYY_Cancel>(resource);
                HISYY_Cancel_Result result = XMLHandle.XMLtoEntity <HISYY_Cancel_Result>(WSServer.Call <HISYY_GetResource>(url, xml).ToString());
                if (result.Success == "False")
                {
                    throw new Exception("取消预约失败,错误原因:" + result.Message);
                }
                var tran = DBVisitor.Connection.BeginTransaction();
                try
                {
                    DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00005, InObject.YUYUESQDBH.ToString(), 9), tran);
                    tran.Commit();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw ex;
                }
            }
            else
            {
                var listyyhxx = DBVisitor.ExecuteModels(SqlLoad.GetFormat(SQ.FSD00014, listyyxx.Items["JCSBDM"].ToString(), listyyxx.Items["JCRQ"].ToString(), listyyxx.Items["JCSJ"].ToString()));
                foreach (var item in listyyhxx)
                {
                    var listyyh = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00010, item.Get("yyhxx").ToString(), listyyxx.Items["YYH"].ToString()));
                    var zyyyys  = int.Parse(item.Get("zyyyys"));
                    var mzyyys  = int.Parse(item.Get("mzyyys"));
                    var sqyyys  = int.Parse(item.Get("sqyyys"));
                    var yyys    = int.Parse(item.Get("yyys"));
                    var yyly    = listyyxx.Items["YYLY"].ToString();
                    if (yyly == "3")
                    {
                        --sqyyys;
                    }
                    else if (yyly == "2")
                    {
                        --zyyyys;
                    }
                    else if (yyly == "1")
                    {
                        --mzyyys;
                    }
                    else
                    {
                        if (listyyxx.Items["BRLX"].ToString() == "2")
                        {
                            --zyyyys;
                        }
                    }

                    //if (listyyxx.Items["BRLX"].ToString() == "2")
                    //{
                    //    --zyyyys;
                    //}
                    if (listyyh == null)
                    {
                        continue;
                    }
                    if (listyyh.Items.Count > 0)
                    {
                        var tran = DBVisitor.Connection.BeginTransaction();
                        try
                        {
                            //更新预约信息状态为取消
                            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00005, InObject.YUYUESQDBH.ToString(), 9), tran);
                            //更新预约号状态
                            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00009, item.Get("yyhxx").ToString(), listyyxx.Items["YYH"], 0), tran);
                            //更新预约排班表
                            if (yyly == "3")
                            {
                                DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00021, item.Get("yyhxx").ToString(), int.Parse(item.Get("yyys")) - 1, sqyyys), tran);
                            }
                            else if (yyly == "2")
                            {
                                DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00008, item.Get("yyhxx").ToString(), int.Parse(item.Get("yyys")) - 1, zyyyys), tran);
                            }
                            else if (yyly == "1")
                            {
                                DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00020, item.Get("yyhxx").ToString(), int.Parse(item.Get("yyys")) - 1, mzyyys), tran);
                            }
                            else
                            {
                                DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00008, item.Get("yyhxx").ToString(), int.Parse(item.Get("yyys")) - 1, zyyyys), tran);
                            }
                            tran.Commit();
                        }
                        catch (Exception ex)
                        {
                            tran.Rollback();
                            throw ex;
                        }
                    }
                }
            }
        }
Пример #5
0
        public override void ProcessMessage()
        {
            if (InObject.YUYUERQ == null)
            {
                throw new Exception(string.Format("预约日期不能为空!"));
            }
            if (InObject.YUYUESJ == null)
            {
                throw new Exception(string.Format("预约时间不能为空!"));
            }
            //if (InObject.JIANCHAXMDM == null || InObject.JIANCHAXMDM == "")
            //{
            //    throw new Exception(string.Format("检查项目不能为空!"));
            //}
            if (InObject.BINGRENLX == null || InObject.BINGRENLX < 1 || InObject.BINGRENLX > 3)
            {
                throw new Exception(string.Format("病人类型代码不对!"));
            }
            if (InObject.YEWULY == null)
            {
                InObject.YEWULY = InObject.BINGRENLX.ToString();
            }
            var jcsbdm = InObject.JIANCHASBDM.ToString();
            var yyrq   = InObject.YUYUERQ.ToString();
            var yysj   = InObject.YUYUESJ.ToString();
            var yyh    = "";

            //不能预约以前的日期
            if (string.Compare(yyrq, DateTime.Now.ToString("yyyy-MM-dd")) < 0)
            {
                throw new Exception(string.Format("预约日期必须大于等于今天!"));
            }

            if (System.Configuration.ConfigurationManager.AppSettings["JianChaJKMS"] == "1")
            {
                HISYY_Submit resource = new HISYY_Submit();
                var          yysqdbh  = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00018)).Items["YYSQDBH"].ToString();
                //检查
                if (InObject.YEWULY == "1")
                {
                    #region 调用包,判断入参是否正确
                    var jyjcdxx = "";
                    var jyjcmx  = "";
                    var zdmx    = "";
                    var jcxmdm  = "";
                    int i       = 0;
                    if (InObject.JIANCHALB.Count < 1)
                    {
                        throw new Exception(string.Format("检查项目不能为空!"));
                    }
                    #region 检查单信息
                    jyjcdxx += InObject.JIUZHENKLX + "|";                       //	就诊卡类型
                    jyjcdxx += InObject.JIUZHENKH + "|";                        //	就诊卡号
                    jyjcdxx += InObject.SHENQINGYSGH + "|";                     //	送检医生
                    jyjcdxx += InObject.SHENQINGYYDM + "|";                     //	送检科室
                    jyjcdxx += InObject.YUYUESF + "|";                          //	收费识别
                    jyjcdxx += InObject.BINGQINGMS + "|";                       //	病情描述
                    jyjcdxx += InObject.ZHENDUAN + "|";                         //	诊断
                    jyjcdxx += InObject.BINGRENTZ + "|";                        //	病人体征
                    jyjcdxx += InObject.QITAJC + "|";                           //	其它检查
                    jyjcdxx += InObject.BINGRENZS + "|";                        //	病人主诉
                    jyjcdxx += InObject.YEWULY + "|";                           //	检查来源
                    jyjcdxx += InObject.BINGRENXM + "|";                        //	病人姓名
                    jyjcdxx += InObject.SHENFENZH + "|";                        //	病人身份证号
                    jyjcdxx += "0" + "|";                                       //	接收方式
                    jyjcdxx += "|";                                             //	检查申请单号
                    jyjcdxx += InObject.YUYUERQ + " " + InObject.YUYUESJ + "|"; //	检查日期
                    jyjcdxx += InObject.BINGRENXB + "|";                        //	病人性别
                    jyjcdxx += InObject.BINGRENNL;                              //	病人年龄
                    #endregion
                    #region 检验检查明细
                    foreach (var item in InObject.JIANCHALB)
                    {
                        if (i == 0)
                        {
                            jcxmdm = item.JIANCHAXMBH;
                        }
                        else
                        {
                            jcxmdm += "," + item.JIANCHAXMBH;
                        }
                        ++i;
                        jyjcmx += item.JIANCHAXMBH + "|"; //	检查项目编号
                        jyjcmx += item.JIANCHAXMMC + "|"; //	检查项目名称
                        jyjcmx += item.JIANCHAFLBM + "|"; //	检查分类编码
                        jyjcmx += item.JIANCHASTBW + "|"; //	检查身体部位
                        jyjcmx += item.JIANCHAFXDM + "|"; //	检查方向代码
                        jyjcmx += item.JIANCHAZYDM + "|"; //	检查肢位代码
                        jyjcmx += item.JIANCHATS + "^";   //	检查提示
                    }
                    #endregion
                    #region 疾病明细
                    foreach (var item in InObject.ZHENDUANLB)
                    {
                        zdmx += item.ICD10 + "|";      //	ICD10
                        zdmx += item.ZHENDUANMC + "^"; //	诊断名称
                    }
                    #endregion
                    #region 调用包
                    var jianchakd = SqlLoad.GetProcedure(SQ.P_FSD00030);
                    jianchakd["ywlx"]    = 1;
                    jianchakd["jyjcdxx"] = jyjcdxx;
                    jianchakd["jyjcmx"]  = jyjcmx;
                    jianchakd["zdmx"]    = zdmx;
                    jianchakd["jylx"]    = 1;
                    jianchakd["errno"]   = -1;
                    jianchakd["errmsg"]  = string.Empty.PadRight(1024);
                    jianchakd["outdata"] = string.Empty.PadRight(1024);
                    DBVisitor.ExecuteProcedure(jianchakd);

                    if (jianchakd["errno"].ToString() != "0")
                    {
                        throw new Exception("更新库存失败:" + jianchakd["errmsg"]);
                    }
                    #endregion
                    #endregion

                    if (InObject.YEWULX == "2")
                    {
                        resource.AdmissionSource = "10";
                    }
                    else
                    {
                        resource.AdmissionSource = "50";
                    }
                    resource.HospitalCode = InObject.BASEINFO.JIGOUDM;
                    resource.HospitalName = "余杭三院";
                    resource.PatientName  = InObject.BINGRENXM;
                    resource.IdNumber     = InObject.SHENFENZH;
                    resource.RequestNo    = yysqdbh;
                    if (InObject.YEWULY == "2")
                    {
                        resource.AdmissionID = InObject.BINGRENZYH;
                    }
                    else
                    {
                        resource.AdmissionID = InObject.BINGRENMZH;
                    }
                    resource.ExaminePartTime   = InObject.XIANGMUHS;
                    resource.PatientSex        = InObject.BINGRENXB.ToString();
                    resource.PatientBorn       = InObject.BINGRENCSRQ;
                    resource.PatientAge        = InObject.BINGRENNL;
                    resource.PatientTel        = InObject.BINGRENLXDH;
                    resource.PatientAddress    = InObject.BINGRENLXDZ;
                    resource.PatientCard       = InObject.BINGRENKH;
                    resource.InPatientAreaName = InObject.BINGRENBQMC;
                    resource.InPatientAreaCode = InObject.BINGRENBQDM;
                    resource.BedNum            = InObject.BINGRENCWH;
                    resource.DeviceCode        = InObject.JIANCHASBDM.ToString();
                    resource.DeviceName        = InObject.JIANCHASBMC;
                    var codes = DBVisitor.ExecuteModels(SqlLoad.GetFormat(SQ.FSD00027, jcxmdm));
                    foreach (var code in codes)
                    {
                        resource.StudiesExamine.Add(new StudiesExamine()
                        {
                            ExamineCode  = code["LBXH"].ToString(),
                            ExamineName  = Unity.encodeString(code["LBMC"].ToString()),
                            Numbers      = "1",
                            ExaminePrice = DBVisitor.ExecuteScalar(SqlLoad.GetFormat(SQ.FSD00029, code["LBXH"].ToString())).ToString()
                        });
                    }
                    resource.ExamineFY  = resource.StudiesExamine.Sum <StudiesExamine>(group => { return(Convert.ToDecimal(group.ExaminePrice)); }).ToString();
                    resource.ReceiptNum = InObject.BINGRENFPH;
                    codes = DBVisitor.ExecuteModels(SqlLoad.GetFormat(SQ.FSD00027, jcxmdm));
                    resource.ZxDepartmentId   = codes[0]["JCKS"].ToString();
                    resource.ZxDepartmentName = codes[0]["KSMC"].ToString();
                    resource.Sqrq             = InObject.BASEINFO.CAOZUORQ;
                    resource.BespeakDateTime  = InObject.YUYUERQ + " " + InObject.YUYUESJ;
                    resource.JZ = "0"; // InObject.JIZHEN;
                    resource.ZQ = "0"; //InObject.ZENGQIANG;
                    resource.LS = "0"; //InObject.LINSHI;
                    resource.PF = "1";

                    ///调用WEBSERVICE
                    string url = System.Configuration.ConfigurationManager.AppSettings["LAIDAURL"];
                    string xml = XMLHandle.EntitytoXML <HISYY_Submit>(resource);
                    HISYY_Submit_Result result = XMLHandle.XMLtoEntity <HISYY_Submit_Result>(WSServer.Call <HISYY_Submit>(url, xml).ToString());

                    if (result.Success == "False")
                    {
                        throw new Exception("预约失败,错误原因:" + result.Message);
                    }

                    var tran = DBVisitor.Connection.BeginTransaction();
                    try
                    {
                        #region 先插入到临时表
                        var ID     = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00024, " seq_sxzz_jianchad.nextval "));
                        var xh     = "";
                        var JCSQDH = result.JCH;
                        int k      = 0;
                        if (ID == null)
                        {
                            throw new Exception(string.Format("检查单序列获取失败!"));
                        }
                        else
                        {
                            xh = ID.Items["MAXID"].ToString();
                        }
                        //var SQDH = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00023, " SEQ_GY_YXSQD_SQDH.NEXTVAL "));
                        //if (SQDH == null)
                        //{
                        //    throw new Exception(string.Format("申请单号获取失败!"));
                        //}
                        //else
                        //{
                        //    JCSQDH = SQDH.Items["MAXID"].ToString();
                        //}
                        //插入检查单信息
                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00022,
                                                                    xh, "", InObject.BINGRENMZH, InObject.BINGRENXM,
                                                                    InObject.SHENFENZH, InObject.SHENQINGYSGH, InObject.JIANCHAKSDM, 0,
                                                                    InObject.BINGQINGMS, InObject.ZHENDUAN, InObject.BINGRENTZ, InObject.QITAJC,
                                                                    InObject.BINGRENZS, InObject.YEWULX, 0, JCSQDH, InObject.YUYUERQ,
                                                                    InObject.BINGRENXB, InObject.BINGRENNL), tran);
                        //插入检查明细
                        foreach (var item in InObject.JIANCHALB)
                        {
                            ++k;
                            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00023,
                                                                        xh, k, item.JIANCHAXMBH,
                                                                        item.JIANCHAXMMC, item.JIANCHAFLBM, item.JIANCHASTBW,
                                                                        item.JIANCHAFXDM, item.JIANCHAZYDM, item.JIANCHATS), tran);
                        }
                        k = 0;
                        //插入诊断明细
                        foreach (var item in InObject.ZHENDUANLB)
                        {
                            ++k;
                            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00025,
                                                                        xh, k, item.ICD10, item.ZHENDUANMC), tran);
                        }


                        #endregion

                        var listyylsh = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00017));
                        var yysqlsh   = listyylsh.Items["YYSQLSH"].ToString();

                        //插入预约申请信息fdsyy_sq
                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00011,
                                                                    "申请单",                 //预约申请单名称
                                                                    InObject.YUYUEZT,      //预约申请单状态(0未确认,1已确认,9作废)
                                                                    InObject.JIANCHAKSDM,  //检查科室代码
                                                                    InObject.JIANCHAKSMC,  //检查科室名称
                                                                    InObject.BINGRENFPH,   //病人发票号
                                                                    InObject.BINGRENLX,    //病人类型
                                                                    InObject.BINGRENLXMC,  //病人类型名称
                                                                    InObject.BINGRENKH,    //病人卡号
                                                                    InObject.BINGRENMZH,   //病人门诊号
                                                                    InObject.BINGRENZYH,   //病人住院号
                                                                    InObject.BINGRENBQDM,  //病人病区代码
                                                                    InObject.BINGRENBQMC,  //病人病区名称
                                                                    InObject.BINGRENCWH,   //病人床位号
                                                                    InObject.BINGRENXM,    //病人姓名
                                                                    InObject.BINGRENXB,    //病人性别
                                                                    InObject.BINGRENNL,    //病人年龄
                                                                    InObject.BINGRENCSRQ,  //病人出生日期
                                                                    InObject.BINGRENLXDZ,  //病人联系地址
                                                                    InObject.BINGRENLXDH,  //病人联系电话
                                                                    InObject.SHENQINGYSGH, //申请医生工号
                                                                    InObject.SHENQINGYSMC, //申请医生姓名
                                                                    "",                    //申请科室代码
                                                                    "",                    //申请科室名称
                                                                    InObject.SHENQINGYYDM, //申请医院代码
                                                                    InObject.SHENQINGYYMC, //申请医院名称
                                                                    result.JCH,            //检查号
                                                                    InObject.YUYUERQ,      //检查日期
                                                                    InObject.YUYUESJ,      //检查时间

                                                                    jcxmdm,                //InObject.JIANCHAXMDM,//检查项目代码
                                                                    InObject.JIANCHAXMMC,  //检查项目名称

                                                                    InObject.JIANCHAXMLX,  //检查项目类型
                                                                    InObject.JIANCHABWDM,  //检查部位代码
                                                                    InObject.JIANCHABWMC,  //检查部位名称
                                                                    InObject.JIANCHASBDM,  //检查设备代码
                                                                    InObject.JIANCHASBMC,  //检查设备名称
                                                                    InObject.JIANCHASBDD,  //检查设备地点
                                                                    result.YYH,            //预约号
                                                                    InObject.SHENFENZH,    //身份证号
                                                                    InObject.YUYUESF,      //预约收费(0未收费,1已收费)
                                                                    InObject.JIANCHASQDBH, //检查申请单编号
                                                                    InObject.YINGXIANGFX,
                                                                    "",                    //影像方向
                                                                    yysqlsh,               //预约申请流水号
                                                                    yysqdbh,               //预约申请单编号
                                                                    InObject.XIANGMUHS,    //详细安排时间
                                                                    InObject.YEWULY,
                                                                    InObject.YEWULX,
                                                                    InObject.ZENGQIANG,
                                                                    InObject.JIZHEN,
                                                                    InObject.LINSHI
                                                                    ), tran);//业务来源
                        tran.Commit();

                        OutObject            = new SHEBEIYY_OUT();
                        OutObject.YUYUERQ    = InObject.YUYUERQ;
                        OutObject.YUYUESJ    = InObject.YUYUESJ;
                        OutObject.YUYUEH     = result.YYH;
                        OutObject.JIANCHAH   = result.JCH;
                        OutObject.YUYUESQDBH = yysqdbh;
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        throw ex;
                    }
                }
                //检验
                else
                {
                }
            }
            else
            {
                #region 市二
                if (InObject.JIANCHAXMDM == null || InObject.JIANCHAXMDM == "")
                {
                    throw new Exception(string.Format("检查项目不能为空!"));
                }
                var listjcsb = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00007, jcsbdm));
                if (listjcsb == null)
                {
                    throw new Exception(string.Format("未找到预约设备:设备编号[{0}]", jcsbdm));
                }
                if (listjcsb.Items.Count == 0)//判断有无该设备
                {
                    throw new Exception(string.Format("未找到预约设备:设备编号[{0}]", jcsbdm));
                }
                else
                {
                    if (listjcsb.Items["JCSBZT"].ToString() != "0")//设备是否可用
                    {
                        throw new Exception(string.Format("预约设备故障或者已停用:设备编号[{0}]", jcsbdm));
                    }
                    else
                    {
                        if (listjcsb.Items["SBYYBZ"].ToString() != "0")//设备是否可预约
                        {
                            throw new Exception(string.Format("预约设备为不可预约状态:设备编号[{0}]", jcsbdm));
                        }
                        else
                        {
                            //获取设备某天预约排班信息
                            var listsbyyxx = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00002, jcsbdm, yyrq, yysj, 0));
                            if (listsbyyxx == null)
                            {
                                throw new Exception(string.Format("未找到预约号信息!"));
                            }
                            //取得预约类型,再去取预约号及状态
                            var jcyylx = int.Parse(listsbyyxx.Items["JCYYLX"].ToString());
                            var yyhxx  = int.Parse(listsbyyxx.Items["YYHXX"].ToString());
                            var yyzs   = int.Parse(listsbyyxx.Items["YYZS"].ToString());
                            var kyys   = int.Parse(listsbyyxx.Items["KYYS"].ToString());
                            var xcyls  = int.Parse(listsbyyxx.Items["XCYLS"].ToString());
                            var yyys   = int.Parse(listsbyyxx.Items["YYYS"].ToString());
                            int xcyy   = 0;//现场预约值为2,则检索所有数据
                            var zykyys = int.Parse(listsbyyxx.Items["ZYKYYS"].ToString());
                            var zyyyys = int.Parse(listsbyyxx.Items["ZYYYYS"].ToString());
                            var mzkyys = int.Parse(listsbyyxx.Items["MZKYYS"].ToString());
                            var mzyyys = int.Parse(listsbyyxx.Items["MZYYYS"].ToString());
                            var sqkyys = int.Parse(listsbyyxx.Items["SQKYYS"].ToString());
                            var sqyyys = int.Parse(listsbyyxx.Items["SQYYYS"].ToString());
                            var tran   = DBVisitor.Connection.BeginTransaction();
                            var yysjd  = listsbyyxx.Items["KSSJ"].ToString() + "-" + listsbyyxx.Items["JSSJ"].ToString();
                            if (string.Compare(listsbyyxx.Items["PBRQ"].ToString(), DateTime.Now.ToString("yyyy-MM-dd")) == 0)
                            {
                                xcyy = 2;
                            }
                            if (xcyy == 0)//非现场预约,则判断门诊住院预约的比例值
                            {
                                if (InObject.BINGRENLX == 2)
                                {
                                    if (InObject.YEWULY == "3")
                                    {
                                        if (sqkyys <= sqyyys)
                                        {
                                            throw new Exception(string.Format("当前社区可预约数已预约完,不能再预约!"));
                                        }
                                        ++sqyyys;
                                    }
                                    else
                                    {
                                        if (zykyys <= zyyyys)
                                        {
                                            throw new Exception(string.Format("当前住院可预约数已预约完,不能再预约!"));
                                        }
                                        ++zyyyys;
                                    }
                                }
                                else
                                {
                                    if (InObject.YEWULY == "3")
                                    {
                                        if (sqkyys <= sqyyys)
                                        {
                                            throw new Exception(string.Format("当前社区可预约数已预约完,不能再预约!"));
                                        }
                                        ++sqyyys;
                                    }
                                    else
                                    {
                                        if (mzkyys <= mzyyys)
                                        {
                                            throw new Exception(string.Format("当前门诊可预约数已预约完,不能再预约!"));
                                        }
                                        ++mzyyys;
                                    }
                                }
                            }
                            if (jcyylx == 1)//有预约号模式
                            {
                                if (InObject.YUYUEH == null || InObject.YUYUEH == "")
                                {
                                    throw new Exception(string.Format("预约号不能为空!"));
                                }
                                yyh = InObject.YUYUEH.ToString();
                                var listsbyyhxx = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00010, yyhxx, yyh));
                                if (listsbyyhxx == null)
                                {
                                    throw new Exception(string.Format("未找到预约号:预约号:[{0}]!", yyh));
                                }
                                if (listsbyyhxx.Items["YYZT"].ToString() == "1")
                                {
                                    throw new Exception(string.Format("该预约号已被预约:预约号:[{0}]!", yyh));
                                }
                                else
                                {
                                    try
                                    {
                                        if (InObject.YEWULY == "3")
                                        {
                                            //更新预约排班表 社区
                                            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00021, yyhxx, yyys + 1, sqyyys), tran);
                                        }
                                        else if (InObject.BINGRENLX == 2)
                                        {
                                            //更新预约排班表 住院
                                            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00008, yyhxx, yyys + 1, zyyyys), tran);
                                        }
                                        else
                                        {
                                            //更新预约排班表 门诊
                                            DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00020, yyhxx, yyys + 1, mzyyys), tran);
                                        }
                                        //更新预约排班表
                                        //DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00008, yyhxx, yyys + 1, zyyyys), tran);
                                        //更新预约号状态
                                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00009, yyhxx, yyh, 1), tran);
                                        //tran.Commit();
                                    }
                                    catch (Exception ex)
                                    {
                                        tran.Rollback();
                                        throw ex;
                                    }
                                }
                            }
                            else//无预约号模式
                            {
                                try
                                {
                                    //取得当前预约信息未预约的最小号码
                                    var listsbyyhxx = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00013, yyhxx, xcyy));
                                    if (listsbyyhxx == null)
                                    {
                                        throw new Exception(string.Format("预约已满!"));
                                    }
                                    yyh = listsbyyhxx.Items["YYH"].ToString();
                                    if (InObject.YEWULY == "3")
                                    {
                                        //更新预约排班表 社区
                                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00021, yyhxx, yyys + 1, sqyyys), tran);
                                    }
                                    else if (InObject.BINGRENLX == 2)
                                    {
                                        //更新预约排班表 住院
                                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00008, yyhxx, yyys + 1, zyyyys), tran);
                                    }
                                    else
                                    {
                                        //更新预约排班表 门诊
                                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00020, yyhxx, yyys + 1, mzyyys), tran);
                                    }
                                    //更新预约排班表
                                    //DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00008, yyhxx, yyys + 1, zyyyys), tran);
                                    //更新预约号状态
                                    DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00009, yyhxx, yyh, 1), tran);
                                    //tran.Commit();
                                }
                                catch (Exception ex)
                                {
                                    tran.Rollback();
                                    throw ex;
                                }
                            }
                            try
                            {
                                var listyylsh   = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00017));
                                var yysqlsh     = listyylsh.Items["YYSQLSH"].ToString();
                                var listyysqdbh = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00018));
                                var yysqdbh     = listyysqdbh.Items["YYSQDBH"].ToString();
                                //插入预约申请信息fdsyy_sq
                                DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00011,
                                                                            "申请单",                 //预约申请单名称
                                                                            InObject.YUYUEZT,      //预约申请单状态(0未确认,1已确认,9作废)
                                                                            InObject.JIANCHAKSDM,  //检查科室代码
                                                                            InObject.JIANCHAKSMC,  //检查科室名称
                                                                            InObject.BINGRENFPH,   //病人发票号
                                                                            InObject.BINGRENLX,    //病人类型
                                                                            InObject.BINGRENLXMC,  //病人类型名称
                                                                            InObject.BINGRENKH,    //病人卡号
                                                                            InObject.BINGRENMZH,   //病人门诊号
                                                                            InObject.BINGRENZYH,   //病人住院号
                                                                            InObject.BINGRENBQDM,  //病人病区代码
                                                                            InObject.BINGRENBQMC,  //病人病区名称
                                                                            InObject.BINGRENCWH,   //病人床位号
                                                                            InObject.BINGRENXM,    //病人姓名
                                                                            InObject.BINGRENXB,    //病人性别
                                                                            InObject.BINGRENNL,    //病人年龄
                                                                            InObject.BINGRENCSRQ,  //病人出生日期
                                                                            InObject.BINGRENLXDZ,  //病人联系地址
                                                                            InObject.BINGRENLXDH,  //病人联系电话
                                                                            InObject.SHENQINGYSGH, //申请医生工号
                                                                            InObject.SHENQINGYSMC, //申请医生姓名
                                                                            "",                    //申请科室代码
                                                                            "",                    //申请科室名称
                                                                            InObject.SHENQINGYYDM, //申请医院代码
                                                                            InObject.SHENQINGYYMC, //申请医院名称
                                                                            "",                    //检查号
                                                                            InObject.YUYUERQ,      //检查日期
                                                                            InObject.YUYUESJ,      //检查时间
                                                                            InObject.JIANCHAXMDM,  //检查项目代码
                                                                            InObject.JIANCHAXMMC,  //检查项目名称
                                                                            InObject.JIANCHAXMLX,  //检查项目类型
                                                                            InObject.JIANCHABWDM,  //检查部位代码
                                                                            InObject.JIANCHABWMC,  //检查部位名称
                                                                            InObject.JIANCHASBDM,  //检查设备代码
                                                                            InObject.JIANCHASBMC,  //检查设备名称
                                                                            InObject.JIANCHASBDD,  //检查设备地点
                                                                            yyh,                   //预约号
                                                                            InObject.SHENFENZH,    //身份证号
                                                                            InObject.YUYUESF,      //预约收费(0未收费,1已收费)
                                                                            InObject.JIANCHASQDBH, //检查申请单编号
                                                                            InObject.YINGXIANGFX,
                                                                            yysjd,                 //影像方向
                                                                            yysqlsh,               //预约申请流水号
                                                                            yysqdbh,               //预约申请单编号
                                                                            InObject.XIANGXIAPSJ,  //详细安排时间
                                                                            InObject.YEWULY,
                                                                            1,
                                                                            0,
                                                                            0,
                                                                            0), tran);//业务来源
                                tran.Commit();
                                OutObject            = new SHEBEIYY_OUT();
                                OutObject.YUYUERQ    = yyrq;
                                OutObject.YUYUESJ    = yysj;
                                OutObject.YUYUEH     = yyh;
                                OutObject.YUYUESQDBH = yysqdbh;
                            }
                            catch (Exception ex)
                            {
                                tran.Rollback();
                                throw ex;
                            }
                        }
                    }
                }
                #endregion
            }
        }
Пример #6
0
        public override void ProcessMessage()
        {
            //取得预约信息
            OutObject = new SHEBEIYYQR_OUT();
            if (InObject.YUYUESQDBH == null || InObject.YUYUESQDBH == "")
            {
                throw new Exception(string.Format("预约申请单编号为空!"));
            }
            var listyyxx = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.FSD00004, InObject.YUYUESQDBH.ToString()));

            if (listyyxx == null)
            {
                OutObject.OUTMSG.ERRNO  = "-2";
                OutObject.OUTMSG.ERRMSG = string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString());
                return;
                //throw new Exception(string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString()));
            }
            if (listyyxx.Items.Count == 0)
            {
                OutObject.OUTMSG.ERRNO  = "-2";
                OutObject.OUTMSG.ERRMSG = string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString());
                return;
                //throw new Exception(string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString()));
            }
            else
            {
                var tran = DBVisitor.Connection.BeginTransaction();
                try
                {
                    if (InObject.YUYUEQRLX == "1")
                    {
                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00005, InObject.YUYUESQDBH.ToString(), 1), tran);
                    }
                    else if (InObject.YUYUEQRLX == "2")
                    {
                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00015, InObject.YUYUESQDBH.ToString(), 1), tran);
                    }
                    else if (InObject.YUYUEQRLX == "3")
                    {
                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.FSD00016, InObject.YUYUESQDBH.ToString(), 1), tran);
                    }
                    else
                    {
                        OutObject.OUTMSG.ERRNO  = "-2";
                        OutObject.OUTMSG.ERRMSG = string.Format("找不到预约信息:申请单编号[{0}]", InObject.YUYUESQDBH.ToString());
                        return;
                    }

                    tran.Commit();
                    OutObject         = new SHEBEIYYQR_OUT();
                    OutObject.YUYUEH  = listyyxx.Items["YYH"].ToString();
                    OutObject.YUYUERQ = listyyxx.Items["JCRQ"].ToString();
                    OutObject.YUYUESJ = listyyxx.Items["JCSJ"].ToString();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                    throw ex;
                }
            }
        }
Пример #7
0
        public override void ProcessMessage()
        {
            //就诊卡类型
            if (string.IsNullOrEmpty(InObject.JIUZHENKLX))
            {
                throw new Exception(string.Format("入参[JIUZHENKLX]为空"));
            }
            //就诊卡号
            if (string.IsNullOrEmpty(InObject.JIUZHENKH))
            {
                throw new Exception(string.Format("入参[JIUZHENKH]为空"));
            }

            //姓名
            if (string.IsNullOrEmpty(InObject.XINGMING))
            {
                throw new Exception(string.Format("入参[XINGMING]为空"));
            }
            //联系电话
            if (string.IsNullOrEmpty(InObject.LIANXIDH))
            {
                throw new Exception(string.Format("入参[LIANXIDH]为空"));
            }
            //证件类型
            // if (string.IsNullOrEmpty(InObject.ZHENGJIANLX)) throw new Exception(string.Format("入参[ZHENGJIANLX]为空"));
            //证件号码
            if (string.IsNullOrEmpty(InObject.ZHENGJIANHM))
            {
                throw new Exception(string.Format("入参[ZHENGJIANHM]为空"));
            }
            //支付宝协议号
            if (string.IsNullOrEmpty(InObject.ZHIFUBXYH))
            {
                throw new Exception(string.Format("入参[ZHIFUBXYH]为空"));
            }
            //支付宝UserId
            if (string.IsNullOrEmpty(InObject.ZHIFUBYHH))
            {
                throw new Exception(string.Format("入参[ZHIFUBYHH]为空"));
            }
            //操作日期
            if (string.IsNullOrEmpty(InObject.CAOZUORQ))
            {
                throw new Exception(string.Format("入参[CAOZUORQ]为空"));
            }
            //操作类型
            if (string.IsNullOrEmpty(InObject.CAOZUOLX))
            {
                throw new Exception(string.Format("入参[CAOZUOLX]为空"));
            }
            if (string.IsNullOrEmpty(InObject.JIUZHENKLX))
            {
                //  2	社保卡
                throw new Exception(string.Format("入参[JIUZHENKLX]为空"));
            }
            if (InObject.JIUZHENKLX != "2" && InObject.JIUZHENKLX != "3")
            {
                throw new Exception(string.Format("就诊卡类型不正确"));
            }
            if (string.IsNullOrEmpty(InObject.BASEINFO.FENYUANDM))
            {
                throw new Exception(string.Format("医院代码不能为空"));
            }
            var FyInfo = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.HIS00022, InObject.BASEINFO.FENYUANDM));

            if (FyInfo == null)
            {
                throw new Exception(string.Format("查询不到医院代码为【{0}】的医院信息", InObject.BASEINFO.FENYUANDM));
            }
            InObject.JIUZHENKH = System.Convert.ToString(InObject.JIUZHENKH.ToUpper()).PadLeft(10, '0');
            //判断是否存在传入身份证号的病人信息
            string fydmwhere = "";

            if (InObject.JIUZHENKLX != "2") //2 社保卡 3就诊卡
            {                               //如果是就诊卡 则增加医院条件
                fydmwhere = string.Format(" and  FENYUANDM='{0}'", InObject.BASEINFO.FENYUANDM);
            }
            var existInfo = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.HIS00004, InObject.ZHENGJIANHM.ToLower(), InObject.JIUZHENKH, InObject.JIUZHENKLX, fydmwhere));

            var tran = DBVisitor.Connection.BeginTransaction();

            try
            {
                switch (InObject.CAOZUOLX)
                {
                case "1":
                    if (existInfo != null)
                    {
                        if (InObject.JIUZHENKLX == "3")
                        {    //就诊卡
                            DBVisitor.ExecuteNonQuery(string.Format("Update Gy_BangDingGx Set ShenFenZh='{0}'," +
                                                                    "BingRenXm='{1}',XieYiHm='{2}',BinRenSb='{3}',ZuoFeiPb = 0," +
                                                                    "LianXiDh='{4}',BangDingRq=To_Date('{5}','yyyy-mm-dd hh24:mi:ss'),CaoZuoRq=Sysdate,CaoZuoGh='{6}'," +
                                                                    "BeiZhuXx='{7}',PARTNER='{9}',SELLEREMAIL='{10}',JIUZHENKLX='{12}' where ShenFenZh='{8}' and JIUZHENKH='{11}'" +
                                                                    " and FENYUANDM='{13}' and  JIUZHENKLX='{12}'",
                                                                    InObject.ZHENGJIANHM.ToLower(),
                                                                    InObject.XINGMING,
                                                                    InObject.ZHIFUBXYH,
                                                                    InObject.ZHIFUBYHH,
                                                                    InObject.LIANXIDH,
                                                                    InObject.CAOZUORQ,
                                                                    InObject.BASEINFO.CAOZUOYDM,
                                                                    InObject.BEIZHUXX,
                                                                    InObject.ZHENGJIANHM.ToLower(),
                                                                    InObject.PARTNER,
                                                                    InObject.SELLEREMAIL,
                                                                    InObject.JIUZHENKH,
                                                                    InObject.JIUZHENKLX,
                                                                    InObject.BASEINFO.FENYUANDM
                                                                    ), tran);
                        }
                        else
                        {
                            //社保卡 不需要保存/判断医院代码
                            DBVisitor.ExecuteNonQuery(string.Format("Update Gy_BangDingGx Set ShenFenZh='{0}'," +
                                                                    "BingRenXm='{1}',XieYiHm='{2}',BinRenSb='{3}',ZuoFeiPb = 0," +
                                                                    "LianXiDh='{4}',BangDingRq=To_Date('{5}','yyyy-mm-dd hh24:mi:ss'),CaoZuoRq=Sysdate,CaoZuoGh='{6}'," +
                                                                    "BeiZhuXx='{7}',PARTNER='{9}',SELLEREMAIL='{10}',JIUZHENKLX='{12}' where ShenFenZh='{8}' and JIUZHENKH='{11}' " +
                                                                    "and  JIUZHENKLX='{12}'",
                                                                    InObject.ZHENGJIANHM.ToLower(),
                                                                    InObject.XINGMING,
                                                                    InObject.ZHIFUBXYH,
                                                                    InObject.ZHIFUBYHH,
                                                                    InObject.LIANXIDH,
                                                                    InObject.CAOZUORQ,
                                                                    InObject.BASEINFO.CAOZUOYDM,
                                                                    InObject.BEIZHUXX,
                                                                    InObject.ZHENGJIANHM.ToLower(),
                                                                    InObject.PARTNER,
                                                                    InObject.SELLEREMAIL,
                                                                    InObject.JIUZHENKH,
                                                                    InObject.JIUZHENKLX
                                                                    ), tran);
                        }
                    }
                    else
                    {
                        DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.HIS00003, InObject.JIUZHENKH, InObject.ZHENGJIANHM.ToLower(), InObject.XINGMING, InObject.ZHIFUBXYH,
                                                                    InObject.ZHIFUBYHH, InObject.LIANXIDH, InObject.CAOZUORQ, InObject.BASEINFO.CAOZUOYDM,
                                                                    InObject.BEIZHUXX, InObject.PARTNER, InObject.SELLEREMAIL,
                                                                    InObject.JIUZHENKLX, InObject.BASEINFO.FENYUANDM), tran);
                    }

                    break;

                case "2":
                    if (existInfo == null)
                    {
                        throw new Exception(string.Format("查询不到就身份证号为[{0}]的绑定信息!", InObject.ZHENGJIANHM.ToLower()));
                    }
                    if (InObject.XINGMING.ToString() != existInfo.Items["BINGRENXM"].ToString())
                    {
                        throw new Exception(string.Format("传入病人姓名[{0}]与绑定账户姓名[{1}]不符", InObject.XINGMING, existInfo.Items["BINGRENXM"]));
                    }

                    //解绑更新作废判别
                    string dynamicSql = string.Format("Update Gy_BangDingGx Set ZuoFeiPb = 1,JieBangRq = To_Date('{2}','yyyy-mm-dd hh24:mi:ss') Where ShenFenZh = '{0}' And XieYiHm = '{1}' And ZuoFeiPb = 0 and JIUZHENKH='{3}' and FENYUANDM='{4}'", InObject.ZHENGJIANHM.ToLower(), InObject.ZHIFUBXYH, InObject.CAOZUORQ, InObject.JIUZHENKH, InObject.BASEINFO.FENYUANDM);
                    DBVisitor.ExecuteNonQuery(dynamicSql, tran);
                    break;

                default:
                    tran.Rollback();
                    throw new Exception("传入未定义的操作类型:" + InObject.CAOZUOLX);
                }
                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.ToString());
            }
        }
Пример #8
0
        public override void ProcessMessage()
        {
            string  jiuZhenKH    = InObject.JIUZHENKH;                     //就诊卡号
            string  bingAnHao    = InObject.BINGANHAO;                     //病案号
            string  caoZuoGH     = InObject.BASEINFO.CAOZUOYDM;            //操作员工号
            string  jiaoYiSJ     = InObject.BASEINFO.CAOZUORQ;             //交易时间
            string  jiaoYiFS     = InObject.JIAOYIFS;                      //交易方式
            string  jiaoYiLX     = InObject.JIAOYILX;                      //交易类型
            string  shangHuH     = InObject.SHANGHUH;                      //商户号
            string  zhongDuanH   = InObject.ZHONGDUANH;                    //终端号
            string  yinHangKH    = InObject.YINHANGKH;                     //银行卡号
            string  jiaoYiPCH    = InObject.JIAOYIPCH;                     //交易批次号
            string  jiaoYiLSH    = InObject.JIAOYILSH;                     //交易流水号
            string  jiaoYiCKH    = InObject.JIAOYICKH;                     //交易参考号
            string  dingDanH     = InObject.DINGDANH;                      //订单号
            string  jiaoYiJE     = InObject.JIAOYIJE;                      //交易金额
            decimal zhiBi100     = Convert.ToDecimal(InObject.ZHIBIZS100); //100元纸币张数
            decimal zhiBi50      = Convert.ToDecimal(InObject.ZHIBIZS50);  //50元纸币张数
            decimal zhiBi20      = Convert.ToDecimal(InObject.ZHIBIZS20);  //20元纸币张数
            decimal zhiBi10      = Convert.ToDecimal(InObject.ZHIBIZS10);  //10元纸币张数
            decimal zhiBi5       = Convert.ToDecimal(InObject.ZHIBIZS5);   //5元纸币张数
            decimal zhiBi1       = Convert.ToDecimal(InObject.ZHIBIZS1);   //1元纸币张数
            string  jiaoYiZT     = InObject.JIAOYIZT;                      //交易状态
            string  GUANLIANJYID = InObject.GUANLIANJYID;                  //关联交易ID

            OutObject = new JINRONGJYRZ_OUT();

            #region 基础入参判断
            if (string.IsNullOrEmpty(jiaoYiZT))
            {
                jiaoYiZT = "1";
            }

            if (string.IsNullOrEmpty(jiuZhenKH) && string.IsNullOrEmpty(bingAnHao))
            {
                throw new Exception("就诊卡号和病案号不能同时为空!");
            }

            if (string.IsNullOrEmpty(caoZuoGH))
            {
                throw new Exception("操作工号不能为空!");
            }

            if (string.IsNullOrEmpty(jiaoYiSJ))
            {
                throw new Exception("交易时间不能为空!");
            }

            if (string.IsNullOrEmpty(jiaoYiFS))
            {
                throw new Exception("交易方式不能为空!");
            }

            if (string.IsNullOrEmpty(jiaoYiLX))
            {
                throw new Exception("交易类型不能为空!");
            }
            else if (true)
            {//交易类型和法值判断
            }

            if (string.IsNullOrEmpty(jiaoYiJE))
            {
                throw new Exception("交易金额不能为空!");
            }


            switch (jiaoYiLX)
            {
            case "1":    //现金

                if (zhiBi100 == 0 && zhiBi50 == 0 && zhiBi20 == 0 && zhiBi10 == 0 && zhiBi5 == 0 && zhiBi1 == 0)
                {
                    throw new Exception("投币数量不能为0!");
                }
                break;

            case "10":
            case "4":    //银行卡
                if (string.IsNullOrEmpty(yinHangKH))
                {
                    throw new Exception("银行卡号不能为空!");
                }
                if (string.IsNullOrEmpty(jiaoYiLSH))
                {
                    throw new Exception("交易流水号不能为空!");
                }
                if (string.IsNullOrEmpty(jiaoYiCKH))
                {
                    throw new Exception("交易参考号不能为空!");
                }
                break;

            case "23":    //智慧医疗

                if (string.IsNullOrEmpty(jiaoYiLSH))
                {
                    throw new Exception("交易流水号不能为空!");
                }
                if (string.IsNullOrEmpty(jiaoYiCKH))
                {
                    throw new Exception("交易参考号不能为空!");
                }
                break;

            case "16":    //支付宝

                if (string.IsNullOrEmpty(shangHuH))
                {
                    throw new Exception("商户号不能为空!");
                }
                if (string.IsNullOrEmpty(dingDanH))
                {
                    throw new Exception("订单号不能为空!");
                }
                break;

            case "17":    //微信

                if (string.IsNullOrEmpty(shangHuH))
                {
                    throw new Exception("商户号不能为空!");
                }
                if (string.IsNullOrEmpty(dingDanH))
                {
                    throw new Exception("订单号不能为空!");
                }
                break;
            }
            #endregion


            #region sql语句准备,数据初始  sqi-291
            string jieSuanID = "";//结算id 取序列
            var    maxid     = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.HIS00023, " seq_gy_jinrongjy_zzj.nextval "));
            if (maxid == null)
            {
                throw new Exception(string.Format("结算ID获取失败!"));
            }
            else
            {
                jieSuanID = maxid.Items["MAXID"].ToString();
            }

            if (string.IsNullOrEmpty(GUANLIANJYID))
            {
                /* SQI-HIS00291 插入金融交易日志
                 * jiaoyiid,jiuzhenkh,jiaoyisj,caozuoygh,jiaoyilx,
                 * jiaoyifs,shanghuh,zhongduanh,yinhangkh,jiaoyipch,
                 * jiaoyilsh,jiaoyickh,dingdanh,jiaoyije,zhibizs100,
                 * zhibizs50,zhibizs20,zhibizs10,zhibizs5,zhibizs1,
                 * bingAnHao,jiaoYiZT
                 */
                DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.HIS00024,
                                                            jieSuanID, jiuZhenKH, jiaoYiSJ, caoZuoGH, jiaoYiLX,
                                                            jiaoYiFS, shangHuH, zhongDuanH, yinHangKH, jiaoYiPCH,
                                                            jiaoYiLSH, jiaoYiCKH, dingDanH, jiaoYiJE, zhiBi100,
                                                            zhiBi50, zhiBi20, zhiBi10, zhiBi5, zhiBi1,
                                                            bingAnHao, jiaoYiZT));
            }
            else
            {
                /* SQI-HIS00291 插入金融交易日志 有关联记录
                 * jiaoyiid,jiuzhenkh,jiaoyisj,caozuoygh,jiaoyilx,
                 * jiaoyifs,shanghuh,zhongduanh,yinhangkh,jiaoyipch,
                 * jiaoyilsh,jiaoyickh,dingdanh,jiaoyije,zhibizs100,
                 * zhibizs50,zhibizs20,zhibizs10,zhibizs5,zhibizs1,
                 * bingAnHao,jiaoYiZT,guanlianjyid
                 */
                DBVisitor.ExecuteNonQuery(SqlLoad.GetFormat(SQ.HIS00025,
                                                            jieSuanID, jiuZhenKH, jiaoYiSJ, caoZuoGH, jiaoYiLX,
                                                            jiaoYiFS, shangHuH, zhongDuanH, yinHangKH, jiaoYiPCH,
                                                            jiaoYiLSH, jiaoYiCKH, dingDanH, jiaoYiJE, zhiBi100,
                                                            zhiBi50, zhiBi20, zhiBi10, zhiBi5, zhiBi1,
                                                            bingAnHao, jiaoYiZT, GUANLIANJYID));
            }
            #endregion

            OutObject.JIAOYIID = jieSuanID;
        }
Пример #9
0
        public static void send()
        {
            //是否启用定时发送
            var csxx = DBVisitor.ExecuteModel(SqlLoad.GetFormat(SQ.AUTO00013, " and csmc = 'SZXX_DSFS' "));

            if (csxx == null)
            {
                return;
            }
            else
            {
                if (csxx.Items["CSZ2"] != "1")
                {
                    return;
                }
            }

            #region 发送审核数据
            sendSHSJ();
            #endregion

            #region 发送待入院数据
            sendDRYSJ();
            #endregion

            #region 发送入院数据
            sendRYSJ();
            #endregion

            #region 发送离院数据
            sendLYSJ();
            #endregion

            #region 发送查房通知数据
            sendCFTZ();
            #endregion

            #region 发送审核未不通数据
            sendSHBTG();
            #endregion

            #region 发送下转申请数据
            sendXZSQSJ();
            #endregion

            #region 发送检查项目分类
            sendJCFL();
            #endregion

            #region 发送检查项目
            sendJCXM();
            #endregion

            #region 发送检查方向
            sendJCFX();
            #endregion

            #region 发送检查部位
            sendJCBW();
            #endregion
        }