Пример #1
0
        /// <summary>
        /// 调用费用退费分解接口
        /// </summary>
        /// <param name="sDll"></param>
        /// <returns></returns>
        public ResultClass RefundmentDivide(SiInterfaceDll sDll, string tradeNo)
        {
            string sMome = "";
            bool   bRet  = false;
            string sOut;

            sDll.RefundmentDivide(tradeNo, out sOut);

            XmlDocument xmlDoc = GetXmlDoc(sOut);

            CheckOutputState(xmlDoc, out bRet, out sMome);
            if (bRet)
            {
                string  sTradeNO, sIC_NO;
                XmlNode dataNode = GetNodeFromPath(xmlDoc.DocumentElement, "output/tradeinfo");
                sTradeNO = dataNode.SelectNodes("tradeno")[0].InnerText;
            }

            DivideResult.root divideResult = (DivideResult.root)(XmlUtil.DeserializeFromXml(sOut, typeof(DivideResult.root)));
            xmlDoc = null;
            ResultClass resultClassTemp = new ResultClass();

            resultClassTemp.bSucess  = bRet;
            resultClassTemp.sRemarks = sMome;
            resultClassTemp.oResult  = divideResult;
            return(resultClassTemp);
        }
Пример #2
0
        public override ResultClass MZ_CancelRegister(InputClass inputClass)
        {
            ResultClass resultClass = new ResultClass();
            int         registerId  = inputClass.SInput.ContainsKey(InputType.RegisterId) ? Tools.ToInt32(inputClass.SInput[InputType.RegisterId].ToString(), -1) : -1;
            string      serialNO    = inputClass.SInput.ContainsKey(InputType.SerialNO) ? inputClass.SInput[InputType.SerialNO].ToString() : "";

            try
            {
                MI_Register register = hisDao.Mz_Getregister(registerId, serialNO);
                if (register == null)
                {
                    resultClass.bSucess  = false;
                    resultClass.sRemarks = "获取登记信息失败!";
                    AddLog("获取HIS登记信息失败!", Color.Red);
                }
                else
                {
                    bool b = hisDao.Mz_JudgeRegister(register.ID);
                    if (b)
                    {
                        //取消医保登记并返回结果
                        resultClass = ybInterfaceDao.Mz_CancelRegister(sDll, register.SocialCreateNum);
                        DivideResult.root root = (DivideResult.root)resultClass.oResult;
                        //解析返回数据,并保存退费记录
                        MI_MedicalInsurancePayRecord medicalInsurancePayRecord = ResultToPayRecord(root.output);
                        MI_MIPayRecordHead           mIPayRecordHead           = ResultToPayRecordHead(root.output);
                        List <MI_MIPayRecordDetail>  mIPayRecordDetailList     = ResultToPayRecordDetail(root.output);
                        register.ValidFlag = 2;
                        medicalInsurancePayRecord.state     = 2;
                        medicalInsurancePayRecord.RegId     = register.ID;
                        medicalInsurancePayRecord.TradeType = 1;

                        InputClass input = new InputClass();
                        Dictionary <InputType, object> dicStr = new Dictionary <InputType, object>();
                        dicStr.Add(InputType.MI_Register, JsonHelper.SerializeObject(register));
                        dicStr.Add(InputType.MI_MedicalInsurancePayRecord, JsonHelper.SerializeObject(medicalInsurancePayRecord));
                        dicStr.Add(InputType.MI_MIPayRecordHead, JsonHelper.SerializeObject(mIPayRecordHead));
                        dicStr.Add(InputType.MI_MIPayRecordDetailList, JsonHelper.SerializeObject(mIPayRecordDetailList));
                        input.SInput = dicStr;
                        resultClass  = hisDao.Mz_CancelRegister(input);
                    }
                    else
                    {
                        resultClass.bSucess  = false;
                        resultClass.sRemarks = "存在已结算的收费数据!";
                        AddLog("HIS存在已结算的收费数据!", Color.Red);
                    }
                }
            }
            catch (Exception e)
            {
                resultClass.bSucess  = false;
                resultClass.sRemarks = e.Message;
                AddLog("取消登记报错:" + e.Message, Color.Red);
            }
            return(resultClass);
        }
Пример #3
0
        public override ResultClass MZ_CancelCharge(InputClass inputClass)
        {
            ResultClass resultClass = new ResultClass();

            try
            {
                string fph = inputClass.SInput.ContainsKey(InputType.InvoiceNo) ? inputClass.SInput[InputType.InvoiceNo].ToString() : "";
                MI_MedicalInsurancePayRecord medicalInsurancePayRecordOld = hisDao.Mz_GetPayRecord(2, fph, 2, 1);

                if (medicalInsurancePayRecordOld == null)
                {
                    resultClass.bSucess  = false;
                    resultClass.sRemarks = "获取收费信息失败!";
                    AddLog("获取收费信息失败!", Color.Red);
                }
                else
                {
                    //取消医保结算并返回结果
                    resultClass = ybInterfaceDao.MZ_CancelCharge(sDll, medicalInsurancePayRecordOld.TradeNO);
                    AddLog("取消结算完成,开始解析", Color.Blue);
                    DivideResult.root            root = (DivideResult.root)resultClass.oResult;
                    MI_MedicalInsurancePayRecord medicalInsurancePayRecord = ResultToPayRecord(root.output);
                    medicalInsurancePayRecord.RegId     = medicalInsurancePayRecordOld.RegId;
                    medicalInsurancePayRecord.FeeNO     = medicalInsurancePayRecordOld.FeeNO;
                    medicalInsurancePayRecord.state     = 2;
                    medicalInsurancePayRecord.TradeType = 2;
                    MI_MIPayRecordHead          mIPayRecordHead       = ResultToPayRecordHead(root.output);
                    List <MI_MIPayRecordDetail> mIPayRecordDetailList = ResultToPayRecordDetail(root.output);
                    //更新交易表
                    medicalInsurancePayRecordOld.state = 3;


                    List <MI_MedicalInsurancePayRecord> medicalInsurancePayRecordList = new List <MI_MedicalInsurancePayRecord>();
                    medicalInsurancePayRecordList.Add(medicalInsurancePayRecordOld);
                    medicalInsurancePayRecordList.Add(medicalInsurancePayRecord);

                    InputClass input = new InputClass();
                    Dictionary <InputType, object> dicStr = new Dictionary <InputType, object>();
                    dicStr.Add(InputType.MI_MedicalInsurancePayRecordList, JsonHelper.SerializeObject(medicalInsurancePayRecordList));
                    dicStr.Add(InputType.MI_MIPayRecordHead, JsonHelper.SerializeObject(mIPayRecordHead));
                    dicStr.Add(InputType.MI_MIPayRecordDetailList, JsonHelper.SerializeObject(mIPayRecordDetailList));
                    input.SInput = dicStr;
                    AddLog("取消结算完成,解析完成,保存HIS开始", Color.Blue);
                    resultClass = hisDao.MZ_CancelCharge(input);
                }
            }
            catch (Exception e)
            {
                resultClass.bSucess  = false;
                resultClass.sRemarks = e.Message;
                AddLog("取消结算失败!错误信息:" + e.Message, Color.Red);
            }
            return(resultClass);
        }
Пример #4
0
        /// <summary>
        /// 分解费用
        /// </summary>
        /// <param name="sDll"></param>
        /// <returns></returns>
        public ResultClass Divide(SiInterfaceDll sDll, Reg.root root)
        {
            string sMome = "";
            bool   bRet  = false;
            string sOut;
            string sIn = XmlUtil.SerializeToXml(root, typeof(Reg.root));

            sDll.Divide(sIn, out sOut);

            AddLog("分解输出数据:");
            AddLog(sOut);
            DivideResult.root divideResult = (DivideResult.root)(XmlUtil.DeserializeFromXml(sOut, typeof(DivideResult.root)));
            XmlDocument       xmlDoc       = GetXmlDoc(sOut);

            CheckOutputState(xmlDoc, out bRet, out sMome);

            ResultClass resultClassTemp = new ResultClass();

            resultClassTemp.bSucess  = bRet;
            resultClassTemp.sRemarks = sMome;

            resultClassTemp.oResult = divideResult;
            return(resultClassTemp);
        }
Пример #5
0
        public override ResultClass MZ_PreviewRegister(InputClass inputClass)
        {
            InputClass input = new InputClass();

            ResultClass resultClass = new ResultClass();
            MI_Register register    = JsonHelper.DeserializeJsonToObject <MI_Register>(inputClass.SInput[InputType.MI_Register].ToString());

            try
            {
                resultClass = ybInterfaceDao.MZ_PreviewRegister(sDll, PreviewRegisterToInput(register));
            }
            catch (Exception e)
            {
                resultClass.bSucess  = false;
                resultClass.sRemarks = "医保预登记报错:" + e.Message;
                AddLog("医保预登记报错:" + e.Message, Color.Red);
                return(resultClass);
            }

            if (resultClass.bSucess)
            {
                try
                {
                    AddLog("医保预登记完成,开始解析医保登记数据", Color.Blue);
                    DivideResult.root            root = (DivideResult.root)resultClass.oResult;
                    MI_MedicalInsurancePayRecord medicalInsurancePayRecord = ResultToPayRecord(root.output);
                    MI_MIPayRecordHead           mIPayRecordHead           = ResultToPayRecordHead(root.output);
                    List <MI_MIPayRecordDetail>  mIPayRecordDetailList     = ResultToPayRecordDetail(root.output);

                    Dictionary <InputType, object> dicStr = new Dictionary <InputType, object>();
                    dicStr.Add(InputType.MI_Register, JsonHelper.SerializeObject(register));
                    dicStr.Add(InputType.MI_MedicalInsurancePayRecord, JsonHelper.SerializeObject(medicalInsurancePayRecord));
                    dicStr.Add(InputType.MI_MIPayRecordHead, JsonHelper.SerializeObject(mIPayRecordHead));
                    dicStr.Add(InputType.MI_MIPayRecordDetailList, JsonHelper.SerializeObject(mIPayRecordDetailList));
                    input.SInput = dicStr;
                    AddLog("解析医保预登记数据完成,开始保存数据到HIS数据库", Color.Blue);
                }
                catch (Exception e)
                {
                    resultClass.bSucess  = false;
                    resultClass.sRemarks = "解析预登记数据报错:" + e.Message;
                    AddLog("解析预登记数据报错:" + e.Message, Color.Red);
                    return(resultClass);
                }

                try
                {
                    if (hisDao != null)
                    {
                        resultClass = hisDao.MZ_PreviewRegister(input);
                    }
                    else
                    {
                        resultClass.bSucess  = false;
                        resultClass.sRemarks = "hisDao为空";
                        AddLog("hisDao为空", Color.Red);
                    }
                }
                catch (Exception e)
                {
                    resultClass.bSucess  = false;
                    resultClass.sRemarks = "插入预登记数据报错:" + e.Message;
                    AddLog("插入预登记数据报错:" + e.Message, Color.Red);
                    return(resultClass);
                }
                return(resultClass);
            }
            else
            {
                return(resultClass);
            }
        }
Пример #6
0
        public override ResultClass MZ_PreviewCharge(InputClass inputClass)
        {
            ResultClass resultClass = new ResultClass();
            TradeData   tradedata   = inputClass.SInput.ContainsKey(InputType.TradeData) ?JsonHelper.DeserializeJsonToObject <TradeData>(inputClass.SInput[InputType.TradeData].ToString()) : null;

            MI_Register register = hisDao.Mz_Getregister(-1, tradedata.SerialNo);

            try
            {
                if (register == null)
                {
                    resultClass.bSucess  = false;
                    resultClass.sRemarks = "医院编号:" + tradedata.WorkID + ",门诊就诊号:" + tradedata.SerialNo + ",未进行医保统筹登记";
                    //MiddlewareLogHelper.WriterLog(LogType.MILog, true, Color.Red, "医院编号:" + tradedata.WorkID + ",门诊就诊号:" + tradedata.SerialNo + ",未进行医保统筹登记");
                    AddLog("医院编号:" + tradedata.WorkID + ",门诊就诊号:" + tradedata.SerialNo + ",未进行医保统筹登记", Color.Red);
                }
                else
                {
                    if (register.ValidFlag != 1)
                    {
                        resultClass.bSucess  = false;
                        resultClass.sRemarks = "医院编号:" + tradedata.WorkID + ",门诊就诊号:" + tradedata.SerialNo + ",医保统筹登记已取消";
                        //MiddlewareLogHelper.WriterLog(LogType.MILog, true, Color.Red, "医院编号:" + tradedata.WorkID + ",门诊就诊号:" + tradedata.SerialNo + ",医保统筹登记已取消");
                        AddLog("医院编号:" + tradedata.WorkID + ",门诊就诊号:" + tradedata.SerialNo + ",医保统筹登记已取消", Color.Red);
                    }
                    else
                    {
                        tradedata.SocityCreateNum = register.SocialCreateNum;
                        //医保登记并返回结果
                        AddLog("医保预算并返回结果开始", Color.Blue);
                        resultClass = ybInterfaceDao.MZ_PreviewCharge(sDll, TradeDataToInput(tradedata));
                    }
                }
            }
            catch (Exception e)
            {
                resultClass.bSucess  = false;
                resultClass.sRemarks = e.Message;
                AddLog("医保预算报错:", Color.Red);
            }

            try
            {
                AddLog("医保预算并返回结果成功,开始解析", Color.Blue);
                DivideResult.root root = (DivideResult.root)resultClass.oResult;
                //解析返回结果到类,保存
                MI_MedicalInsurancePayRecord medicalInsurancePayRecord = ResultToPayRecord(root.output);
                medicalInsurancePayRecord.state     = 0;
                medicalInsurancePayRecord.RegId     = register.ID;
                medicalInsurancePayRecord.TradeType = 2;
                MI_MIPayRecordHead          mIPayRecordHead       = ResultToPayRecordHead(root.output);
                List <MI_MIPayRecordDetail> mIPayRecordDetailList = ResultToPayRecordDetail(root.output);
                AddLog("医保预算解析完成,开始保存", Color.Blue);

                InputClass input = new InputClass();
                Dictionary <InputType, object> dicStr = new Dictionary <InputType, object>();
                dicStr.Add(InputType.MI_MedicalInsurancePayRecord, JsonHelper.SerializeObject(medicalInsurancePayRecord));
                dicStr.Add(InputType.MI_MIPayRecordHead, JsonHelper.SerializeObject(mIPayRecordHead));
                dicStr.Add(InputType.MI_MIPayRecordDetailList, JsonHelper.SerializeObject(mIPayRecordDetailList));
                input.SInput = dicStr;
                resultClass  = hisDao.MZ_PreviewCharge(input);
            }
            catch (Exception e)
            {
                resultClass.bSucess  = false;
                resultClass.sRemarks = "HIS插入医保预算数据报错" + e.Message;
                AddLog("HIS插入医保预算数据报错", Color.Red);
            }
            return(resultClass);
        }