Пример #1
0
        public async Task <ObjectResultModule> UpdateDoctorScheduling([FromBody] DoctorSchedulingInAdd input)
        {
            if (!Commons.CheckSecret(input.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 _DoctorSchedulingService.DoctorSchedulingByID(input.Id);

            var param = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };

            param.AndAlso(t => !t.IsDelete && t.SystemCode == "DoctorSchedulingTime");
            var paramlist = await _systemParameterService.ParameterList(param);

            var timelist = new List <CodeList>();

            foreach (var item in input.SchedulingTimeList)
            {
                var codelist = paramlist.Find(t => t.Code == item.Code);
                var newcode  = new CodeList()
                {
                    Code = codelist.Code, Value = codelist.Name, Type = codelist.SystemType, TypeCode = codelist.SystemCode
                };
                timelist.Add(newcode);
            }
            param = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };
            param.AndAlso(t => !t.IsDelete && t.SystemCode == "DoctorSchedulingType");
            var typelist = await _systemParameterService.ParameterList(param);

            var type     = typelist.Find(t => t.Code == input.Duplication);
            var typecode = new CodeList()
            {
                Code = type.Code, Value = type.Name, Type = type.SystemType, TypeCode = type.SystemCode
            };

            param = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };
            param.AndAlso(t => !t.IsDelete && t.SystemCode == "DoctorSchedulingState");
            var statelist = await _systemParameterService.ParameterList(param);

            var state     = statelist.Find(t => t.Code == input.ClinicType);
            var statecode = new CodeList()
            {
                Code = state.Code, Value = state.Name, Type = state.SystemType, TypeCode = state.SystemCode
            };

            if (query != null && query.CreatedBy == userid)
            {
                query.SchedulingDate  = input.SchedulingDate;
                query.SchedulingTime  = JsonHelper.ToJson(timelist);
                query.Duplication     = JsonHelper.ToJson(typecode);
                query.ClinicType      = JsonHelper.ToJson(statecode);
                query.ClinicIDAdd     = input.ClinicIDAdd;
                query.RegistrationFee = input.RegistrationFee;
                query.ServiceState    = input.ServiceState;
                query.ModifyOn        = DateTime.Now;
                query.ModifyBy        = userid;
                var res = await _DoctorSchedulingService.UpdateDoctorScheduling(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 = "UpdateDoctorScheduling",
                OperContent = JsonHelper.ToJson(input),
                OperType    = "UpdateDoctorScheduling",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }
Пример #2
0
        public async Task <ObjectResultModule> CreateDoctorScheduling([FromBody] DoctorSchedulingInAdd input)
        {
            if (!Commons.CheckSecret(input.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 doctor = await _YaeherDoctorService.YaeherDoctorByUserID(userid);

            if (doctor == null)
            {
                this.ObjectResultModule.StatusCode = 100;
                this.ObjectResultModule.Message    = "该角色不是医生账号,不可排班!";
                this.ObjectResultModule.Object     = "";
            }
            var param = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };

            param.AndAlso(t => !t.IsDelete && t.SystemCode == "DoctorSchedulingTime");
            var paramlist = await _systemParameterService.ParameterList(param);

            var timelist = new List <CodeList>();

            foreach (var item in input.SchedulingTimeList)
            {
                var codelist = paramlist.Find(t => t.Code == item.Code);
                var newcode  = new CodeList()
                {
                    Code = codelist.Code, Value = codelist.Name, Type = codelist.SystemType, TypeCode = codelist.SystemCode
                };
                timelist.Add(newcode);
            }

            param = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };
            param.AndAlso(t => !t.IsDelete && t.SystemCode == "DoctorSchedulingType");
            var typelist = await _systemParameterService.ParameterList(param);

            var type     = typelist.Find(t => t.Code == input.Duplication);
            var typecode = new CodeList()
            {
                Code = type.Code, Value = type.Name, Type = type.SystemType, TypeCode = type.SystemCode
            };

            param = new SystemParameterIn()
            {
                Type = "ConfigPar"
            };
            param.AndAlso(t => !t.IsDelete && t.SystemCode == "DoctorSchedulingState");
            var statelist = await _systemParameterService.ParameterList(param);

            var state     = statelist.Find(t => t.Code == input.ClinicType);
            var statecode = new CodeList()
            {
                Code = state.Code, Value = state.Name, Type = state.SystemType, TypeCode = state.SystemCode
            };

            var create = new DoctorScheduling()
            {
                DoctorName      = doctor.DoctorName,
                DoctorID        = doctor.Id,
                DoctorJSON      = JsonHelper.ToJson(doctor),
                SchedulingDate  = input.SchedulingDate,
                SchedulingTime  = JsonHelper.ToJson(timelist),
                Duplication     = JsonHelper.ToJson(typecode),
                ClinicType      = JsonHelper.ToJson(statecode),
                ClinicIDAdd     = input.ClinicIDAdd,
                RegistrationFee = input.RegistrationFee,
                ServiceState    = input.ServiceState,
                CreatedBy       = userid,
                CreatedOn       = DateTime.Now
            };
            var res = await _DoctorSchedulingService.CreateDoctorScheduling(create);

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

            #endregion

            return(this.ObjectResultModule);
        }