public async Task <List <ImportScheduleModel> > ImportDatas(DateTime startDate, string filePath) { var defaultDialysisType = await _itemsDetailApp.GetDefaultDialysisType() ?? "HD"; var list = new List <ImportScheduleModel>(); NPOIExcel excel = new NPOIExcel(); var dialysisTypes = (await _itemsDetailApp.GetItemList("DialysisType")).Select(t => t.F_ItemCode).OrderByDescending(t => t.Length).ToList(); var records = excel.ToListForSchedule("排班明细", filePath, dialysisTypes, 4, 0); //var groups = var groups = (await _itemsDetailApp.GetItemList("BedGroup")).Select(t => t.F_ItemCode).ToList(); var beds = await _dialysisMachineApp.GetList(); var patients = await _patientApp.GetList(); foreach (var item in records.GroupBy(t => t.F_GroupName)) { if (!groups.Contains(item.Key)) { continue; } foreach (var child in item.GroupBy(t => t.F_DialysisBedNo)) { var findBed = beds.Find(t => t.F_GroupName == item.Key && t.F_DialylisBedNo == child.Key); if (findBed == null) { continue; } foreach (var ele in child) { var patient = patients.Find(t => t.F_Name == ele.F_Name.Trim()); if (patient == null) { continue; } list.Add(new ImportScheduleModel { F_GroupName = item.Key, F_DialysisBedNo = child.Key, F_BId = findBed.F_Id, F_VisitDate = startDate.AddDays(ele.DayOfWeek - 1), F_VisitNo = ele.F_VisitNo, F_PId = patient.F_Id, F_DialysisNo = patient.F_DialysisNo, F_Name = patient.F_Name, F_DialysisType = ele.F_DialysisType ?? defaultDialysisType, F_Sort = findBed.F_ShowOrder.ToInt() }); } } } return(list); }
/// <summary> /// 根据日期查询透析记录单简要信息列表 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <IActionResult> GetPatVisitListJson(GetPatVisitListJsonInput input /*DateTime visitDate*/) { var list = _patVisitApp.GetList().Where(t => t.F_VisitDate == input.visitDate); //患者 var p = (from c in await _patientApp.GetList() where list.Any(t => t.F_Pid.Equals(c.F_Id)) select c).ToList(); //耗材 var m = (from c in await _materialApp.GetList() where list.Any(t => c.F_Id.Equals(t.F_DialyzerType1) || c.F_Id.Equals(t.F_DialyzerType2)) select c).ToList(); //药品 var d = (from c in await _drugsApp.GetList() where list.Any(t => c.F_Id.Equals(t.F_HeparinType)) select c).ToList(); //查询治疗记录 var data = new List <PatVisitListResult>(); foreach (var item in list) { var temp = new PatVisitListResult { Id = item.F_Id, Pid = item.F_Pid, GroupName = item.F_GroupName, DialysisBedNo = item.F_DialysisBedNo }; var patient = p.FirstOrDefault(t => t.F_Id.Equals(item.F_Pid)); if (patient == null) { continue; } temp.Name = patient.F_Name ?? ""; temp.Gender = patient.F_Gender ?? ""; temp.VisitDate = item.F_VisitDate.ToDateString(); temp.VisitNo = item.F_VisitNo.ToInt(); temp.DialysisNo = patient.F_DialysisNo.ToInt(); temp.DialysisType = item.F_DialysisType ?? ""; temp.DialyzerType1 = item.F_DialyzerType1 == null ? "" : m.First(t => t.F_Id.Equals(item.F_DialyzerType1)).F_MaterialName; temp.DialyzerType2 = item.F_DialyzerType2 == null ? "" : m.First(t => t.F_Id.Equals(item.F_DialyzerType2)).F_MaterialName; temp.VascularAccess = item.F_VascularAccess ?? ""; temp.HeparinType = item.F_HeparinType == null ? "" : d.First(t => t.F_Id.Equals(item.F_HeparinType)).F_DrugName; temp.BirthDay = patient.F_BirthDay.ToDateString(); temp.AgeDesc = patient.F_BirthDay == null ? "" : ((int)((DateTime.Now - patient.F_BirthDay.ToDate()).TotalDays / 365)).ToString() + "岁"; temp.StartTime = item.F_DialysisStartTime == null ? "" : item.F_DialysisStartTime.ToDateTimeString(); temp.EndTime = item.F_DialysisEndTime == null ? "" : item.F_DialysisEndTime.ToDateTimeString(); temp.Py = (patient.F_PY ?? "").ToLower(); temp.StartPerson = item.F_StartPerson; temp.EndPerson = item.F_EndPerson; temp.CheckPerson = item.F_CheckPerson; temp.PuncturePerson = item.F_PuncturePerson; data.Add(temp); } return(Ok(data)); }
public async Task <IActionResult> GetGridJson(Pagination pagination, string keyword) { var data = new { rows = await _patientApp.GetList(pagination, keyword), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
/// <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)); }