public async Task <IActionResult> GetGridJson(Pagination pagination, string keyword) { var list = await _machineDisinfectionApp.GetList(pagination, keyword); var users = _usersService.GetUserNameDict("").Select(t => new { t.F_Id, t.F_RealName }).ToList(); var data = new { rows = list.Select(t => new { t.F_Id, t.F_Mid, t.F_Pid, t.F_PName, t.F_PGender, t.F_Vid, t.F_VisitDate, t.F_VisitNo, t.F_GroupName, t.F_ShowOrder, t.F_DialylisBedNo, t.F_MachineNo, t.F_MachineName, t.F_StartTime, t.F_EndTime, t.F_WipeStartTime, t.F_WipeEndTime, t.F_Option1, t.F_Option1Value, t.F_Option2, t.F_Option2Value, t.F_Option3, t.F_Option4, t.F_Option5, t.F_Option6, t.F_Option6Value, F_OperatePerson = t.F_OperatePerson == null ? "" : users.FirstOrDefault(u => u.F_Id == t.F_OperatePerson)?.F_RealName, F_CheckPerson = t.F_CheckPerson == null ? "" : users.FirstOrDefault(u => u.F_Id == t.F_CheckPerson)?.F_RealName, t.F_Memo, t.F_EnabledMark, t.F_CreatorTime, t.F_CreatorUserId, t.F_LastModifyTime, t.F_LastModifyUserId, t.F_DeleteTime, t.F_DeleteUserId, t.F_DeleteMark }), pagination.total, pagination.page, pagination.records }; return(Content(data.ToJson())); }
/// <summary> /// 通过治疗单ID查询消毒记录 /// </summary> /// <returns></returns> public async Task <IActionResult> GetFormByVid(BaseInput input) { var visitEntity = await _patVisitApp.GetForm(input.KeyValue); if (visitEntity == null) { return(BadRequest("治疗单主键有误!")); } var data = new GetFormByVidOutput(); var query = _machineDisinfectionApp.GetList().Where(t => t.F_Vid.Equals(input.KeyValue)); if (!query.Any()) { //生成记录 var msg = _machineDisinfectionApp.CreateSingleData(input.KeyValue, _usersService.GetCurrentUserId()); if (!string.IsNullOrEmpty(msg)) { return(BadRequest(msg)); } } var entity = query.Select(t => new { t.F_Id, t.F_Mid, t.F_Pid, t.F_PName, t.F_PGender, t.F_Vid, t.F_VisitDate, t.F_VisitNo, t.F_GroupName, t.F_ShowOrder, t.F_DialylisBedNo, t.F_MachineNo, t.F_MachineName, t.F_StartTime, t.F_EndTime, t.F_WipeStartTime, t.F_WipeEndTime, t.F_Option1, t.F_Option1Value, t.F_Option2, t.F_Option2Value, t.F_Option3, t.F_Option4, t.F_Option5, t.F_Option6, t.F_Option6Value, t.F_OperatePerson, t.F_CheckPerson, t.F_Memo }).FirstOrDefault(); if (entity != null) { data.id = entity.F_Id; data.Mid = entity.F_Mid; data.Pid = entity.F_Pid; data.PName = entity.F_PName; data.PGender = entity.F_PGender; data.Vid = entity.F_Vid; data.VisitDate = entity.F_VisitDate; data.VisitNo = entity.F_VisitNo; data.GroupName = entity.F_GroupName; data.ShowOrder = entity.F_ShowOrder; data.DialylisBedNo = entity.F_DialylisBedNo; data.MachineNo = entity.F_MachineNo; data.MachineName = entity.F_MachineName; data.StartTime = entity.F_StartTime; data.EndTime = entity.F_EndTime; data.WipeEndTime = entity.F_WipeEndTime; data.WipeStartTime = entity.F_WipeStartTime; data.Option1 = entity.F_Option1; data.Option1Value = entity.F_Option1Value; data.Option2 = entity.F_Option2; data.Option2Value = entity.F_Option2Value; data.Option3 = entity.F_Option3; data.Option4 = entity.F_Option4; data.Option5 = entity.F_Option5; data.Option6 = entity.F_Option6; data.Option6Value = entity.F_Option6Value; data.OperatePerson = entity.F_OperatePerson; data.CheckPerson = entity.F_CheckPerson; if (!string.IsNullOrEmpty(data.CheckPerson)) { var find = await _usersService.FindUserAsync(data.CheckPerson); data.CheckPerson = find == null ? "" : find.F_RealName; } if (!string.IsNullOrEmpty(data.OperatePerson)) { var find = await _usersService.FindUserAsync(data.OperatePerson); data.OperatePerson = find == null ? "" : find.F_RealName; } data.DialysisStartTime = visitEntity.F_DialysisStartTime; data.DialysisEndTime = visitEntity.F_DialysisEndTime; } return(Ok(data)); }