示例#1
0
        /// <summary>
        ///     获取当前排班记录序号
        /// </summary>
        /// <returns></returns>
        public string GetResultXml()
        {
            try
            {
                var gzrq = Convert.ToDateTime(InPara.gzrq);
                var yspb = Ctx.MsYspbSet.FirstOrDefault(p => p.Ksdm == InPara.ksdm &&
                                                        p.Ysdm == InPara.ysdm &&
                                                        p.Zblb == InPara.zblb &&
                                                        p.Gzrq == gzrq &&
                                                        p.MsGhks.Ghlb == InPara.ghlb);
                if (yspb == null)
                {
                    throw new Exception("获取排班信息失败!");
                }

                var wsjDqJzDlOut = new WsjDqJzDlOut
                {
                    RtnValue = 1,
                    bzxx     = "获取当前就诊序号成功",
                    Jzcx     = new DqJzCx
                    {
                        dqcx = yspb.Jzxh
                    }
                };
                return(ConvertToObject <WsjDqJzDlOut> .SerializeXmlToString(wsjDqJzDlOut).Replace("Jzcx", "interface"));
            }
            catch (Exception e)
            {
                throw new Exception("取就诊序号时发生错误 /r/n" + e.Message);
            }
        }
示例#2
0
 public string GetResultXml()
 {
     try
     {
         var zyBrry = Ctx.ZyBrrySet.FirstOrDefault(p => p.Actnumber == InPara.actnumber);
         if (zyBrry?.Csny == null)
         {
             throw new Exception("检索病人信息失败!");
         }
         var hosOrderOut = new HosOrderOut
         {
             head = new HosOrderHead
             {
                 jzlsh  = zyBrry.Zyh,
                 mzzyhm = zyBrry.Zyhm,
                 brxm   = zyBrry.Brxm,
                 brxb   = zyBrry.Brxb,
                 brnl   = (int)(DateTime.Now - zyBrry.Csny.Value).TotalDays / 365 + 1,
                 lxdh   = zyBrry.Dwdh,
                 jtdz   = zyBrry.Gzdw,
                 nldw   = "岁"
             },
             list = GetHosOrdersItems(zyBrry.Zyh)
         };
         return(ConvertToObject <HosOrderOut> .SerializeXmlToString(hosOrderOut));
     }
     catch (Exception e)
     {
         throw new Exception("获取病人医嘱信息失败->" + e.Message);
     }
 }
示例#3
0
        /// <summary>
        ///     住院病人费用清单
        /// </summary>
        /// <returns></returns>
        public string GetInpExpenseInvoices()
        {
            try
            {
                var patient     = VerifyInpatient();
                var cvxCardType = GetCvxCardType(patient.Brxz);
                if (cvxCardType != "08")
                {
                    var noUpload = Ctx.ZyFymxSet.Any(p => p.Zyh == patient.Zyh && p.Scbz == 0 && p.Jscs == 0);
                    if (noUpload)
                    {
                        throw new Exception("本次住院结算有未上传的明细记录");
                    }
                }

                var(cnt1, zjje1, zjje2) = GetInpFee(patient.Zyh, (int)(patient.Yepb ?? 0));
                //预交款
                var yjk = Ctx.ZyTbkkSet.Where(p => p.Zyh == patient.Zyh && p.Zfpb == 0 && p.Jscs == 0)
                          ?.Select(p => p.Jkje).DefaultIfEmpty(0).Sum();
                var clinic     = GetInpClinicInfo(patient.Zyh, cnt1);
                var feeSummary = GetInpFeeSummary(patient.Zyh);

                var inpInvoices = new ExpenseInvoices
                {
                    Interface = new ExpenseInterface
                    {
                        HospitalCode = Config.YYBH,
                        Operator     = Config.CZGH,
                        CVX_CardType = cvxCardType,
                        ICInfo       = patient.Cardno ?? "",
                        YLLB         = patient.Yllb,
                        FeeTotal     = zjje1 + zjje2,
                        ZFFY         = zjje2,
                        yjje         = yjk.Value,
                        Clinic       = clinic
                    }
                };
                var xml = ConvertToObject <ExpenseInvoices> .SerializeToXElement(inpInvoices);

                var listNode    = xml.Descendants().FirstOrDefault(p => p.Name == "interface");
                var feeXElement = new XElement("zyfymx");
                foreach (var item in feeSummary)
                {
                    feeXElement.Add(new XElement($"I{item.K}", item.V));
                }

                listNode?.Add(feeXElement);
                return(xml.ToString());
            }
            catch (Exception e)
            {
                throw new Exception("获取住院费用失败! /r/n" + e.Message);
            }
        }
        /// <summary>
        ///     门诊分时段预约号源
        /// </summary>
        /// <returns></returns>
        public string GetResultXml()
        {
            try
            {
                //医院排班

                DateTime gzrq = Convert.ToDateTime(InPara.gzrq);
                var      yypb = Ctx.MsFsdYySet.Where(p =>
                                                     p.Gzrq == gzrq &&
                                                     p.Ksdm == InPara.ksdm &&
                                                     p.Ysdm == InPara.ysdm &&
                                                     p.Zblb == InPara.zblb &&
                                                     p.Yylb == 1 &&
                                                     p.Ghpb == 0)
                                .ToList();
                if (yypb.Any())
                {
                    var fsdYyOutRows = new List <FsdYyRow>();
                    foreach (var item in yypb)
                    {
                        var row = new FsdYyRow
                        {
                            jzxh  = item.Jzxh,
                            jzsj  = item.Jzsj,
                            jzsj2 = item.Jzsj.AddMinutes(30)
                        };
                        fsdYyOutRows.Add(row);
                    }

                    var wsjFsdYyOut = new WsjFsdYyOut
                    {
                        RtnValue  = 1,
                        bzxx      = "获取医院分时段预约明细成功",
                        FsdYyRows = fsdYyOutRows
                    };
                    return(ConvertToObject <WsjFsdYyOut> .SerializeXmlToString(wsjFsdYyOut).Replace("FsdYyRows", "interface"));
                }

                throw new Exception("号源为空!");
            }
            catch (Exception e)
            {
                throw new Exception("没有获取得时段号源->" + e.Message);
            }
        }
 /// <summary>
 ///     获取发票费用明细
 /// </summary>
 /// <returns></returns>
 public string GetResultXml()
 {
     try
     {
         var invoiceItems = new List <InvoiceItem>();
         invoiceItems.AddRange(GetExaminationItems());
         invoiceItems.AddRange(GetRecipeItems());
         var hosInvoiceOut = new HosInvoiceOut()
         {
             sfxmmx = invoiceItems
         };
         return(ConvertToObject <HosInvoiceOut> .SerializeXmlToString(hosInvoiceOut));
     }
     catch (Exception e)
     {
         throw new Exception("发票信息获取失败" + e.Message);
     }
 }
 /// <summary>
 /// 获取医院挂号科室列表
 /// </summary>
 /// <returns></returns>
 public string GetResultXml()
 {
     try
     {
         var ghksRows = GetghksRows();
         if (!ghksRows.Any())
         {
             throw new Exception("挂号科室为空!");
         }
         var wsjGhksOut = new WsjGhksOut
         {
             RtnValue = 1,
             bzxx     = "获取挂号科室成功",
             GhksRows = ghksRows
         };
         return(ConvertToObject <WsjGhksOut> .SerializeXmlToString(wsjGhksOut).Replace("GhksRows", "interface"));
     }
     catch (Exception e)
     {
         throw new Exception("获取挂号科室失败 /r/n" + e.Message);
     }
 }
        /// <summary>
        ///     获取某个科室所有医生排班状态
        /// </summary>
        /// <returns></returns>
        public string GetResultXml()
        {
            try
            {
                var list = GetKsYspb();
                if (!list.Any())
                {
                    throw new Exception("科室排班为空");
                }
                var wsjYspbOut = new WsjYspbOut()
                {
                    RtnValue = 1,
                    bzxx     = "获取排班信息成功!",
                    YspbRows = list
                };

                return(ConvertToObject <WsjYspbOut> .SerializeXmlToString(wsjYspbOut).Replace("YspbRows", "interface"));
            }
            catch (Exception e)
            {
                throw new Exception("获取科室排班失败--" + e.Message);
            }
        }
 /// <summary>
 ///     挂号处理
 /// </summary>
 /// <returns></returns>
 public string GetResultXml()
 {
     using (var transaction = Ctx.Database.BeginTransaction())
     {
         try
         {
             //获取当前预约挂号涉及的门诊侦查费
             GetMedicalFee();
             GetTableKey();
             ProcessMzBrda();
             //判断是否满足挂号条件
             CanYyGh();
             //开始预约挂号操作
             //获取jzhm
             InPara.ghxx.jzhm = GetJzhm(Config.CZGH);
             //获取各表的key值
             if (string.IsNullOrEmpty(InPara.ghxx.pzhm))
             {
                 //插入MsYYGH
                 InsertMsYygh();
             }
             else
             {
                 //更新msyy_ghxx
                 UpdateMsyyGhxx();
                 //更新ms_yygh
                 UpdateMsyyGh();
             }
             //插入ms_ghmx
             InsertMzGhmx();
             var yj2Count = InPara.ghxx.yj02xh.Length;
             if (yj2Count > 0)
             {
                 //插入ms_yj01
                 InsertMzYj01();
                 //插入ms_yj02
                 InsertMzYj02();
             }
             //更新挂号人数
             UpdateMzYspb();
             //锁定号源
             LockMzFsdyy();
             transaction.Commit();
             var wsjGhclOut = new WsjGhclOut
             {
                 GhclOutInterface = new GhclOutInterface
                 {
                     row = new GhclOutInterfaceRow
                     {
                         ghxh = InPara.ghxx.yyxh
                     }
                 }
             };
             return(ConvertToObject <WsjGhclOut> .SerializeXmlToString(wsjGhclOut));
         }
         catch (Exception e)
         {
             transaction.Rollback();
             throw new Exception("预约挂号失败->" + e.Message);
         }
     }
 }
 protected BasicHandle(FrontEndContext context, string xmlString)
 {
     Ctx    = context;
     Config = GetGenericConfig();
     InPara = ConvertToObject <T> .XmlDeserialize(xmlString);
 }
        /// <summary>
        ///     退号处理
        /// </summary>
        /// <returns></returns>
        public string GetResultXml()
        {
            using (var transaction = Ctx.Database.BeginTransaction())
            {
                try
                {
                    var msYygh = Ctx.MsYyghSet.Where(p => p.Yyxh == InPara.ghxh)
                                 .Include(p => p.MsGhmx)
                                 .Include(p => p.MsYj01.MsYj02)
                                 .FirstOrDefault();
                    if (msYygh?.Yyrq == null)
                    {
                        throw new Exception("获取ms_yygh数据有错误!");
                    }
                    msYygh.Ghbz        = 2;
                    msYygh.MsGhmx.Thbz = 1;
                    Ctx.MsYj02Set.RemoveRange(msYygh.MsYj01.MsYj02);
                    Ctx.MsYj01Set.Remove(msYygh.MsYj01);

                    //插入退号明细表ms_thmx
                    var thmx = new MsThmx
                    {
                        Sbxh = msYygh.Ghsbxh.Value,
                        Czgh = Config.CZGH,
                        Mzlb = 1,
                        Thrq = DateTime.Now,
                        Cjbz = 0,
                        Txbz = 0,
                        Jgid = 1
                    };
                    Ctx.MsThmxSet.Add(thmx);
                    //获取工作日期
                    var gzrq = msYygh.Yyrq.Value.Date;
                    //修改ms_yspb信息,释放排班
                    var msYspb = Ctx.MsYspbSet.FirstOrDefault(p => p.Gzrq == gzrq &&
                                                              p.Ksdm == msYygh.Ksdm &&
                                                              p.Ysdm == msYygh.Ysdm &&
                                                              p.Zblb == msYygh.Zblb);
                    if (msYspb == null)
                    {
                        throw new Exception("获取ms_yspb数据有错误!");
                    }
                    --msYspb.Yyrs;
                    --msYspb.Ygrs;
                    --msYspb.Jzxh;
                    //释放号源
                    var fsdyy = Ctx.MsFsdYySet.FirstOrDefault(p => p.Gzrq == gzrq &&
                                                              p.Ksdm == msYygh.Ksdm &&
                                                              p.Ysdm == msYygh.Ysdm &&
                                                              p.Zblb == msYygh.Zblb &&
                                                              p.Jzxh == msYygh.Jzxh);
                    if (fsdyy == null)
                    {
                        throw new Exception("获取ms_fsdyyb数据有错误!");
                    }
                    fsdyy.Ghpb = 0;
                    fsdyy.Brxm = string.Empty;
                    fsdyy.Brid = null;
                    Ctx.SaveChanges();
                    transaction.Commit();
                    var a = new YyghInterface
                    {
                        RtnValue = 1,
                        bzxx     = "门诊退号成功!"
                    };
                    return(ConvertToObject <YyghInterface> .SerializeXmlToString(a));
                }
                catch (Exception e)
                {
                    transaction.Rollback();
                    throw new Exception("门诊退号失败" + e.Message);
                }
            }
        }
示例#11
0
        /// <summary>
        ///     拼接门诊病人费用字符串
        /// </summary>
        /// <returns></returns>
        public string GetOpExpenseInvoices()
        {
            try
            {
                //获取病人信息
                var jzls = Ctx.YsMzJzlsSet.Where(p => p.Actnumber == InPara.actnumber && p.Zfpb == 0)
                           .Include(p => p.GyYgdm)
                           .Include(p => p.GyKsdm)
                           .Include(p => p.YsMzJbzds.Select(t => t.GyJbbm))
                           .OrderByDescending(p => p.Kssj).FirstOrDefault();
                if (jzls == null)
                {
                    throw new Exception("获取门诊就诊记录失败");
                }

                if (jzls.Brbh <= 0)
                {
                    throw new Exception("获取门诊病人档案失败");
                }

                var patient = Ctx.MsBrdaSet.Find(jzls.Brbh);
                if (patient == null || patient.Brxz <= 0)
                {
                    throw new Exception("获取病人基本信息失败");
                }

                var jbzd = jzls.YsMzJbzds.FirstOrDefault();

                if (jbzd == null)
                {
                    throw new Exception("没有诊断或诊断信息获取失败,请医生检查诊断信息");
                }

                var hzybDmzd = Ctx.HzybDmzdSet.FirstOrDefault(p => p.Dmlb == "YSDM_DZ" && p.Dmsb == jzls.Ysdm);
                var disCode  = jbzd?.GyJbbm.Icd9 ?? "";
                var disName  = jbzd?.GyJbbm.Jbmc ?? "";
                var cyzd     = new List <string>
                {
                    disCode
                };
                var clinic = new OpClinic()
                {
                    ClinicNo   = jzls.Jzxh,
                    ClinicDate = jzls.Kssj,
                    DeptCode   = jzls.Ksdm,
                    DeptGBCode = "",
                    DeptName   = jzls.GyKsdm.Ksmc ?? "",
                    DocName    = jzls.GyYgdm.Ygxm ?? "",
                    DocSfzh    = hzybDmzd?.Dmmc ?? "",
                    DisCode    = disCode,
                    DisName    = disName,
                    DisDesc    = "",
                    CYZD       = cyzd,
                };

                //获取费用清单
                var details = GetOpFeeDetails(patient.Brid, (patient.Qybr ?? 0));
                clinic.FeeDetail = details.Select(p => p.Item.Count).DefaultIfEmpty(0).Sum();
                //组装xml语句
                var opExpense = new OpExpenseInvoices
                {
                    OpInterface = new OpExpenseInvoicesInterface
                    {
                        HospitalCode = Config.YYBH,
                        Operator     = Config.CZGH,
                        CVX_CardType = GetCvxCardType(patient.Brxz.Value),
                        ICInfo       = GetIcInfor(patient),
                        FeeTotal     = details.Sum(p => p.itemCost),
                        Clinic       = clinic,
                        list         = details,
                        DisAudNo     = "",
                        OperatorName = ""
                    }
                };
                return(ConvertToObject <OpExpenseInvoices> .SerializeXmlToString(opExpense));
            }
            catch (Exception e)
            {
                throw new Exception("门诊费用清单获取失败!" + e.Message);
            }
        }
        /// <summary>
        ///     获取住院费用清单
        /// </summary>
        /// <returns></returns>
        public string GetResultXml()
        {
            try
            {
                if (InPara?.jssj == null || InPara?.kssj == null)
                {
                    throw new Exception("查询时间不能为空!");
                }

                var patient = Ctx.ZyBrrySet.Where(p => p.Actnumber == InPara.actnumber)
                              .Include(p => p.KsBrks)
                              .Include(p => p.ZyTbkks)
                              .Include(p => p.GyBrxz)
                              .Include(p => p.ZyFymxs)
                              .FirstOrDefault();
                if (patient == null)
                {
                    throw new Exception("不存在该序号的病人住院信息!");
                }

                var validList = patient.ZyFymxs.Where(p => p.Jfrq >= InPara.start && p.Jfrq < InPara.stop).ToList();
                var jbxx      = new YyghInterfaceInterfaceJbxx
                {
                    brxm = patient.Brxm,
                    fyxz = patient.GyBrxz.Xzmc,
                    ryrq = patient.Ryrq,
                    cyrq = patient.Cyrq ?? DateTime.Now,
                    zyts = (int)((patient.Cyrq ?? DateTime.Now) - patient.Ryrq).TotalDays,
                    brch = patient.Brch,
                    zyhm = patient.Zyhm,
                    ksmc = patient.KsBrks.Ksmc,
                    fyze = patient.ZyFymxs.Where(p => p.Jfrq <= InPara.stop).Sum(p => p.Zjje),
                    fyxj = validList.Sum(p => p.Zjje),
                    yjk  = patient.ZyTbkks.Where(p => p.Zfpb == 0).Sum(p => p.Jkje)
                };
                var fyqd = validList.GroupBy(p => p.Fyxm)
                           .Select(t => new YyghInterfaceInterfaceItem
                {
                    fylxdm = t.Key,
                    xmxj   = t.Sum(a => a.Zjje),
                    zfxj   = t.Sum(a => a.Zjje)
                }).ToArray();

                var sfxmList = Ctx.GySfxmSet.ToList();

                foreach (var item in fyqd)
                {
                    item.fylxmc = sfxmList.FirstOrDefault(p => p.Sfxm == item.fylxdm)?.Sfmc;
                    item.fyitem = validList.Where(p => p.Fyxm == item.fylxdm)
                                  .GroupBy(p => new { fyxh = p.Fyxh, fymc = p.Fymc, ypcd = p.Ypcd, fydj = p.Fydj, YPLX = p.Yplx })
                                  .Select(p => new YyghInterfaceInterfaceItemFyitem
                    {
                        fydj = p.Key.fydj,
                        fymc = p.Key.fymc,
                        fysl = p.Sum(t => t.Fysl),
                        zfje = p.Sum(t => t.Zjje),
                        yblb = p.Key.YPLX,
                        fydm = p.Key.fyxh,
                        fyje = p.Sum(t => t.Zjje)
                    }).ToArray();
                }

                var outPara = new WsjFyqdOut
                {
                    RtnValue         = 1,
                    bzxx             = "获取住院费用清单成功",
                    FyqdGetInterface = new WsjFyqdGetInterface
                    {
                        jbxx = jbxx,
                        fyqd = fyqd
                    }
                };

                return(ConvertToObject <WsjFyqdOut> .SerializeXmlToString(outPara));
            }
            catch (Exception e)
            {
                throw new Exception("获取住院清单失败" + e.Message);
            }
        }