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)); } }