public async Task <IActionResult> GetPagedList(BaseInputPaged input)
        {
            var pagination = new Pagination
            {
                rows = input.rows,
                page = input.page,
                sidx = input.orderField ?? "F_CreatorTime",
                sord = input.orderType
            };
            var list = (await _recordTemplateApp.GetList(pagination, _usersService.GetCurrentUserId())).Select(t => new
            {
                id          = t.F_Id,
                title       = t.F_Title,
                content     = t.F_Content,
                isPrivate   = t.F_IsPrivate,
                creatorTime = t.F_CreatorTime
            });
            var data = new
            {
                rows = list,
                pagination.total,
                pagination.page,
                pagination.records
            };

            return(Ok(data));
        }
        public async Task <IActionResult> GetPagedGridJson(BaseInputPaged input)
        {
            var pagination = new Pagination
            {
                rows = input.rows,
                page = input.page,
                sidx = input.orderField ?? "F_CreatorTime",
                sord = input.orderType ?? "desc"
            };
            var keyword = input.keyValue;
            var data    = new
            {
                rows = (await _settingApp.GetList(pagination, keyword)).Select(t => new
                {
                    t.F_AccessName,
                    t.F_BloodSpeed,
                    t.F_Ca,
                    t.F_CreatorTime,
                    t.F_DialysateTemperature,
                    t.F_DialysisType,
                    t.F_DialyzerType1,
                    t.F_DialyzerType2,
                    t.F_DilutionType,
                    t.F_EstimateHours,
                    t.F_ExchangeAmount,
                    t.F_ExchangeSpeed,
                    t.F_Hco3,
                    t.F_HeparinAddAmount,
                    t.F_HeparinAddSpeedUnit,
                    t.F_HeparinAmount,
                    t.F_HeparinType,
                    t.F_HeparinUnit,
                    t.F_Id,
                    t.F_IsDefault,
                    t.F_K,
                    t.F_LowCa,
                    t.F_Na,
                    t.F_Pid,
                    t.F_VascularAccess
                }),
                pagination.total,
                pagination.page,
                pagination.records
            };

            return(Ok(data));
        }
        public async Task <IActionResult> GetPagedGridJson(BaseInputPaged input)
        {
            var pagination = new Pagination
            {
                rows = input.rows,
                page = input.page,
                sidx = input.orderField ?? "F_CreatorTime",
                sord = input.orderType ?? "desc"
            };
            var keyword = input.keyValue;
            var data    = new
            {
                rows = (await _vascularAccessApp.GetList(pagination, keyword)).Select(t => new
                {
                    t.F_Id,
                    t.F_BloodSpeed,
                    t.F_BloodSpeed_Idea,
                    t.F_BodyPart,
                    t.F_Complication,
                    t.F_CreatorTime,
                    t.F_CreatorUserId,
                    t.F_DisabledRemark,
                    t.F_DiscardTime,
                    t.F_EnabledMark,
                    t.F_FirstUseTime,
                    t.F_Memo,
                    t.F_OperateTime,
                    t.F_Pid,
                    t.F_Type,
                    t.F_VascularAccess,
                    t.F_PicPath
                }),
                pagination.total,
                pagination.page,
                pagination.records
            };

            return(Ok(data));
        }
        /// <summary>
        /// 分页查询患者信息(简要)
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="keyword">关键字(透析号,姓名,病历号)</param>
        /// <returns></returns>
        public async Task <IActionResult> GetPagedBrieflyList(BaseInputPaged input)
        {
            var pagination = new Pagination
            {
                rows = input.rows,
                page = input.page,
                sidx = input.orderField ?? "F_PY",
                sord = input.orderType
            };
            var keyword = input.keyValue;
            var data    = new
            {
                rows = (await _patientApp.GetList(pagination, keyword)).Select(t => new
                {
                    t.F_Id,
                    t.F_Name,
                    t.F_DialysisNo,
                    t.F_RecordNo,
                    t.F_PatientNo,
                    t.F_Gender,
                    t.F_BirthDay,
                    F_AgeStr = t.F_BirthDay == null ? "" : ((DateTime.Now - t.F_BirthDay.ToDate()).TotalDays.ToInt() / 365).ToString() + "岁",
                    t.F_InsuranceNo,
                    t.F_IdNo,
                    t.F_MaritalStatus,
                    t.F_IdealWeight,
                    t.F_PhoneNo,
                    F_BeInfected = "+".Equals(t.F_Tp) || "+".Equals(t.F_Hiv) || "+".Equals(t.F_HBsAg) || "+".Equals(t.F_HBeAg) || "+".Equals(t.F_HBeAb),//阳性患者判断规则
                    t.F_CardNo,
                    t.F_PY,
                    F_HeadIcon = t.F_HeadIcon ?? ""
                }),
                pagination.total,
                pagination.page,
                pagination.records
            };

            return(Ok(data));
        }
        public async Task <IActionResult> GetPagedList(BaseInputPaged input)
        {
            if (string.IsNullOrEmpty(input.orderType))
            {
                input.orderType = "desc";
            }
            PatientEntity patient = null;

            if (string.IsNullOrEmpty(input.keyValue))
            {
                patient = await _patientApp.GetRandom();
            }
            else
            {
                patient = await _patientApp.GetForm(input.keyValue);
            }
            if (patient == null)
            {
                return(BadRequest("患者ID有误"));
            }

            var pagination = new Pagination
            {
                rows = input.rows,
                page = input.page,
                sidx = input.orderField ?? "F_ContentTime",
                sord = input.orderType
            };
            Hashtable table = new Hashtable();
            var       list  = await _medicalRecordApp.GetListByPid(pagination, patient.F_Id);

            foreach (var item in list)
            {
                if (!table.ContainsKey(item.F_CreatorUserId))
                {
                    var user = await _usersService.FindUserAsync(item.F_CreatorUserId);

                    table.Add(item.F_CreatorUserId, user?.F_RealName ?? "");
                }
                item.F_CreatorUserId = table[item.F_CreatorUserId] + "";
            }
            var data = new
            {
                patient = new
                {
                    name           = patient.F_Name,
                    gender         = patient.F_Gender,
                    ageStr         = patient.F_BirthDay == null ? "" : ((DateTime.Now - patient.F_BirthDay.ToDate()).TotalDays.ToInt() / 365).ToString() + "岁",
                    maritalStatus  = patient.F_MaritalStatus,
                    beInfected     = "+".Equals(patient.F_Tp) || "+".Equals(patient.F_Hiv) || "+".Equals(patient.F_HBsAg) || "+".Equals(patient.F_HBeAg) || "+".Equals(patient.F_HBeAb),//阳性患者判断规则
                    dialysisNo     = patient.F_DialysisNo,
                    primaryDisease = patient.F_PrimaryDisease,
                    diagnosis      = patient.F_Diagnosis,
                    headIcon       = patient.F_HeadIcon
                },
                rows = list.OrderByDescending(t => t.F_ContentTime).Select(t => new
                {
                    id          = t.F_Id,
                    title       = t.F_Title,
                    content     = t.F_Content,
                    contentTime = t.F_ContentTime,
                    isAudit     = t.F_AuditFlag,
                    creatorUser = t.F_CreatorUserId
                }),
                pagination.total,
                pagination.page,
                pagination.records
            };

            return(Ok(data));
        }
        /// <summary>
        /// 分页查询患者信息
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="keyword">关键字(透析号,姓名,病历号)</param>
        /// <returns></returns>
        public async Task <IActionResult> GetPagedGridJson(BaseInputPaged input)
        {
            var pagination = new Pagination
            {
                rows = input.rows,
                page = input.page,
                sidx = input.orderField ?? "F_PY",
                sord = input.orderType
            };
            var keyword = input.keyValue;
            var data    = new
            {
                rows = (await _patientApp.GetList(pagination, keyword)).Select(t => new
                {
                    t.F_Id,
                    t.F_Name,
                    t.F_DialysisNo,
                    t.F_RecordNo,
                    t.F_PatientNo,
                    t.F_Gender,
                    t.F_BirthDay,
                    F_AgeStr = t.F_BirthDay == null ? "" : ((DateTime.Now - t.F_BirthDay.ToDate()).TotalDays.ToInt() / 365).ToString() + "岁",
                    t.F_Charges,
                    t.F_InsuranceNo,
                    t.F_IdNo,
                    t.F_MaritalStatus,
                    t.F_IdealWeight,
                    t.F_Height,
                    t.F_DialysisStartTime,
                    t.F_PrimaryDisease,
                    t.F_Diagnosis,
                    t.F_Address,
                    t.F_InsuranceType,
                    t.F_Contacts,
                    t.F_Contacts2,
                    t.F_Trasfer,
                    t.F_PhoneNo,
                    t.F_PhoneNo2,
                    t.F_BloodAbo,
                    t.F_BloodRh,
                    t.F_Tp,
                    t.F_Hiv,
                    t.F_HBsAg,
                    t.F_HBsAb,
                    t.F_HBcAb,
                    t.F_HBeAg,
                    t.F_HBeAb,
                    t.F_HCVAb,
                    F_BeInfected = "+".Equals(t.F_Tp) || "+".Equals(t.F_Hiv) || "+".Equals(t.F_HBsAg) || "+".Equals(t.F_HBeAg) || "+".Equals(t.F_HBeAb),//阳性患者判断规则
                    t.F_MedicalHistory,
                    t.F_CardNo,
                    t.F_PY,
                    F_HeadIcon = t.F_HeadIcon ?? ""
                }),
                pagination.total,
                pagination.page,
                pagination.records
            };

            return(Ok(data));
        }