public CommonOutputData <object> SetUpDayDeptSourceMaxCount(string userId, string hospitalId, string deptCode, int?sourceCount = null)
        {
            try
            {
                #region "入参校验"
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }
                if (string.IsNullOrEmpty(deptCode))
                {
                    return(returnMsg <CommonOutputData <object> >("科室编码不能为空"));
                }
                if (service.CheckClinic(hospitalId, deptCode) == null)
                {
                    return(returnMsg <CommonOutputData <object> >("科室信息中不存在该科室编码"));
                }
                #endregion


                service.SetUpDayDeptSourceMaxCount(userId, hospitalId, deptCode, sourceCount);
                return(CommonOutputData <object> .Success());
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error(ex));
            }
        }
        public CommonOutputData <object> SaveSurgerySystemConfig(List <t_day_surgical_system_config> info, string userId, string hospitalId)
        {
            try
            {
                #region "入参校验"
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }

                #endregion

                var result = service.SaveSurgerySystemConfig(info, userId, hospitalId);
                return(result);
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error("失败"));
            }
        }
        public CommonOutputData <object> UpdateSurgerySystemConfig(string surgeryConfigId, string configValue, string hospitalId, string userId)
        {
            try
            {
                #region "入参校验"
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }

                if (service.CheckIsExistBookBedNumber(surgeryConfigId, hospitalId, configValue))
                {
                    return(returnMsg <CommonOutputData <object> >("床位已经被预约,不可更改比当前更小的床位数"));
                }

                #endregion



                var result = service.UpdateSurgerySystemConfig(surgeryConfigId, configValue, hospitalId, userId);
                return(result);
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error("失败"));
            }
        }
        public CommonOutputData <object> InitDeptSourceCount(string hospitalId)
        {
            try
            {
                #region "入参校验"
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }

                #endregion


                service.GetInitDeptSourceCount(hospitalId);
                return(CommonOutputData <object> .Success());
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error(ex));
            }
        }
 public CommonOutputData <string> GetReSendMessageContent(string hospitalId, string surgeryBookId, string type = "0")
 {
     try
     {
         var result = service.GetReSendMessageContent(hospitalId, surgeryBookId, type);
         return(CommonOutputData <string> .Success(result));
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <string> .Error(ex.Message));
     }
 }
        public CommonOutputData <object> SaveDaySurgeryTypeName(string modelStr, string hospitalId, string userId)
        {
            try
            {
                var model = JsonConvert.DeserializeObject <t_day_surgical_name>(modelStr);
                #region "入参校验"
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }
                if (string.IsNullOrEmpty(userId))
                {
                    return(returnMsg <CommonOutputData <object> >("操作人不能为空", ErrCode.ERR_UserID_IsNull));
                }
                if (string.IsNullOrEmpty(model.DeptCode))
                {
                    return(returnMsg <CommonOutputData <object> >("科室编码不能为空"));
                }

                if (string.IsNullOrWhiteSpace(model.OperativeDiseases))
                {
                    return(CommonOutputData <object> .Error("手术名称不能为空"));
                }
                #endregion



                if (string.IsNullOrWhiteSpace(model.ID))
                {
                    model.CreateUser = userId;
                    bool IsExistName = service.CheckIsExistDaySurgeryeName(hospitalId, model.DeptCode, model.OperativeDiseases.Trim());
                    if (IsExistName)
                    {
                        return(CommonOutputData <object> .Error("手术名称已存在"));
                    }
                }
                model.UpdateUser = userId;
                var result = service.SaveDaySurgeryTypeName(model, hospitalId);
                return(result);
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error("失败"));
            }
        }
 public CommonOutputData <List <t_day_surgical_system_config> > GetSurgerySystemConfig(String hospitalID)
 {
     try
     {
         var result = service.GetSurgerySystemConfig(hospitalID);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <List <t_day_surgical_system_config> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <List <t_day_surgical_system_config> > .Error("失败"));
     }
 }
 public CommonOutputData <JObject> GetSurgeryDetailInfo(string surgeryBookId)
 {
     try
     {
         var result = service.GetSurgeryDetailInfo(surgeryBookId);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <JObject> .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <JObject> .Error("失败"));
     }
 }
 public CommonOutputData <List <t_day_surgical_name> > GetDaySurgeryNameByDeptCode(string hospitalID, string deptCode)
 {
     try
     {
         var result = service.GetDaySurgeryNameByDeptCode(hospitalID, deptCode);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <List <t_day_surgical_name> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <List <t_day_surgical_name> > .Error("失败"));
     }
 }
 public CommonOutputData <IList <DoctorInfoDTO> > GetDoctorInfo(string hospitalId, int pageIndex, int pageSize, string doctorName = "", string deptId = "")
 {
     try
     {
         var result = service.GetDoctorInfo(hospitalId, pageIndex, pageSize, doctorName, deptId);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <IList <DoctorInfoDTO> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <IList <DoctorInfoDTO> > .Error(ex));
     }
 }
 public CommonOutputData <List <t_day_dept_source_config> > GetDayDeptSourceMaxCountList(string hospitalId, int pageIndex, int pageSize)
 {
     try
     {
         var result = service.GetDayDeptSourceMaxCountList(hospitalId, pageIndex, pageSize);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <List <t_day_dept_source_config> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <List <t_day_dept_source_config> > .Error("失败"));
     }
 }
 public CommonOutputData <List <JObject> > GetDeptSourceList(string hospitalID, string deptCode)
 {
     try
     {
         var result = service.GetDeptSourceList(hospitalID, deptCode);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <List <JObject> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <List <JObject> > .Error("失败"));
     }
 }
 public CommonOutputData <List <JObject> > GetInHospitalPatientList(String hospitalID)
 {
     try
     {
         var result = service.GetInHospitalPatientList(hospitalID);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <List <JObject> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <List <JObject> > .Error("失败"));
     }
 }
 public CommonOutputData <List <t_day_surgical_name> > GetDaySurgeryTypeNameList(string hospitalID, string deptCode = "", int PageNo = 1, int OnePageCount = 10)
 {
     try
     {
         var result = service.GetDaySurgeryTypeNameList(hospitalID, deptCode, PageNo, OnePageCount);
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <List <t_day_surgical_name> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <List <t_day_surgical_name> > .Error("失败"));
     }
 }
        public CommonOutputData <object> SynchronizedClinicAndDoctor(string userId, string hospitalId)
        {
            try
            {
                #region 入参检验

                if (string.IsNullOrEmpty(userId))
                {
                    return(returnMsg <CommonOutputData <object> >("用户ID不能为空", ErrCode.ERROR));
                }
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }

                #endregion

                var service = new DaySurgeryService();

                //var _dalSystemManage = new Dal_SystemManage();

                ////同步科室数据 并拿到科室的id 列表返回值
                //var rsClinicId = _dalSystemManage.SynchronizedClinic(hospitalId).ListClinic.Select(n => n.ThirdClinicID).ToList();

                ////同步医生数据
                //rsClinicId.ForEach(item =>
                //{
                //    _dalSystemManage.SynchronizedDoctor(hospitalId, item, false);
                //});

                return(CommonOutputData <object> .Success());
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error(ex));
            }
        }
 public CommonOutputData <List <t_day_surgical_book_infoEx> > GetSurgeryBookList(string hospitalID, int PageNo = 1, int OnePageCount = 10, string userId = "", string deptCode = "", string ipoNumber = "", string patientName = "", string startDate = "", string endDate = "", string status = "", string listType = "")
 {
     try
     {
         var totalCount = 0;
         var result     = service.GetSurgeryBookList(hospitalID, userId, deptCode, ipoNumber, patientName, startDate, endDate, listType, status, PageNo, OnePageCount, ref totalCount);
         result.Head.TotalCount = totalCount;
         result.Head.PageNo     = PageNo;
         return(result);
     }
     catch (ParmsException ex)
     {
         return(CommonOutputData <List <t_day_surgical_book_infoEx> > .Error(ex.Message));
     }
     catch (Exception ex)
     {
         Logger.Default.Error("", ex);
         return(CommonOutputData <List <t_day_surgical_book_infoEx> > .Error("失败"));
     }
 }
        public CommonOutputData <List <t_clinic> > GetClinicList(string hospitalId)
        {
            try
            {
                var rs = new CommonOutputData <List <t_clinic> >();

                var result = service.GetClinicList(hospitalId).ToList();
                rs.ret_data = result;
                return(rs);
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <List <t_clinic> > .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <List <t_clinic> > .Error("失败"));
            }
        }
        /// <summary>
        /// 接口运行前
        /// </summary>
        /// <param name="ctx">请求</param>
        public override void OnActionExecuting(ActionExecutingContext ctx)
        {
            base.OnActionExecuting(ctx);
            IList <RequestModel> parals = new List <RequestModel>();

            foreach (var v in ctx.ActionArguments)
            {
                parals.Add(new RequestModel(v.Key, v.Value));
            }

            Dal_FilterAttribute serviceFilter = new Dal_FilterAttribute();

            var hashosptialid = ctx.ActionArguments.Any(n => n.Key.ToUpper() == "HospitalID".ToUpper());

            if (hashosptialid)
            {
                var hosptialid = ctx.ActionArguments.First(n => n.Key.ToUpper() == "HospitalID".ToUpper()).Value.ToString();
                //验证院区id
                var result = serviceFilter.HasHosptial(hosptialid);
                if (result.Item1 == false)
                {
                    var res = CommonOutputData <object> .Error("院区验证失败:" + result.Item2);

                    ctx.HttpContext.Response.ContentType = "application/json;charset=utf-8";
                    ctx.HttpContext.Response.WriteAsync(JsonConvert.SerializeObject(res));
                    ctx.Result = new EmptyResult();
                    return;
                    //throw new ParmsException("院区验证失败:" + result.Item2);
                }

                var info = new FilterModel();
                //记录用户Id
                info.UserId     = ctx.ActionArguments.Any(n => n.Key.ToUpper() == "UserID".ToUpper()) ? ctx.ActionArguments.Where(n => n.Key.ToUpper() == "UserID".ToUpper()).FirstOrDefault().Value.ToString() : string.Empty;
                info.HospitalId = hosptialid;
                ////接口调用uri
                info.AbsoluteUri = ctx.HttpContext.Request.Host + ctx.HttpContext.Request.Path + ctx.HttpContext.Request.QueryString.ToString();
                ////接口调用绝对路径
                info.AbsolutePath = ctx.HttpContext.Request.Path;
                serviceFilter.SaveInterfaceInvokeRecord(info);
            }
        }
        public CommonOutputData <object> SetUpDaySurgerySourceCount(string userId, string hospitalId, string week, int?sourceCount = 0)
        {
            try
            {
                #region "入参校验"
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }
                #endregion
                sourceCount = sourceCount == null ? 0 : sourceCount;

                service.SetUpSurgerySourceConfig(userId, hospitalId, week, sourceCount);
                return(CommonOutputData <object> .Success());
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error(ex));
            }
        }
Example #20
0
        /// <summary>
        /// 错误记录过滤器
        /// </summary>
        /// <param name="actionExecutedContext"></param>
        public override void OnException(ExceptionContext actionExecutedContext)
        {
            base.OnException(actionExecutedContext);
            if (actionExecutedContext.Exception != null)
            {
                LogManage.LogError(actionExecutedContext.Exception.Message);
                LogManage.LogError(actionExecutedContext.Exception.StackTrace);
            }
            var errmsg = string.Empty;

            if (actionExecutedContext.Exception is ParmsException)
            {
                var e = actionExecutedContext.Exception as ParmsException;
                errmsg = e.Message;
            }

            var err = string.Empty;

            if (errmsg.IsNullOrEmpty())
            {
                err = JsonConvert.SerializeObject(CommonOutputData <List <object> > .Error());
            }
            else
            {
                err = JsonConvert.SerializeObject(CommonOutputData <List <object> > .Error(errmsg, BookingPlatform.Common.MyEnum.ErrCode.ERROR));
            }
            ContentResult result = new ContentResult
            {
                StatusCode  = 500,
                ContentType = "text/json;charset=utf-8;"
            };

            //actionExecutedContext.HttpContext = new HttpResponseMessage(System.Net.HttpStatusCode.OK)
            //{
            // Content = new StringContent(err, System.Text.Encoding.UTF8, "application/json")
            //};
            actionExecutedContext.Result = result;
        }
        public CommonOutputData <object> DeleteDaySurgeryTypeNameById(string surgeryIdStr)
        {
            try
            {
                String[] split = surgeryIdStr.Split(',');
                for (int i = 0; i < split.Length; i++)
                {
                    var surgeryId = split[i];
                    service.DeleteDaySurgeryTypeNameById(surgeryId);
                }

                return(CommonOutputData <object> .Success());
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error("失败"));
            }
        }
        public CommonOutputData <object> ReSendMessage(string hospitalId, string userId, string surgeryBookId, string content)
        {
            #region 数据校验
            if (string.IsNullOrWhiteSpace(userId))
            {
                return(CommonOutputData <object> .Error("用户异常,请重新登录!"));
            }
            if (string.IsNullOrWhiteSpace(hospitalId))
            {
                return(CommonOutputData <object> .Error("医院组织机构代码不能为空!"));
            }
            if (string.IsNullOrWhiteSpace(surgeryBookId))
            {
                return(CommonOutputData <object> .Error("申请记录ID必能为空!"));
            }
            if (string.IsNullOrWhiteSpace(surgeryBookId))
            {
                return(CommonOutputData <object> .Error("补发短信内容不能为空!"));
            }
            #endregion

            var rs = new CommonOutputData <object>();
            try
            {
                var result = service.ReSendMessage(hospitalId, userId, surgeryBookId, content);
                return(CommonOutputData <object> .Success());
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                return(CommonOutputData <object> .Error(ex));
            }
        }
        public CommonOutputData <object> SaveSurgeryBookInfo(string modelStr, string hospitalId, string userId)
        {
            try
            {
                var model = JsonConvert.DeserializeObject <t_day_surgical_book_infoEx>(modelStr);


                #region "入参校验"
                if (string.IsNullOrEmpty(hospitalId))
                {
                    return(returnMsg <CommonOutputData <object> >("医院ID不能为空", ErrCode.ERR_HospitalID));
                }
                if (string.IsNullOrEmpty(userId))
                {
                    return(returnMsg <CommonOutputData <object> >("操作人不能为空", ErrCode.ERR_UserID_IsNull));
                }
                if (string.IsNullOrWhiteSpace(model.PatientName))
                {
                    return(CommonOutputData <object> .Error("患者姓名不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.Sex))
                {
                    return(CommonOutputData <object> .Error("患者性别不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.Phone))
                {
                    return(CommonOutputData <object> .Error("手机号不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.IdNo))
                {
                    return(CommonOutputData <object> .Error("身份证号不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.InpNo))
                {
                    return(CommonOutputData <object> .Error("住院号不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.OperationName))
                {
                    return(CommonOutputData <object> .Error("手术名称不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.IncisionLocation))
                {
                    return(CommonOutputData <object> .Error("切口位置不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.OperationSurgeonName))
                {
                    return(CommonOutputData <object> .Error("主刀医师不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.OperativeFreezing))
                {
                    return(CommonOutputData <object> .Error("手术冰冻不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.AnesthesiaDoctorName))
                {
                    return(CommonOutputData <object> .Error("麻醉师不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.AnesthesiaMethod))
                {
                    return(CommonOutputData <object> .Error("麻醉方法不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.PreoperativeDiagnosis))
                {
                    return(CommonOutputData <object> .Error("术前诊断不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.ApplyDeptName))
                {
                    return(CommonOutputData <object> .Error("申请科室不能为空"));
                }
                if (string.IsNullOrWhiteSpace(model.ApplyDeptName))
                {
                    return(CommonOutputData <object> .Error("申请医生不能为空"));
                }
                //检查是否有相同的病例号
                if (string.IsNullOrWhiteSpace(model.PatientID))
                {
                    return(CommonOutputData <object> .Error("病例号不能为空"));
                }
                if (service.CheckExistPatientID(hospitalId, model.PatientID))
                {
                    return(CommonOutputData <object> .Error("该病历号已存在"));
                }
                #endregion

                var result = service.SaveSurgeryBookInfo(model, hospitalId, userId);
                return(result);
            }
            catch (ParmsException ex)
            {
                return(CommonOutputData <object> .Error(ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Default.Error("", ex);
                return(CommonOutputData <object> .Error("失败"));
            }
        }