Ejemplo n.º 1
0
        public string SaveConsultationInfo()
        {
            return(base.ExecuteActionJsonResult("会诊单信息保存", () =>
            {
                CD_Consultation entity = base.GetPageData <CD_Consultation>(0);
                if (!string.IsNullOrWhiteSpace(entity.InpatientId))
                {
                    CD_Inpatient inpatient = EntityOperate <CD_Inpatient> .GetEntityById(Request["InpatientId"], "InpatientId");
                    if (string.IsNullOrWhiteSpace(entity.ConsultationId) || entity.ConsultationId == "null")
                    {
                        entity.ConsultationState = "1";
                        entity.DeptId = inpatient.CurrentDeptID;
                        entity.WardId = inpatient.CurrentWardID;
                        entity.RequesterCode = UserTokenManager.GetUserToken(Request["token"]).UserId;
                        GI_UserInfo user = EntityOperate <GI_UserInfo> .GetEntityById(entity.RequesterCode, "USERID");
                        entity.RequestDepartCode = user.DpetID;
                        entity.OrganID = UserTokenManager.GetUserToken(Request["token"]).ORGANID;
                    }

                    entity.Del = 0;
                    service.SaveInfo(entity);
                    msgHub hub = new msgHub();
                    // hub.SendGroup(entity.ApplyDepartCode, "Con", "",  "");
                }
                return new WebApi_Result();
            }));
        }
Ejemplo n.º 2
0
 public string SaveInfo()
 {
     return(base.ExecuteActionJsonResult("医生分组保存", () =>
     {
         AI_DoctorGroup entity = base.GetPageData <AI_DoctorGroup>(0);
         entity.DoctorGroupId = string.IsNullOrWhiteSpace(entity.DoctorGroupId) ? null : entity.DoctorGroupId;
         entity.UpdateTime = DateTime.Now;
         entity.Updater = UserTokenManager.GetUserToken(Request["token"]).UserId;
         entity.OrganID = UserTokenManager.GetUserToken(Request["token"]).ORGANID;
         doctorGroupService.SaveInfo(entity);
         return new WebApi_Result();
     }));
 }
        /// <summary>
        /// 增加和保存数据
        /// </summary>
        /// <returns></returns>
        public string SaveInfo()
        {
            return(base.ExecuteActionJsonResult("保存信息", () =>
            {
                CD_FormEmrTemplate entity = base.GetPageData <CD_FormEmrTemplate>(0);
                entity.TemplateId = string.IsNullOrWhiteSpace(entity.TemplateId) ? null : entity.TemplateId;
                entity.ParentId = string.IsNullOrWhiteSpace(entity.ParentId) ? null : entity.ParentId;
                entity.CreateTime = DateTime.Now;
                entity.Creator = UserTokenManager.GetUserToken(Request["token"]).UserId;

                formEmrTemplateService.SaveInfo(entity);
                return new WebApi_Result();
            }));
        }
        /// <summary>
        /// 保存诊断数据
        /// </summary>
        /// <returns></returns>
        public string SaveInfo()
        {
            return(base.ExecuteActionJsonResult("诊断保存", () =>
            {
                CD_PatientDiagnosis entity = base.GetPageData <CD_PatientDiagnosis>(0);
                CD_HospitalRecord hospitalRecord = hospitalrecordservice.GetInfoByInpatientId(entity.InpatientId);
                if (hospitalRecord == null)
                {
                    return new WebApi_Result()
                    {
                        code = 0, msg = "请先保存入院记录"
                    };
                }

                entity.ICDCode = string.IsNullOrWhiteSpace(entity.ICDCode) ? null : entity.ICDCode;
                var DiagnosisIdList = (entity.DiagnosisId + "").Split(',');
                for (int i = 0; i < entity.ICDCode.Split(',').Length; i++)
                {
                    var cur_entity = base.GetPageData <CD_PatientDiagnosis>(0);
                    if (DiagnosisIdList.Length > i)
                    {
                        cur_entity.DiagnosisId = DiagnosisIdList[i];
                    }
                    else
                    {
                        cur_entity.DiagnosisId = "";
                    }
                    cur_entity.ParentId = string.IsNullOrWhiteSpace(cur_entity.ParentId) ? "0" : cur_entity.ParentId;
                    cur_entity.ICDCode = entity.ICDCode.Split(',')[i];
                    cur_entity.DiagnosisName = entity.DiagnosisName.Split(',')[i];
                    UserToken ut = UserTokenManager.GetUserToken(Request["token"]);
                    cur_entity.RecordUserId = cur_entity.Creator = ut.UserId;
                    cur_entity.RecordUserName = ut.USERNAME;
                    if (cur_entity.DiagnosisTime == null)
                    {
                        cur_entity.DiagnosisTime = DateTime.Now;
                    }


                    //病历记录id
                    cur_entity.RecordId = hospitalRecord.HospitalRecordId;

                    patientDiagnosisService.SaveInfo(cur_entity);
                }
                return new WebApi_Result();
            }));
        }
Ejemplo n.º 5
0
        //TODO:具体的权限实现方法
        /// <summary>
        /// 权限验证方法
        /// </summary>
        /// <param name="actionContext">Web请求</param>
        /// <returns>返回是否通过验证</returns>
        public static bool ValidateHandler(HttpActionContext actionContext)
        {
            //var token = HttpContext.Current.Request.Headers["Token"];//actionContext.Request.Headers.["Token"];
            //if (string.IsNullOrEmpty(token))
            //    return false;

            //var isvalid = UserTokenManager.ValidUserToken(token);
            //return isvalid;


            var token = HttpContext.Current.Request.QueryString["token"] ?? null;

            if (string.IsNullOrEmpty(token))
            {
                token = HttpContext.Current.Request.Headers["token"];
                if (string.IsNullOrEmpty(token))
                {
                    return(false);
                }
            }

            IHttpController controller = actionContext.ControllerContext.Controller;

            if (controller is Demo.Api.Controllers.BaseApiController)
            {
                UserTokenExtend userToken = UserTokenManager.GetUserToken(token) as UserTokenExtend;
                if (null == userToken)
                {
                    //token已过期
                    return(false);
                }
                //测试使用的token
                if ("dcxx123456" != token)
                {
                    userToken.ExpireTime = DateTime.Now.AddHours(3);
                }
                else
                {
                    userToken.ExpireTime = DateTime.Now.AddYears(1);
                }
                ((DCSoft.Demo.Api.Controllers.BaseApiController)controller).userToken = userToken;
            }

            return(true);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 获取当前登录的用户信息。
 /// </summary>
 /// <param name="token"></param>
 /// <returns></returns>
 public static UserToken GetUserToken(this string token)
 {
     return(UserTokenManager.GetUserToken(token));
 }