Exemplo n.º 1
0
        /// <summary>
        /// 挂号试算
        /// </summary>
        /// <param name="transType"></param>
        /// <param name="transVersion"></param>
        /// <param name="verifyCode"></param>
        /// <param name="serNum"></param>
        /// <param name="transBody"></param>
        /// <returns></returns>
        public static T RegTrial <T>(string transType, string transVersion, string verifyCode, string serNum, object transBody)
        {
            var           serialNumber  = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + serNum;
            HealthMessage healthMessage = new HealthMessage()
            {
                transTime          = DateTime.Now.ToString("yyyyMMddHHmmss:fff"),
                transType          = transType,
                transReturnCode    = "",
                transReturnMessage = "",
                transVersion       = transVersion,
                serialNumber       = serialNumber,
                cardArea           = "440300",
                hospitalCode       = "HZS10",
                operatorCode       = "jeff",
                operatorName       = "松下乘凉",
                operatorPass       = "******",
                transBody          = transBody,
                transChannel       = "10",
                verifyCode         = verifyCode,
                extendDeviceId     = "",
                extendUserId       = "",
                extendSerialNumber = ""
            };

            var obj = PostData(JsonOperator.JsonSerialize(healthMessage));


            return(JsonOperator.JsonDeserialize <T>(obj));
        }
        public string TradingRefund(request <Entity.SRequest.JY002> tradingrefund)
        {
            var ybsssno = commKeyBLL.GetYBNO();
            var ybSno   = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + ybsssno;

            var getVerifyCodeResult = JsonOperator.JsonDeserialize <Entity.SResponse.getVerifyCode>(HttpHelper.Post("http://192.168.88.134:8300/YBDLL/domain/getVerifyCode", JsonOperator.JsonSerialize(new getVerifyCode()
            {
                inParam = "JY002|" + ybSno + "|HZS10|"
            }), Encoding.UTF8, 1));

            if (getVerifyCodeResult.resultCode != 0)
            {
                return(null);
            }

            var version = getVerifyCodeResult.outParam.Split("|")[2];
            var verify  = getVerifyCodeResult.outParam.Split("|")[0] + "|" + getVerifyCodeResult.outParam.Split("|")[1];

            Entity.SRequest.JY002 jY002 = new JY002()
            {
                akc190 = tradingrefund.model.akc190,
                bke384 = tradingrefund.model.bke384
            };

            var result = HealthInsuranceHelper.RegTrial <BaseMedInsurance <Entity.SResponse.JY002> >("JY002", version, verify, ybsssno.ToString(), jY002);

            if (result.transReturnCode == "0" || result.transReturnCode == "00000000")
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.JY002>()
                {
                    model = new Entity.SResponse.JY002()
                    {
                        resultCode = 0,
                        resultMessage = JsonOperator.JsonSerialize(result)
                    }
                }));
            }
            else
            {
                return(RsXmlHelper.ResXml(-1, JsonOperator.JsonSerialize(result)));
            }
        }
Exemplo n.º 3
0
        public string SettleMZInsurance(request <settleMZInsurance> settleMZInsurance)
        {
            if (settleMZInsurance == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var ptInfo = ptInfoBLL.GetPtInfoByCardNo("", Convert.ToInt32(settleMZInsurance.model.patCardType), settleMZInsurance.model.patCardNo);

            if (ptInfo == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var dept   = sysDeptBLL.GetDeptByCode(settleMZInsurance.model.deptCode);
            var doctor = sysUserinfoBLL.GetRDoctor(settleMZInsurance.model.doctorCode);

            var pt_Info = ptInfoBLL.GetPtInfoByCardNo("", Convert.ToInt32(settleMZInsurance.model.patCardType), settleMZInsurance.model.patCardNo);

            if (pt_Info == null)
            {
                return(RsXmlHelper.ResXml(-1, "患者信息为空"));
            }

            var regInfo = reginfoBLL.GetReg_Info(Convert.ToInt32(settleMZInsurance.model.mzFeeId));

            var orderInfoList = orderInfoBLL.GetMZOrderInfo(settleMZInsurance.model.mzFeeId, settleMZInsurance.model.mzBillId);

            if (regInfo == null)
            {
                return(RsXmlHelper.ResXml(-1, "挂号信息为空"));
            }

            var ybsssno = commKeyBLL.GetYBNO();

            var FeeTrail = feeTrialBLL.Get(x => x.bke384 == settleMZInsurance.model.SSSerNo);

            if (FeeTrail == null && !string.IsNullOrWhiteSpace(FeeTrail.transBody))
            {
                //return RsXmlHelper.ResXml(0, JsonOperator.JsonSerialize(FeeTrail.transBody));
                return(XMLHelper.XmlSerialize(new response <FeeSettlement>()
                {
                    model = new FeeSettlement()
                    {
                        resultCode = 0,
                        resultMessage = FeeTrail.transBody,
                        akc190 = FeeTrail.akc190
                    }
                }));
            }
            FY005 fY005 = new FY005()
            {
                aaz500 = settleMZInsurance.model.socialSecurityNo,
                bzz269 = string.IsNullOrWhiteSpace(settleMZInsurance.model.patCardPwd) ? "000000" : settleMZInsurance.model.patCardPwd,
                akc190 = FeeTrail.akc190,
                aka130 = FeeTrail.aka130,
                bkc320 = FeeTrail.bkc320,
                ckc350 = FeeTrail.ckc350,
                aka030 = FeeTrail.aka030,
                akc264 = FeeTrail.akc264.ToString(),
                ckc601 = FeeTrail.ckc601,
                bke384 = FeeTrail.bke384
            };

            var ybSno = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + ybsssno;
            var getVerifyCodeResult = JsonOperator.JsonDeserialize <Entity.SResponse.getVerifyCode>(HttpHelper.Post("http://192.168.88.134:8300/YBDLL/domain/getVerifyCode", JsonOperator.JsonSerialize(new getVerifyCode()
            {
                inParam = "FY005|" + ybSno + "|HZS10|"
            }), Encoding.UTF8, 1));

            if (getVerifyCodeResult.resultCode != 0)
            {
                return(null);
            }

            var version = getVerifyCodeResult.outParam.Split("|")[2];
            var verify  = getVerifyCodeResult.outParam.Split("|")[0] + "|" + getVerifyCodeResult.outParam.Split("|")[1];
            var result  = HealthInsuranceHelper.RegTrial <BaseMedInsurance <Entity.SResponse.FY005> >("FY005", version, verify, ybsssno.ToString(), fY005);

            if (result.transReturnCode == "0" || result.transReturnCode == "00000000")
            {
                var resultObj = new Entity.SResponse.getMZInsurance()
                {
                    resultCode    = 0,
                    resultMessage = "",
                    mzFeeId       = regInfo.regid,
                    mzBillId      = string.Join(",", orderInfoList.Select(x => x.billid)),
                    SSFeeNo       = ybSno,
                    SSBillNumber  = null,
                    time          = DateTime.Now,
                    recipeCount   = orderInfoList.Count.ToString(),
                    deptCode      = dept.code,
                    doctorCode    = doctor.userno,
                    doctorName    = doctor.username,
                    payType       = "医保",
                    payAmount     = result.transBody.akb067.ToString(),
                    totalAmout    = orderInfoList.Sum(x => x.totprice).ToString(),
                    akc190        = fY005.akc190,
                    SSInfoNew     = JsonOperator.JsonSerialize(result.transBody)
                };
                return(XMLHelper.XmlSerialize(new response <FeeSettlement>()
                {
                    model = new FeeSettlement()
                    {
                        resultCode = 0,
                        resultMessage = JsonOperator.JsonSerialize(result.transBody),
                        akc190 = fY005.akc190
                    }
                }));
            }
            else
            {
                return(RsXmlHelper.ResXml(-1, result.transReturnMessage + "{" + JsonOperator.JsonSerialize(fY005) + "}"));
            }
        }
Exemplo n.º 4
0
        public string GetMZInsurance(request <getMZInsurance> getMZInsurance)
        {
            if (getMZInsurance == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var ptInfo = ptInfoBLL.GetPtInfoByCardNo("", Convert.ToInt32(getMZInsurance.model.patCardType), getMZInsurance.model.patCardNo);

            if (ptInfo == null)
            {
                return(RsXmlHelper.ResXml(-1, "患者信息为空"));
            }

            var dept   = sysDeptBLL.GetDeptByCode(getMZInsurance.model.deptCode);
            var doctor = sysUserinfoBLL.GetRDoctor(getMZInsurance.model.doctorCode);

            var regInfo = reginfoBLL.Get(x => x.regid == Convert.ToInt32(getMZInsurance.model.mzFeeId));

            if (regInfo == null)
            {
                return(RsXmlHelper.ResXml(-1, "挂号信息为空"));
            }

            var orderInfoList   = orderInfoBLL.Get(getMZInsurance.model.mzFeeId, getMZInsurance.model.mzBillId);
            var orderFeedetails = orderfeedetailBLL.GetOrder_Feedetails(orderInfoList.Select(x => x.billid).ToArray());

            var ybsssno = commKeyBLL.GetYBNO();
            var ybSno   = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + ybsssno;

            FY001 fY001 = new FY001()
            {
                akc190   = "HZS10" + regInfo.mzno,
                bke384   = ybSno,
                listsize = orderFeedetails.Count,
            };

            fY001.inputlist = new List <inputlistfy001>();
            foreach (var order_Feedetail in orderFeedetails)
            {
                if (order_Feedetail.itemtype == "中草药" || order_Feedetail.itemtype == "中成药" || order_Feedetail.itemtype == "西药")
                {
                    var commMed = commMedBLL.Get(x => x.itemid == order_Feedetail.itemid);
                    fY001.inputlist.Add(new inputlistfy001()
                    {
                        aae072 = order_Feedetail.billid.ToString(),
                        bkc369 = "1",
                        bkf500 = order_Feedetail.bdfeeid.ToString(),
                        ake001 = commMed.ybcode,
                        ake002 = commMed.itemname,
                        bkm017 = commMed.stdcode,
                        ake005 = commMed.itemid,
                        ake006 = commMed.itemname,
                        akc225 = order_Feedetail.prices.ToString(),
                        akc264 = order_Feedetail.totalprices.ToString(),
                        aka067 = commMed.bscunit,
                        aka070 = commYbCodeBLL.GetYbCodeByName("AKA070", commMed.dosage),
                        aka074 = commMed.spec,
                        akc226 = (Convert.ToInt32(order_Feedetail.total) * Convert.ToInt32(order_Feedetail.dppack)).ToString(),
                        akc271 = Convert.ToDateTime(order_Feedetail.addtime).ToString("yyyyMMdd"),
                        bkc320 = doctor.ybno
                    });
                }
                else
                {
                    var commFee   = new comm_fee();
                    var isPackage = commFeeBLL.IsPackage(x => x.itemid == order_Feedetail.itemid && x.costtype == "5");
                    if (isPackage)
                    {
                        commFee = commFeeBLL.Get(Convert.ToInt32(order_Feedetail.itemid));
                    }
                    else
                    {
                        commFee = commFeeBLL.Get(x => x.itemid == order_Feedetail.itemid && x.costtype == "5");
                    }
                    fY001.inputlist.Add(new inputlistfy001()
                    {
                        aae072 = order_Feedetail.billid.ToString(),
                        bkc369 = "1",
                        bkf500 = order_Feedetail.bdfeeid.ToString(),
                        ake001 = commFee.scode,
                        ake002 = commFee.itemname,
                        bkm017 = commFee.scode,
                        ake005 = commFee.itemid,
                        ake006 = commFee.itemname,
                        ala026 = "",
                        aka070 = "",
                        aka074 = order_Feedetail.spec,
                        akc225 = decimal.Round(Convert.ToDecimal(order_Feedetail.prices), 2).ToString(),
                        akc226 = Convert.ToInt32(order_Feedetail.total).ToString(),
                        akc264 = decimal.Round(Convert.ToDecimal(order_Feedetail.totalprices), 2).ToString(),
                        aka067 = order_Feedetail.dpunit,
                        akc271 = Convert.ToDateTime(order_Feedetail.addtime).ToString("yyyyMMdd"),
                        bkc320 = doctor.ybno,
                        cke400 = ""
                    });
                }
            }

            FY004 fY004 = new FY004()
            {
                akc190 = "HZS10" + regInfo.mzno,
                aka130 = "11",
                bkc320 = doctor.ybno,
                ckc350 = doctor.username,
                aka030 = "12",
                akc264 = Math.Round(Convert.ToDecimal(orderInfoList.Sum(x => x.totprice)), 2).ToString(),
                ckc601 = "0",
                bke384 = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + ybsssno
            };

            var getVerifyCodeResult = JsonOperator.JsonDeserialize <Entity.SResponse.getVerifyCode>(HttpHelper.Post("http://192.168.88.134:8300/YBDLL/domain/getVerifyCode", JsonOperator.JsonSerialize(new getVerifyCode()
            {
                inParam = "FY001|" + ybSno + "|HZS10|"
            }), Encoding.UTF8, 1));

            if (getVerifyCodeResult.resultCode != 0 || getVerifyCodeResult.resultCode != 00000000)
            {
                return(RsXmlHelper.ResXml(-1, getVerifyCodeResult.resultMsg));
            }

            var version = getVerifyCodeResult.outParam.Split("|")[2];
            var verify  = getVerifyCodeResult.outParam.Split("|")[0] + "|" + getVerifyCodeResult.outParam.Split("|")[1];

            var resultFy001 = HealthInsuranceHelper.RegTrial <BaseMedInsurance <Entity.SResponse.FY001> >("FY001", version, verify, ybsssno.ToString(), fY001);

            if (resultFy001.transReturnCode != "0" && resultFy001.transReturnCode != "00000000")
            {
                return(RsXmlHelper.ResXml(-1, resultFy001.transReturnMessage + JsonOperator.JsonSerialize(fY001) + "出参:" + JsonOperator.JsonSerialize(resultFy001)));
            }

            getVerifyCodeResult = JsonOperator.JsonDeserialize <Entity.SResponse.getVerifyCode>(HttpHelper.Post("http://192.168.88.134:8300/YBDLL/domain/getVerifyCode", JsonOperator.JsonSerialize(new getVerifyCode()
            {
                inParam = "FY004|" + ybSno + "|HZS10|"
            }), Encoding.UTF8, 1));

            var result = HealthInsuranceHelper.RegTrial <BaseMedInsurance <Entity.SResponse.FY004> >("FY004", version, verify, ybsssno.ToString(), fY004);

            if (result.transReturnCode == "0" || result.transReturnCode == "00000000")
            {
                feeTrialBLL.Add(new fee_trial()
                {
                    akc190 = fY004.akc190,
                    aka130 = fY004.aka130,
                    bkc320 = fY004.bkc320,
                    ckc350 = fY004.ckc350,
                    aka030 = fY004.aka030,
                    akc264 = Convert.ToDecimal(fY004.akc264),
                    ckc601 = fY004.ckc601,
                    bke384 = fY004.bke384
                });

                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.getMZInsurance>()
                {
                    model = new Entity.SResponse.getMZInsurance()
                    {
                        resultCode = 0,
                        mzFeeId = regInfo.regid,
                        mzBillId = string.Join(",", orderInfoList.Select(x => x.billid)),
                        time = DateTime.Now,
                        SSFeeNo = fY004.akc190,
                        SSSerNum = fY004.bke384,
                        recipeCount = orderInfoList.Count.ToString(),
                        mzCategory = "普通",
                        doctorCode = doctor.userno,
                        doctorName = doctor.username,
                        deptCode = dept.code,
                        deptName = dept.name,
                        payType = "医保",
                        payAmount = result.transBody.akb067.ToString(),
                        accountAmount = result.transBody.akb066.ToString(),
                        medicareAmount = result.transBody.akb068.ToString(),
                        insuranceAmout = (result.transBody.akb068 + result.transBody.akb066).ToString(),
                        totalAmout = result.transBody.akc264.ToString(),
                        akc190 = fY004.akc190,
                        cardArea = result.cardArea,
                        SSInfoNew = JsonOperator.JsonSerialize(result.transBody)
                    }
                }));
            }
            else
            {
                return(RsXmlHelper.ResXml(-1, result.transReturnMessage));
            }
        }
        public string GetRegSettlement(request <getRegSettlement> getRegSettlement)
        {
            if (getRegSettlement == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var reg_Trial = regTrialBLL.Get(Convert.ToInt32(getRegSettlement.model.hisOrdNum));

            if (!string.IsNullOrWhiteSpace(reg_Trial.transBody))
            {
                return(XMLHelper.XmlSerialize(new response <RegSettlement>()
                {
                    model = new RegSettlement()
                    {
                        resultCode = 0, resultMessage = reg_Trial.transBody, akc190 = reg_Trial.akc190
                    }
                }));
            }
            var reg_trialDetails = regTrialdetailBLL.GetList(reg_Trial.id);

            MZ002 mZ002 = new MZ002()
            {
                akc190   = reg_Trial.akc190,
                aaz500   = reg_Trial.aaz500,
                bzz269   = reg_Trial.bzz269,
                alc005   = reg_Trial.alc005,
                aka130   = reg_Trial.aka130,
                akf001   = reg_Trial.akf001,
                bkc368   = reg_Trial.bkc368,
                aka120   = reg_Trial.aka120,
                akc188   = reg_Trial.akc188,
                akc189   = reg_Trial.akc189,
                bke384   = reg_Trial.bke384,
                akc264   = Convert.ToDecimal(reg_Trial.akc264),
                listsize = reg_trialDetails.Count
            };

            mZ002.inputlist = new List <inputlist>();
            foreach (var reg_Trialdetail in reg_trialDetails)
            {
                mZ002.inputlist.Add(new inputlist()
                {
                    aae072 = reg_Trialdetail.aae072,
                    bkf500 = reg_Trialdetail.bkf500,
                    ake001 = reg_Trialdetail.ake001,
                    ake005 = reg_Trialdetail.ake005,
                    ake006 = reg_Trialdetail.ake006,
                    aae019 = Convert.ToDecimal(reg_Trialdetail.aae019)
                });
            }

            var ybsssno = commKeyBLL.GetYBNO();

            var ybSno = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + ybsssno;
            var getVerifyCodeResult = JsonOperator.JsonDeserialize <Entity.SResponse.getVerifyCode>(HttpHelper.Post("http://192.168.88.134:8300/YBDLL/domain/getVerifyCode", JsonOperator.JsonSerialize(new getVerifyCode()
            {
                inParam = "XX001|" + ybSno + "|HZS10|"
            }), Encoding.UTF8, 1));

            if (getVerifyCodeResult.resultCode != 0)
            {
                return(null);
            }

            var version = getVerifyCodeResult.outParam.Split("|")[2];
            var verify  = getVerifyCodeResult.outParam.Split("|")[0] + "|" + getVerifyCodeResult.outParam.Split("|")[1];
            var result  = HealthInsuranceHelper.RegTrial <BaseMedInsurance <Entity.SResponse.MZ002> >("MZ002", version, verify, ybsssno.ToString(), mZ002);

            if (result.transReturnCode == "0" || result.transReturnCode == "00000000")
            {
                reg_Trial.transBody = JsonOperator.JsonSerialize(result.transBody);
                regTrialBLL.Update(reg_Trial);
                return(XMLHelper.XmlSerialize(new response <RegSettlement>()
                {
                    model = new RegSettlement()
                    {
                        resultCode = 0, resultMessage = JsonOperator.JsonSerialize(result.transBody), akc190 = mZ002.akc190
                    }
                }));
            }
            else
            {
                return(RsXmlHelper.ResXml(99, result.transReturnMessage));
            }
        }
        public string GetMZInsurance(request <getClinicalTrial> getClinicalTrial)
        {
            if (getClinicalTrial == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var reg_Trial        = regTrialBLL.Get(Convert.ToInt32(getClinicalTrial.model.hisOrdNum));
            var reg_trialDetails = regTrialdetailBLL.GetList(reg_Trial.id);

            var mz001 = new Entity.SRequest.MZ001()
            {
                akc190   = reg_Trial.akc190,
                aaz500   = reg_Trial.aaz500,
                alc005   = reg_Trial.alc005,
                aka130   = reg_Trial.aka130,
                akf001   = reg_Trial.akf001,
                bkc368   = reg_Trial.bkc368,
                akc264   = reg_Trial.akc264.ToString(),
                listsize = reg_trialDetails.Count.ToString()
            };

            mz001.inputlist = new List <Entity.SRequest.inputlist5>();
            foreach (var reg_Trialdetail in reg_trialDetails)
            {
                var inputlist5 = new inputlist5()
                {
                    aae072 = reg_Trialdetail.aae072,
                    bkf500 = reg_Trialdetail.bkf500,
                    ake001 = reg_Trialdetail.ake001,
                    ake005 = reg_Trialdetail.ake005,
                    ake006 = reg_Trialdetail.ake006,
                    aae019 = reg_Trialdetail.aae019.ToString()
                };
                mz001.inputlist.Add(inputlist5);
            }


            var ybsssno = commKeyBLL.GetYBNO();

            var ybSno = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + ybsssno;
            var getVerifyCodeResult = JsonOperator.JsonDeserialize <Entity.SResponse.getVerifyCode>(HttpHelper.Post("http://192.168.88.134:8300/YBDLL/domain/getVerifyCode", JsonOperator.JsonSerialize(new getVerifyCode()
            {
                inParam = "XX001|" + ybSno + "|HZS10|"
            }), Encoding.UTF8, 1));

            if (getVerifyCodeResult.resultCode != 0)
            {
                return(null);
            }

            var version = getVerifyCodeResult.outParam.Split("|")[2];
            var verify  = getVerifyCodeResult.outParam.Split("|")[0] + "|" + getVerifyCodeResult.outParam.Split("|")[1];
            var result  = HealthInsuranceHelper.RegTrial <Entity.SResponse.pre_settlement>("MZ001", version, verify, ybsssno.ToString(), mz001);

            if (result.transReturnCode == "0" || result.transReturnCode == "00000000")
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.getClinicalTrial>()
                {
                    model = new Entity.SResponse.getClinicalTrial()
                    {
                        resultCode = 0,
                        resultMessage = JsonOperator.JsonSerialize(result.transBody),
                        SSSerNum = ybSno,
                        cardArea = result.cardArea,
                        akc190 = mz001.akc190
                    }
                }));
            }
            else
            {
                return(RsXmlHelper.ResXml(-1, result.transReturnMessage));
            }
        }