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 BindCard([FromBody] request <BindCard> bindCard) { if (bindCard == null) { return(RsXmlHelper.ResXml(-1, "XML格式错误")); } if (bindCard.model.bindType == "Y") //绑卡 { var ptInfo = ptInfoBLL.GetInfoByCard(bindCard.model.PatId, bindCard.model.PatName); var card = cardInfoBLL.GetCardByCno(bindCard.model.patCardNo); card_info existCard = null; if (card != null && card.pid != null) { if (card.pid == ptInfo.pid) { return(RsXmlHelper.ResXml(0, JsonOperator.JsonSerialize(card))); } else { return(RsXmlHelper.ResXml(99, "卡号已绑定患者")); } } else if (card != null && card.pid == null) { card.pid = ptInfo.pid; cardInfoBLL.UpdateCard(card); ptInfo.cno = card.cno.Trim(); ptInfoBLL.Update(ptInfo); return(RsXmlHelper.ResXml(0, "")); } else { if (ptInfo == null) { return(RsXmlHelper.ResXml(99, "患者信息为空")); } if (!string.IsNullOrWhiteSpace(ptInfo.cno)) { existCard = cardInfoBLL.GetCardByCno(ptInfo.cno); } if (existCard == null) { cardInfoBLL.CreateCard(new card_info() { cno = bindCard.model.patCardNo.Trim(), pid = ptInfo.pid, cmoney = 0, clevel = "银卡", status = 0, addperson = "自助机", addtime = DateTime.Now, del = false }); ptInfo.cno = bindCard.model.patCardNo.Trim(); ptInfoBLL.Update(ptInfo); return(RsXmlHelper.ResXml(0, "")); } else { return(RsXmlHelper.ResXml(0, JsonOperator.JsonSerialize(existCard))); } } } else if (bindCard.model.bindType == "S") { var ptInfo = ptInfoBLL.GetInfoByCard(bindCard.model.PatId, bindCard.model.PatName); if (ptInfo == null) { return(RsXmlHelper.ResXml(99, "患者信息为空")); } if (!string.IsNullOrWhiteSpace(ptInfo.cno)) { return(RsXmlHelper.ResXml(0, "患者已绑定就诊卡")); } else { return(RsXmlHelper.ResXml(1, "患者未绑定就诊卡")); } } else //解绑 { var ptInfo = ptInfoBLL.GetInfoByCard(bindCard.model.PatId, bindCard.model.PatName); card_info card = null; if (!string.IsNullOrWhiteSpace(bindCard.model.patCardNo)) { card = cardInfoBLL.GetCardByCno(bindCard.model.patCardNo); } else { var cardList = cardInfoBLL.GetByPid(ptInfo.pid); if (cardList != null && cardList.Count > 1) { return(RsXmlHelper.ResXml(99, "患者绑定多张卡")); } card = cardList.FirstOrDefault(); } if (ptInfo == null) { return(RsXmlHelper.ResXml(99, "患者信息为空")); } if (card == null || card.pid != ptInfo.pid) { return(RsXmlHelper.ResXml(99, "卡号为空或卡号绑定其他患者")); } ptInfo.cno = null; ptInfoBLL.Update(ptInfo); card.pid = null; cardInfoBLL.UpdateCard(card); return(RsXmlHelper.ResXml(0, "")); } }