Exemple #1
0
 public WyNhRegister GetNhPersonInfoByZyh(int zyh)
 {
     try
     {
         DCCbhisDataContext hisDb = new DCCbhisDataContext(GSettings.HisConnStr);
         DCNhDataContext    nhDb  = new DCNhDataContext(GSettings.NhConnStr);
         var feeItems             = from _f in hisDb.WyNhFeeList where _f.Zyh == zyh && _f.FeeNo == null select _f;
         var _NhPersonInfo        = (from _f in hisDb.WyNhRegister where _f.Zyh == zyh && _f.IsFail == (byte)0 select _f).FirstOrDefault();
         return(_NhPersonInfo);
     }
     catch (System.Exception ex)
     {
         return(null);
     }
 }
Exemple #2
0
        public IEnumerable <CIll> GetIllsByPym(string pym)
        {
            DCNhDataContext db = new DCNhDataContext(_hisConn);

            try
            {
                return((from ii in db.p_Illness
                        where ii.OrganID == "420302" && (ii.Spell.Contains(pym) || ii.IllName.Contains(pym))
                        select new CIll
                {
                    IllCode = ii.IllCode,
                    IllDesc = ii.IllName,
                    Spell = ii.Spell
                }
                        ).ToArray());
            }
            catch (System.Exception ex)
            {
                return(null);
            }
        }
Exemple #3
0
        public CIll GetIllsByIllCode(string pym)
        {
            DCNhDataContext db = new DCNhDataContext(_hisConn);

            try
            {
                return((from ii in db.p_Illness
                        where ii.OrganID == "420302" && ii.IllCode == pym
                        select new CIll
                {
                    IllCode = ii.IllCode,
                    IllDesc = ii.IllName,
                    Spell = ii.Spell
                }
                        ).FirstOrDefault());
            }
            catch (System.Exception ex)
            {
                return(new CIll());
            }
        }
Exemple #4
0
        public IEnumerable <string> ProcessFeeListByZyh(int zyh, bool Direct)
        {
            List <string>      lsNoNhCodes = new List <string>();
            DCCbhisDataContext hisDb       = new DCCbhisDataContext(GSettings.HisConnStr);
            DCNhDataContext    nhDb        = new DCNhDataContext(GSettings.NhConnStr);

            var _NhPersonInfo = GetNhPersonInfoByZyh(zyh);

            if (_NhPersonInfo == null)
            {
                lsNoNhCodes.Add(" 未找到患者有效的农合入院登记信息");
                return(lsNoNhCodes);
            }
            StringBuilder sb = null;
            int           hr = -1;

            var feeItems = from _f in hisDb.WyNhFeeList where _f.Zyh == zyh && _f.FeeNo == null select _f;

            foreach (var feeItem in feeItems)
            {
                try
                {
                    var _nhcode = (from _f in nhDb.P_HiHosItem where _f.HosCode == feeItem.HosCode && _f.OrganId == _NhPersonInfo.OrganCode && _f.ztyear == _NhPersonInfo.AccountYear select _f).FirstOrDefault();

                    //var _nhcode = (from _f in nhDb.P_HiHosItem where _f.HosCode == feeItem.HosCode && _f.OrganId =="420302" && _f.ztyear == _NhPersonInfo.AccountYear select _f).FirstOrDefault();
                    if (_nhcode == null)
                    {
                        lsNoNhCodes.Add(string.Format(@"{0}农合项目编码为空", feeItem.HosCode));
                    }
                    if (Direct || _nhcode != null)
                    {
                        sb = new StringBuilder(256);
                        hr = NhLocalWrap.SaveFreeList(
                            string.Format("{0}$${1}", _NhPersonInfo.OrganCode, _NhPersonInfo.AccountYear),
                            _NhPersonInfo.CoopMedCode,
                            _NhPersonInfo.AiIDNo,
                            int.Parse(_NhPersonInfo.DiagNo),
                            null,
                            feeItem.HosCode,
                            //feeItem.UseDate,
                            DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                            (double)feeItem.Price, (double)feeItem.Num, (double)feeItem.Fee,
                            null,
                            feeItem.OfficeName,
                            feeItem.Doctor,
                            "1",
                            sb
                            );
                        if (hr < 0)
                        {
                            throw new Exception(string.Format(@"{0}单据上传错误:{1}", feeItem.Cfh, sb.ToString()));
                        }
                        if (_nhcode != null)
                        {
                            feeItem.NhCode = _nhcode.InCode;
                        }
                        feeItem.FeeNo = sb.ToString();
                        hisDb.SubmitChanges();
                    }
                }
                catch (System.Exception ex)
                {
                    lsNoNhCodes.Add(ex.Message);
                }
            }

            sb = new StringBuilder(500);
            hr = NhLocalWrap.PreClearing(
                string.Format("{0}$${1}", _NhPersonInfo.OrganCode, _NhPersonInfo.AccountYear),
                _NhPersonInfo.CoopMedCode,
                _NhPersonInfo.AiIDNo,
                int.Parse(_NhPersonInfo.DiagNo),
                0, 2,
                DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                "1",
                sb
                );

            return(lsNoNhCodes);
        }