Пример #1
0
        public static BsPatientCache BsPatientConvertToCache(BsPatient bsPatient, string vipCardId, string vipLevel, string vipCardNo)
        {
            var bsUser     = UtilsLocCache.GetCacheByID <BsUser>(bsPatient.DoctorId);
            var doctorName = "";

            if (bsUser != null)
            {
                doctorName = bsUser.Name;
            }

            BsPatientCache bsPatientCache = new BsPatientCache();

            bsPatientCache.GUID        = bsPatient.GUID;
            bsPatientCache.Name        = bsPatient.Name;
            bsPatientCache.Sex         = bsPatient.Sex;
            bsPatientCache.CardNo      = bsPatient.CardNo;
            bsPatientCache.IdCardNo    = bsPatient.IdCardNo;
            bsPatientCache.Phone       = bsPatient.Phone;
            bsPatientCache.AddressHome = bsPatient.AddressHome;
            bsPatientCache.BirthDate   = bsPatient.BirthDate;
            bsPatientCache.IsActive    = bsPatient.IsActive;
            bsPatientCache.Mobile      = bsPatient.Mobile;
            bsPatientCache.PyCode      = Orm.Utilities.PyWbHelper.SixBitPYCode(bsPatient.Name);
            bsPatientCache.WbCode      = Orm.Utilities.PyWbHelper.SixBitWBCode(bsPatient.Name);
            bsPatientCache.WebUserCode = bsPatientCache.WebUserCode;
            bsPatientCache.LastRegTime = bsPatient.ModiTime == DateTime.MinValue ? bsPatient.OperTime : bsPatient.ModiTime;
            bsPatientCache.DoctorName  = doctorName;
            bsPatientCache.VipLevel    = vipLevel;
            bsPatientCache.VipCardID   = vipCardId;
            bsPatientCache.VipCardNo   = vipCardNo;
            return(bsPatientCache);
        }
Пример #2
0
        public static List <BsRegTimeSpan> GetTimeSpanIDs(DateTime time)
        {
            var    lstbsRegTimeSpan = new List <BsRegTimeSpan>();
            var    bsRegTimeSpan    = UtilsLocCache.GetCacheAll <BsRegTimeSpan>().FindAll(t => t.IsActive);//Orm.Config.Service.DBClientService.GetAllList<BsRegTimeSpan>(); //CacheHelper.GetCacheList<BsRegTimeSpan>();
            string timeStr          = time.ToShortTimeString();

            if (bsRegTimeSpan.Count > 0)
            {
                lstbsRegTimeSpan = bsRegTimeSpan.FindAll(t => DateTime.Compare(Convert.ToDateTime(timeStr), Convert.ToDateTime(t.TimeBegin)) >= 0 && DateTime.Compare(Convert.ToDateTime(timeStr), Convert.ToDateTime(t.TimeEnd)) <= 0);
            }
            return(lstbsRegTimeSpan);
        }
Пример #3
0
 //����
 /// <summary>
 /// ��ȡ�����۸���Ϣ
 /// </summary>
 /// <param name="ItemId"></param>
 /// <param name="locationId"></param>
 /// <param name="lsInOut"></param>
 /// <param name="LsPriceState"></param>
 /// <returns></returns>
 public static double GetLocationPrice(string ItemId, string locationId, int lsInOut, int LsPriceState)
 {
     Model.BsLocation infoLocation = UtilsLocCache.GetCacheByID <Model.BsLocation>(locationId);
     Model.BsItem     infoItem     = UtilsLocCache.GetCacheByID <Model.BsItem>(ItemId);
     //if (Convert.ToBoolean(infoLocation.IsPriceSub) && LsPriceState == 1)
     //    return infoItem.PriceSub;
     // else
     if (lsInOut == 1)
     {
         return(infoItem.PriceDiag);
     }
     //else if (lsInOut == 2)
     //    return infoItem.PriceIn;
     return(0);
 }
Пример #4
0
        /// <summary>
        /// ͨ计算总量
        /// </summary>
        /// <param name="itemId"></param>
        /// <returns></returns>
        public static double GetYpTotality(OuRecipeDtl ouRecipeDtl)
        {
            try
            {
                var result = 1.00;
                if (ouRecipeDtl.Days == 0)
                {
                    return(ouRecipeDtl.Totality);
                }

                var    tempUnitRatio = new List <BsUnitRatio>();
                double _DrugRatio    = 1;
                if (AppSettings.IsMainLocation)
                {
                    tempUnitRatio = Orm.Config.Service.DBClientService.GetList <BsUnitRatio>("ItemId = @0 and HospitalId =@1 ", ouRecipeDtl.ItemID, (int)EnumMainLocation.总店);//unitDiagID, unitTakeId);
                    if (tempUnitRatio.Count > 0)
                    {
                        _DrugRatio = tempUnitRatio.First().DrugRatio;
                    }
                }
                else
                {
                    tempUnitRatio = Orm.Config.Service.DBClientService.GetList <BsUnitRatio>("ItemId = @0 and HospitalId =@1 ", ouRecipeDtl.ItemID, Config.UserProfiles.HospitalID);//unitDiagID, unitTakeId);
                }
                var frequency = UtilsLocCache.GetCacheByID <BsFrequency>(ouRecipeDtl.FrequencyId);
                if (tempUnitRatio.Count > 0 && frequency != null)
                {
                    var tempUnitRatioGuid = tempUnitRatio.First().GUID;
                    if (tempUnitRatio.First() != null && !string.IsNullOrWhiteSpace(tempUnitRatioGuid) && _DrugRatio != 0 && frequency != null)
                    {
                        var drugRatio    = _DrugRatio;
                        var fredays      = frequency.Days;
                        var actualdays   = Math.Round(Convert.ToDouble(ouRecipeDtl.Days / fredays), MidpointRounding.AwayFromZero);
                        var actualdosage = actualdays * frequency.Times * ouRecipeDtl.Dosage;
                        var actualResult = Math.Round(actualdosage / drugRatio, 4);
                        result = actualResult == 0 ? 1 : actualResult;
                    }
                }
                return(result);
            }
            catch (Exception)
            {
                return(ouRecipeDtl.Totality);
            }
        }
Пример #5
0
        /// <summary>
        /// ͨ����ɢ�Ȼ�ȡҩƷ����
        /// </summary>
        /// <param name="itemId"></param>
        /// <returns></returns>
        public static double GetYpTotality(string itemId, int days, double dosage, string frequencyId, string unitDiagID, string unitTakeId, double totality, int locationID = 0)
        {
            try
            {
                var result = 1.00;
                if (days == 0)
                {
                    return(totality);
                }

                var tempUnitRatio = new List <BsUnitRatio>();
                var unitRatio     = Orm.Config.Service.DBClientService.GetList <BsUnitRatio>("ItemId = @0 ", itemId);//unitDiagID, unitTakeId);
                if (locationID != 0)
                {
                    tempUnitRatio = unitRatio.FindAll(t => t.HospitalId == locationID);
                }

                if (tempUnitRatio.Count != 0)
                {
                    unitRatio = tempUnitRatio;
                }

                var frequency = UtilsLocCache.GetCacheByID <BsFrequency>(frequencyId);
                if (unitRatio.Count > 0 && frequency != null)
                {
                    if (unitRatio.First() != null && !string.IsNullOrWhiteSpace(unitRatio.First().GUID) && unitRatio.First().DrugRatio != 0 && frequency != null)
                    {
                        var drugRatio    = unitRatio.First().DrugRatio;
                        var fredays      = frequency.Days;
                        var actualdays   = Math.Round(Convert.ToDouble(days / fredays), MidpointRounding.AwayFromZero);
                        var actualdosage = actualdays * frequency.Times * dosage;
                        var actualResult = Math.Round(actualdosage / drugRatio, 4);
                        result = actualResult == 0 ? 1 : actualResult;
                    }
                }
                return(result);
            }
            catch (Exception)
            {
                return(totality);
            }
        }
Пример #6
0
        ////����
        ///// <summary>
        ///// ��ȡҽ���������
        ///// </summary>
        ///// <param name="itemId"></param>
        ///// <param name="tallyGroupId"></param>
        ///// <param name="memo"></param>
        ///// <returns></returns>
        //public static string GetYbDesc(int itemId, int tallyGroupId, string memo)
        //{
        //    List<Model.BsItemYb> lst;
        //    if (Convert.ToBoolean(GetSystemSetting("IsAllShowItemYbMemo")))
        //        lst = Orm.Config.Service.DBClientService.GetList<Model.BsItemYb>("ItemId = @0", itemId);
        //    else
        //        lst = Orm.Config.Service.DBClientService.GetList<Model.BsItemYb>("ItemId = @0  && TallyGroupId = @1",itemId, tallyGroupId);
        //    if (lst.Count > 0)
        //    {
        //        if (lst[0].LsYbType == 2)
        //        {
        //        }
        //        if (lst[0].LsYbType >= 3) return memo;
        //        memo += string.Format("��{0}", lst[0].LsYbType == 1 ? "����" : "����");
        //        if (lst[0].YBType != null)
        //            if (lst[0].YBType != null)
        //                memo += string.Format("��{0}", lst[0].YBType);
        //        if (memo.StartsWith("��"))
        //            memo = memo.Substring(1);
        //    }
        //    return memo;
        //}



        //����
        //public static bool CheckBeginCharge(string MzRegId)
        //{
        //    List<Model.RmSending> lstRmSending = Service.DBClientService.GetList<Model.RmSending>("MzRegId=@0", MzRegId);
        //    if (lstRmSending.Count > 0)
        //    {
        //        MessageBox.Show("��Ҫ�߳��IJ��˿��ܴ����շ�״̬,���Ժ����ԣ�", "ϵͳ��ʾ", MessageBoxButton.OK, MessageBoxImage.Information);
        //        return true;
        //    }
        //    return false;
        //}



        ////����
        ///// <summary>
        /////  �ж���ҽ�����ǹ��� IsGf���ѣ�IsYb ҽ��
        ///// </summary>
        ///// <param name="PatTypeId">BsPatType���е�ID</param>
        ///// <returns></returns>
        //public static Model.BsTallyGroup IsYb(int PatTypeId)
        //{
        //    var lstBsPatType = UtilsLocCache.GetCacheEntity<Model.BsPatType>(t => t.GUID == PatTypeId);
        //    var lstBsTallyType = UtilsLocCache.GetCacheEntity<Model.BsTallyType>(t => t.GUID == lstBsPatType.TallyTypeId);
        //    var lstBsTallyGroup = UtilsLocCache.GetCacheEntity<Model.BsTallyGroup>(t => t.GUID == lstBsTallyType.TallyGroupId);
        //    return lstBsTallyGroup;
        //}


        /// <summary>
        /// ����ʱ���ȡ���ID
        /// </summary>
        /// <param name="time">��ǰ����ʱ��</param>
        /// <returns></returns>
        public static string GetTimeSpanID(DateTime time)
        {
            string result = string.Empty;
            //���������
            var    bsRegTimeSpan = UtilsLocCache.GetCacheAll <BsRegTimeSpan>().Where(t => t.IsActive = true).ToList();
            string timeStr       = time.ToShortTimeString();

            if (bsRegTimeSpan.Count > 0)
            {
                var lstbsRegTimeSpan = bsRegTimeSpan.FindAll(t => DateTime.Compare(Convert.ToDateTime(timeStr), Convert.ToDateTime(t.TimeBegin)) >= 0 && DateTime.Compare(Convert.ToDateTime(timeStr), Convert.ToDateTime(t.TimeEnd)) <= 0);
                if (lstbsRegTimeSpan.Count > 0)
                {
                    result = lstbsRegTimeSpan.FirstOrDefault().GUID;
                }
                else
                {
                    result = string.Empty;
                }
            }
            return(result);
        }