public List <DepositItem> GetDepositItems(int did, string payMode, string beginDate, string endDate, string sno)
        {
            var list = db.Queryable <fee_depositdetail>()
                       .WhereIF(!string.IsNullOrEmpty(beginDate), it => SqlFunc.Between(it.addtime, beginDate, endDate))
                       .WhereIF(!string.IsNullOrEmpty(sno), it => it.paysn == sno)
                       .WhereIF(!string.IsNullOrEmpty(payMode), it => it.paytype == payMode)
                       .Where(x => x.did == did)
                       .Select(f => new DepositItem
            {
                branchCode = "",
                branchName = "",
                payAmout   = (f.price * 100).ToString(),
                hisOrdNum  = f.detailid.ToString(),
                agtOrdNum  = f.paysn,
                payMode    = f.paytype.ToString(),
                payStatus  = "1",
                balance    = ""
            }).ToList();

            foreach (var item in list)
            {
                item.hisOrdNum  = EString.ZeroFill(item.hisOrdNum);
                item.receiptNum = EString.ZeroFill(item.hisOrdNum);
                item.payMode    = CodeConvertUtils.GetDepositType(item.payMode);
            }

            return(list);
        }
        public string GetPayList(request <Entity.SRequest.getPayList> getPayList)
        {
            if (getPayList == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var para = CodeConvertUtils.GetCardTypeByType(Convert.ToInt32(getPayList.model.patCardType));

            var ptInfo   = feeinfoBLL.GetFee_Infos(para, getPayList.model.patCardNo);
            var itemList = feeinfoBLL.GetPayItems(ptInfo.pid);

            if (itemList != null && itemList.Count > 0)
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.getPayList>()
                {
                    model = new Entity.SResponse.getPayList()
                    {
                        resultCode = 0,
                        item = itemList
                    }
                }));
            }
            else
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.getPayList>()
                {
                    model = new Entity.SResponse.getPayList()
                    {
                        resultCode = 1,
                        resultMessage = "暂无数据"
                    }
                }));
            }
        }
Beispiel #3
0
        public List <Entity.SResponse.MZFeeList> GetMZFeeLists(int cardType, string cardNo, string beginDate, string endDate)
        {
            var para = CodeConvertUtils.GetCardTypeByType(cardType);

            para += " = '" + cardNo + "'";

            return(iOrderinfo.GetMZFeeLists(para));
        }
        public string GetMZPatient([FromBody] request <GetMZPatient> getMZPatient)
        {
            if (getMZPatient == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            var pt_Info = ptInfoBLL.GetPtInfoByCardNo(getMZPatient.model.patName, getMZPatient.model.patCardType, getMZPatient.model.patCardNo);

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

            response <Entity.SResponse.getMZPatient> getMZResponse = new response <Entity.SResponse.getMZPatient>()
            {
                model = new Entity.SResponse.getMZPatient()
                {
                    resultCode    = 0,
                    resultMessage = "",
                    patType       = 1,
                    patName       = pt_Info.pname,
                    patSex        = pt_Info.sex == "男" ? "M" : "F",
                    patBirth      = pt_Info.birth.ToString(),
                    patAddress    = pt_Info.addr1 + pt_Info.addr3,
                    patMobile     = pt_Info.tel,
                    patIdType     = CodeConvertUtils.GetIdNoType(pt_Info.idtype),
                    patIdNo       = pt_Info.idno,
                    patCardType   = getMZPatient.model.patCardType,
                    patCardNo     = getMZPatient.model.patCardNo,
                    hasMedicare   = !string.IsNullOrWhiteSpace(pt_Info.yno)
                }
            };

            return(XMLHelper.XmlSerialize(getMZResponse));
        }
        public string PayCurReg(request <Entity.SRequest.payCurReg> payCurReg)
        {
            if (payCurReg == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }

            string floor   = "";
            var    regInfo = reginfoBLL.GetReg_Info(Convert.ToInt32(payCurReg.model.hisOrdNum));

            if (regInfo == null)
            {
                return(RsXmlHelper.ResXml(99, "挂号信息为空"));
            }
            try
            {
                payCurReg.model.payMode = CodeConvertUtils.GetChannByCode(Convert.ToInt32(payCurReg.model.payMode));
            }
            catch
            {
                payCurReg.model.payMode = payCurReg.model.payMode;
            }

            var fee_info = feeinfoBLL.GetFee_InfoByRegInfo(Convert.ToInt32(payCurReg.model.hisOrdNum));

            fee_info.del         = false;
            fee_info.addtime     = payCurReg.model.payTime == null ? DateTime.Now : Convert.ToDateTime(payCurReg.model.payTime);
            fee_info.amountrec   = Convert.ToDecimal(payCurReg.model.payAmout) / 100;
            fee_info.amountcol   = Convert.ToDecimal(payCurReg.model.payAmout) / 100;
            fee_info.extern_memo = "hisOrdNum:" + payCurReg.model.hisOrdNum + ",psOrdNum:" + payCurReg.model.psOrdNum + ",agtOrdNum:" + payCurReg.model.agtOrdNum + ",agtCode:" + payCurReg.model.agtCode + ",payMode:" + payCurReg.model.payMode + ",payMethod:" + payCurReg.model.payMethod + ",payAmout:" + Convert.ToDecimal(payCurReg.model.payAmout) / 100 + ",payTime:" + payCurReg.model.payTime + (!string.IsNullOrWhiteSpace(payCurReg.model.SSSerialNo) ? ",自费金额:" + (Convert.ToDecimal(payCurReg.model.payAmout) - Convert.ToDecimal(payCurReg.model.SSMoney)) + "。" : "。");

            var feeinfodetails = feeInfodetailBLL.GetFee_Infodetails(fee_info.feeid);

            feeinfodetails.ForEach(x => x.del    = false);
            feeinfodetails.ForEach(x => x.status = 1);
            feeInfodetailBLL.Updates(feeinfodetails);

            regInfo.del = false;
            reginfoBLL.UpdateRegInfo(regInfo);
            floor = sysDeptBLL.GetFloorByName(regInfo.dept);

            feeinfoBLL.Update(fee_info);

            if ((Convert.ToDecimal(payCurReg.model.payAmout) - Convert.ToDecimal(payCurReg.model.SSMoney)) > 0)
            {
                feeinfoBLL.AddFeechannel(new fee_channel()
                {
                    feeid   = fee_info.feeid,
                    chnn    = payCurReg.model.payMode,
                    amount  = (Convert.ToDecimal(payCurReg.model.payAmout) - Convert.ToDecimal(payCurReg.model.SSMoney)) / 100,
                    del     = false,
                    chnnsno = payCurReg.model.psOrdNum
                });
            }

            if (payCurReg.model.payMethod == "2")//医保
            {
                feeinfoBLL.AddFeechannel(new fee_channel()
                {
                    feeid   = fee_info.feeid,
                    chnn    = "医疗保险",
                    amount  = Convert.ToDecimal(payCurReg.model.SSMoney) / 100,
                    del     = false,
                    chnnsno = payCurReg.model.SSSerialNo
                });
            }

            return(XMLHelper.XmlSerialize(new response <Entity.SResponse.payCurReg>()
            {
                model = new Entity.SResponse.payCurReg()
                {
                    resultCode = 0,
                    resultMessage = "",
                    visitLocation = floor
                }
            }));
        }
        public string OrderCurReg(request <Entity.SRequest.orderCurReg> orderCurRegInfo)
        {
            if (orderCurRegInfo == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML格式错误"));
            }
            var feeinfo = feeinfoBLL.Get(orderCurRegInfo.model.psOrdNum);

            if (feeinfo != null)
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.orderCurReg>()
                {
                    model = new Entity.SResponse.orderCurReg()
                    {
                        resultCode = 0,
                        resultMessage = "",
                        hisOrdNum = feeinfo.regid.ToString(),
                        treatFee = orderCurRegInfo.model.regFee
                    }
                }));
            }

            reg_arrange reg_Arrange = null;
            pt_info     pt_Info     = null;
            var         dept        = new sys_dept();
            var         doctor      = new sys_userinfo();


            if (!string.IsNullOrWhiteSpace(orderCurRegInfo.model.workId))
            {
                reg_Arrange = regArrangeBLL.GetReg_Arrange(Convert.ToInt32(orderCurRegInfo.model.workId));
            }
            else
            {
                dept        = sysDeptBLL.GetDeptByCode(orderCurRegInfo.model.deptCode);
                doctor      = sysUserinfoBLL.GetRDoctor(orderCurRegInfo.model.doctorCode);
                reg_Arrange = regArrangeBLL.GetReg_Arrange(dept.name, doctor.username, orderCurRegInfo.model.beginTime, orderCurRegInfo.model.endTime, Convert.ToInt32(orderCurRegInfo.model.timeFlag));
            }
            if (reg_Arrange == null)
            {
                return(RsXmlHelper.ResXml(-1, "无号源信息"));
            }

            var feetype = "";

            if (!string.IsNullOrWhiteSpace(orderCurRegInfo.model.SSCardNumber) && !string.IsNullOrWhiteSpace(orderCurRegInfo.model.SSCodeId))
            {
                feetype = "医疗保险";
                if (string.IsNullOrWhiteSpace(orderCurRegInfo.model.SSPwd))
                {
                    orderCurRegInfo.model.SSPwd = "000000";
                }
                pt_Info = ptInfoBLL.GetPt_Info(x => x.yno == orderCurRegInfo.model.SSCardNumber);
                if (pt_Info == null)
                {
                    pt_Info = ptInfoBLL.GetPt_Info(x => x.cno == orderCurRegInfo.model.patCardNo || x.idno == orderCurRegInfo.model.patCardNo);
                    if (string.IsNullOrWhiteSpace(pt_Info.yno))
                    {
                        pt_Info.yno = orderCurRegInfo.model.SSCardNumber;
                        ptInfoBLL.Update(pt_Info);
                    }
                }
            }
            else
            {
                feetype = "自费";
                pt_Info = ptInfoBLL.GetPt_Info(x => x.cno == orderCurRegInfo.model.patCardNo || x.idno == orderCurRegInfo.model.patCardNo);
            }

            var regInfo = reginfoBLL.Get(x => x.doctor == doctor.username && x.dept == dept.name && pt_Info.pid == x.pid && x.status == "候诊" && x.validate > DateTime.Now);

            if (regInfo != null && regInfo.del == true)
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.orderCurReg>()
                {
                    model = new Entity.SResponse.orderCurReg()
                    {
                        resultCode = 0,
                        resultMessage = "",
                        hisOrdNum = regInfo.regid.ToString(),
                        treatFee = orderCurRegInfo.model.ghhj.ToString()
                    }
                }));
            }

            if (regInfo != null && regInfo.del == false)
            {
                return(RsXmlHelper.ResXml(-1, "你已挂当前科室号"));
            }

            var reg_Info = reginfoBLL.Add(new reg_info()
            {
                feetype = feetype
            }, pt_Info, reg_Arrange, orderCurRegInfo.model.orderNo, orderCurRegInfo.model.psOrdNum, out decimal amount, out int mzno, out int feeid, out List <comm_fee> commFees);

            if (reg_Info == null)
            {
                return(RsXmlHelper.ResXml(99, "挂号失败"));
            }

            if (feetype == "医疗保险")
            {
                var regtrialId = regTrialBLL.AddReturnId(new reg_trial()
                {
                    akc190 = "HZS10" + mzno,
                    aaz500 = orderCurRegInfo.model.SSCodeId,
                    bzz269 = orderCurRegInfo.model.SSPwd,
                    aka130 = "11",
                    akf001 = dept.ybno,
                    bkc368 = CodeConvertUtils.SwichRegType(reg_Arrange.regtype).ToString(),
                    bke384 = "HZS10" + DateTime.Now.ToString("yyyyMMdd") + feeid,
                    akc264 = commFees.Sum(x => x.prices),
                    regid  = reg_Info.regid
                });

                List <reg_trialdetail> reg_Trialdetails = new List <reg_trialdetail>();
                foreach (var commFee in commFees)
                {
                    reg_Trialdetails.Add(new reg_trialdetail()
                    {
                        regtrialid = regtrialId,
                        aae072     = commKeyBLL.GetYBDJH().ToString(),
                        bkf500     = commKeyBLL.GetYBXLH().ToString(),
                        ake001     = commFee.scode,
                        ake005     = commFee.itemid,
                        ake006     = commFee.itemname,
                        aae019     = commFee.prices
                    });
                }
                regTrialdetailBLL.Adds(reg_Trialdetails);
            }

            return(XMLHelper.XmlSerialize(new response <Entity.SResponse.orderCurReg>()
            {
                model = new Entity.SResponse.orderCurReg()
                {
                    resultCode = 0,
                    resultMessage = "",
                    hisOrdNum = reg_Info.regid.ToString(),
                    treatFee = amount.ToString()
                }
            }));
        }
        public string CreateACard([FromBody] request <CreateACard> createACard)
        {
            if (createACard == null)
            {
                return(RsXmlHelper.ResXml("-1", "XML格式错误"));
            }
            var ptInfo = ptInfoBLL.GetPt_Info(x => x.idno == createACard.model.patIdNo);

            if (ptInfo != null)
            {
                return(RsXmlHelper.ResXml("1", "患者信息已存在"));
            }

            pt_info pt_Info = null;

            if (!string.IsNullOrWhiteSpace(createACard.model.patYbkh) && !string.IsNullOrWhiteSpace(createACard.model.patDnh) && !string.IsNullOrWhiteSpace(createACard.model.patYbjbmc) && !string.IsNullOrWhiteSpace(createACard.model.patCblx))
            {
                pt_Info = new pt_info()
                {
                    pname      = createACard.model.patName,
                    sex        = createACard.model.patSex == "M" ? "男" : "女",
                    birth      = Convert.ToDateTime(createACard.model.patBirth),
                    addr1      = createACard.model.patAddress,
                    tel        = createACard.model.patMobile,
                    ybidentity = createACard.model.patYbjbmc,
                    yno        = createACard.model.patDnh,
                    patYbjbmc  = createACard.model.patYbjbmc,
                    patCblx    = createACard.model.patCblx,
                    idtype     = CodeConvertUtils.GetIdNoType(Convert.ToInt32(createACard.model.patIdType)),
                    idno       = createACard.model.patIdNo,
                    addtime    = DateTime.Now,
                    del        = false,
                    pinyin     = Pinyin.GetInitials(createACard.model.patName).ToLower(),
                    memo       = "患者通过自助机建档",
                    addperson  = "自助机"
                };
            }
            else
            {
                pt_Info = new pt_info()
                {
                    pname     = createACard.model.patName,
                    sex       = createACard.model.patSex == "M" ? "男" : "女",
                    birth     = Convert.ToDateTime(createACard.model.patBirth),
                    addr1     = createACard.model.patAddress,
                    tel       = createACard.model.patMobile,
                    idtype    = CodeConvertUtils.GetIdNoType(Convert.ToInt32(createACard.model.patIdType)),
                    idno      = createACard.model.patIdNo,
                    addtime   = DateTime.Now,
                    del       = false,
                    pinyin    = Pinyin.GetInitials(createACard.model.patName).ToLower(),
                    memo      = "患者通过自助机建档",
                    addperson = "自助机"
                };
            }

            var isAdd = ptInfoBLL.Add(pt_Info);

            if (isAdd != null)
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.createACard>()
                {
                    model = new Entity.SResponse.createACard()
                    {
                        resultCode = "0",
                        resultMessage = "",
                        patCardType = createACard.model.patIdType,
                        patCardNo = createACard.model.patIdNo
                    }
                }));
            }
            else
            {
                return(RsXmlHelper.ResXml("99", "建档失败"));
            }
        }
Beispiel #8
0
        public string GetDepositList(request <Entity.SRequest.GetDepositList> getDepositList)
        {
            if (getDepositList == null)
            {
                return(RsXmlHelper.ResXml(-1, "XML不能为空"));
            }
            var feeDeposit = feeDepositBLL.GetFee_Deposit(x => x.inid == Convert.ToInt32(getDepositList.model.patientID));

            if (feeDeposit == null)
            {
                return(RsXmlHelper.ResXml(-1, "暂无预交金缴费记录"));
            }
            var list = feeDepositBLL.GetDepositItems(feeDeposit.did, !string.IsNullOrWhiteSpace(getDepositList.model.payMode) ? CodeConvertUtils.GetChannByCode(Convert.ToInt32(getDepositList.model.payMode)) : "", getDepositList.model.beginDate, getDepositList.model.endDate, getDepositList.model.psOrdNum);

            if (list.Count > 0)
            {
                return(XMLHelper.XmlSerialize(new response <Entity.SResponse.GetDepositList>()
                {
                    model = new Entity.SResponse.GetDepositList()
                    {
                        resultCode = 0,
                        resultMessage = "",
                        item = list
                    }
                }));
            }
            else
            {
                return(RsXmlHelper.ResXml(99, "暂无缴费记录"));
            }
        }