Ejemplo n.º 1
0
        public void AddOrUpdateRule(DoctorRules rule)
        {
            string cmd = String.Empty;

            var param = new Dictionary <string, object>()
            {
                { "@NAME", rule.RuleName },
                { "@HOUR_START", rule.HourStart },
                { "@HOUR_END", rule.HourFinish },
                { "@PERIOD_START", rule.PeriodStart },
                { "@PERIOD_END", rule.PeriodFinish },
                { "@INCLUSIVE", rule.IfInclusive },
                { "@SUNDAY", rule.Week[DayOfWeek.Sunday] },
                { "@MONDAY", rule.Week[DayOfWeek.Monday] },
                { "@TUESDAY", rule.Week[DayOfWeek.Tuesday] },
                { "@WEDNESDAY", rule.Week[DayOfWeek.Wednesday] },
                { "@THIRSDAY", rule.Week[DayOfWeek.Thursday] },
                { "@FRIDAY", rule.Week[DayOfWeek.Friday] },
                { "@SATURDAY", rule.Week[DayOfWeek.Saturday] },
            };

            if (rule.IdRule < 0)
            {
                cmd = "ADD_RULE";
            }
            else
            {
                cmd = "UPDATE_RULE";
                param.Add("@ID", rule.IdRule);
            }

            _dbContext.ExecuteSqlQuery(cmd, param);
        }
Ejemplo n.º 2
0
        public static List <DoctorRules> GetRules(string str)
        {
            var values = str.Split('*');
            var list   = new List <DoctorRules>();

            for (int i = 0; i < (values.Length - 1); i += 14)
            {
                var doctorRule = new DoctorRules()
                {
                    IdRule       = Convert.ToInt32(values.GetValue(i).ToString()),
                    RuleName     = values.GetValue(i + 1).ToString(),
                    HourStart    = TimeSpan.Parse(values.GetValue(i + 2).ToString()),
                    HourFinish   = TimeSpan.Parse(values.GetValue(i + 3).ToString()),
                    PeriodStart  = DateTime.Parse(values.GetValue(i + 4).ToString()),
                    PeriodFinish = DateTime.Parse(values.GetValue(i + 5).ToString()),
                    IfInclusive  = Convert.ToBoolean(values.GetValue(i + 6)),
                    Week         = new Dictionary <DayOfWeek, bool>()
                    {
                        { DayOfWeek.Sunday, Convert.ToBoolean(values.GetValue(i + 7).ToString().ToLowerInvariant()) },
                        { DayOfWeek.Monday, Convert.ToBoolean(values.GetValue(i + 8).ToString().ToLowerInvariant()) },
                        { DayOfWeek.Tuesday, Convert.ToBoolean(values.GetValue(i + 9).ToString().ToLowerInvariant()) },
                        { DayOfWeek.Wednesday, Convert.ToBoolean(values.GetValue(i + 10).ToString().ToLowerInvariant()) },
                        { DayOfWeek.Thursday, Convert.ToBoolean(values.GetValue(i + 11).ToString().ToLowerInvariant()) },
                        { DayOfWeek.Friday, Convert.ToBoolean(values.GetValue(i + 12).ToString().ToLowerInvariant()) },
                        { DayOfWeek.Saturday, Convert.ToBoolean(values.GetValue(i + 13).ToString().ToLowerInvariant()) }
                    },
                };
                list.Add(doctorRule);
            }
            return(list);
        }
Ejemplo n.º 3
0
 public DoctorRulesDetailView(DoctorRules rules)
 {
     RulesType       = rules.RulesType;
     RulesTitle      = rules.RulesTitle;
     RulesContent    = rules.RulesContent;
     ApplyClinicName = rules.ApplyClinicName;
     ApplyClinicID   = rules.ApplyClinicID.TrimStart(',').TrimEnd(',');
     ImageFie        = rules.ImageFie;
     Id        = rules.Id;
     CreatedBy = rules.CreatedBy;
     CreatedOn = rules.CreatedOn;
 }
Ejemplo n.º 4
0
        public async Task <ObjectResultModule> DeleteDoctorRules([FromBody] DoctorRules DoctorRulesInfo)
        {
            if (!Commons.CheckSecret(DoctorRulesInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var query  = await _doctorRulesService.DoctorRulesByID(DoctorRulesInfo.Id);

            if (query != null)
            {
                query.DeleteBy   = userid;
                query.DeleteTime = DateTime.Now;
                query.IsDelete   = true;
                var res = await _doctorRulesService.DeleteDoctorRules(query);

                this.ObjectResultModule.Object     = res;
                this.ObjectResultModule.Message    = "sucess";
                this.ObjectResultModule.StatusCode = 200;
            }
            else
            {
                this.ObjectResultModule.Message    = "NotFound";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Object     = "";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "DeleteDoctorRules",
                OperContent = JsonHelper.ToJson(DoctorRulesInfo),
                OperType    = "DeleteDoctorRules",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(this.ObjectResultModule);
        }
Ejemplo n.º 5
0
        public List <DoctorRules> GetDoctorAllRules(int doctorId, DateTime dateStart, DateTime dateFinish)
        {
            if ((dateFinish.DayOfYear - dateStart.DayOfYear) < 6)
            {
                dateFinish = dateStart;
            }
            const string cmd   = "SELECT_RULES";
            var          param = new Dictionary <string, object>()
            {
                { "@FROM", dateStart },
                { "@TILL", dateFinish },
                { "@IDDOCTOR", doctorId }
            };
            var str    = _dbContext.ExecuteSqlQuery(cmd, '*', param);
            var result = new List <DoctorRules>();
            var values = str.Split('*');

            for (int i = 0; i < (values.Length - 1); i += 15)
            {
                var doctorRule = new DoctorRules()
                {
                    RuleName     = values.GetValue(0 + i).ToString(),
                    HourStart    = TimeSpan.Parse(values.GetValue(1 + i).ToString()),
                    HourFinish   = TimeSpan.Parse(values.GetValue(2 + i).ToString()),
                    PeriodStart  = DateTime.Parse(values.GetValue(3 + i).ToString()),
                    PeriodFinish = DateTime.Parse(values.GetValue(4 + i).ToString()),
                    IfInclusive  = bool.Parse(values.GetValue(5 + i).ToString()),
                    Week         = new Dictionary <DayOfWeek, bool>
                    {
                        { DayOfWeek.Sunday, bool.Parse(values.GetValue(6 + i).ToString()) },
                        { DayOfWeek.Monday, bool.Parse(values.GetValue(7 + i).ToString()) },
                        { DayOfWeek.Tuesday, bool.Parse(values.GetValue(8 + i).ToString()) },
                        { DayOfWeek.Wednesday, bool.Parse(values.GetValue(9 + i).ToString()) },
                        { DayOfWeek.Thursday, bool.Parse(values.GetValue(10 + i).ToString()) },
                        { DayOfWeek.Friday, bool.Parse(values.GetValue(11 + i).ToString()) },
                        { DayOfWeek.Saturday, bool.Parse(values.GetValue(12 + i).ToString()) }
                    },
                };
                result.Add(doctorRule);
            }
            return(result);
        }
Ejemplo n.º 6
0
 public void AddOrUpdate(Models.RuleBindingModel model)
 {
     try
     {
         DoctorRules rule = new DoctorRules()
         {
             IdRule       = model.IdRule,
             RuleName     = model.RuleName,
             HourStart    = model.HourStart,
             HourFinish   = model.HourFinish,
             PeriodStart  = model.PeriodStart,
             PeriodFinish = model.PeriodFinish,
             IfInclusive  = model.IfInclusive,
             Week         = model.Week
         };
         _ruleService.AddOrUpdateRule(rule);
     }
     catch (Exception e)
     {
         string message = e.Message;
     }
 }
Ejemplo n.º 7
0
        public async Task <ObjectResultModule> CreateDoctorRules([FromBody] DoctorRules DoctorRulesInfo)
        {
            if (!Commons.CheckSecret(DoctorRulesInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;

            //ApplyClinicID 前段按照1,2,3,4格式返回后端

            string[] IDArray = null; int[] iNums = null;
            if (!string.IsNullOrEmpty(DoctorRulesInfo.ApplyClinicID))
            {
                IDArray = DoctorRulesInfo.ApplyClinicID.TrimEnd(',').Split(',');
            }
            if (IDArray.Length < 1)
            {
                return(new ObjectResultModule("", 400, "医生制度必须选择科室!"));
            }
            //转换方法
            iNums = Array.ConvertAll <string, int>(IDArray, s => int.Parse(s));

            var clin       = new ClinicInfomationIn(); clin.AndAlso(t => !t.IsDelete);
            var clinicinfo = await _clinicInfomationService.ClinicInfomationListByArrId(clin, iNums.ToList());

            string clinicname = "";

            foreach (var item in clinicinfo)
            {
                string ClinicType = item.ClinicType == 1 ? "(成人)" : "(儿童)";
                clinicname += item.ClinicName + ClinicType + ",";
            }
            var CreateDoctorRules = new DoctorRules()
            {
                RulesType       = DoctorRulesInfo.RulesType,
                RulesTitle      = DoctorRulesInfo.RulesTitle,
                RulesContent    = DoctorRulesInfo.RulesContent,
                ApplyClinicName = clinicname.TrimEnd(','),
                ImageFie        = DoctorRulesInfo.ImageFie,
                ApplyClinicID   = "," + DoctorRulesInfo.ApplyClinicID.TrimEnd(',') + ",",
                CreatedBy       = userid,
                CreatedOn       = DateTime.Now
            };
            var result = await _doctorRulesService.CreateDoctorRules(CreateDoctorRules);

            if (result.Id > 0)
            {
                this.ObjectResultModule.Object     = result;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            else
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 400;
                this.ObjectResultModule.Message    = "error!";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "CreateDoctorRules",
                OperContent = JsonHelper.ToJson(DoctorRulesInfo),
                OperType    = "CreateDoctorRules",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
Ejemplo n.º 8
0
        public DoctorRules CompareDoctorRules(DoctorRules exRule, DoctorRules inRule)
        {
            var list = new DoctorRules();

            return(list);
        }
Ejemplo n.º 9
0
 public async Task <DoctorRules> DeleteDoctorRules(DoctorRules DoctorRulesInfo)
 {
     return(await _repository.UpdateAsync(DoctorRulesInfo));
 }
Ejemplo n.º 10
0
        public async Task <DoctorRules> CreateDoctorRules(DoctorRules DoctorRulesInfo)
        {
            DoctorRulesInfo.Id = await _repository.InsertAndGetIdAsync(DoctorRulesInfo);

            return(DoctorRulesInfo);
        }