@page "/Box/CheckAAA" @using MasaBlazorApp3.Pojo.Config @using MasaBlazorApp3.Report @using Microsoft.Extensions.Options @using Radzen.Blazor.Rendering @using log4net; @*
@foreach (int i in DrawerNos) { }
*@ @*
@foreach (int i in DrawerNos) { }
*@
@* *@ @* *@ @* *@ @* *@ @* *@
@* *@ @* *@ @* *@ @* *@ @((context as DrugManuNo)?.ManuNo) @if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10) { @((context as DrugManuNo).EffDate.ToString().Substring(0, 10)) } else { @((context as DrugManuNo)?.EffDate) }
@code { private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrder)); @inject IOrderInfoDao orderInfoDao; @inject DialogService dialogService; @inject Microsoft.Extensions.Options.IOptions setting; @inject NotificationService _message; @inject IReportDataDao reportDataDao; @inject IOptions setting; bool allowRowSelectOnRowClick = true; IEnumerable orderInfos; IList selectedOrderInfos; RadzenDataGrid grid; //麻醉师集合 List NamesList = new List(); Anaesthetist NameInfo; Anaesthetist BoxColor; //药盒集合 List BoxList = new List(); //药盒颜色集合 List BoxColorList = new List(); BoxModel BoxNum; bool isLoading; int count; int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; int status = 0; string OrderNo; string PatientName; DateTime? OrderDate = null; DateTime PortOrderDate = DateTime.Now; Popup popup; RadzenButton button; //第一次加载不执行LoadData方法 int firstLod = 1; void OnCheckSeleced(object dete) { if (orderInfos != null) { orderInfos.ToList().ForEach(it => it.ItemIsChecked = true); } } void OnCurrentDateChanged(DateTime args) { OrderDate = new DateTime(args.Year, args.Month, args.Day); } void OnCurrentPortDateChanged(DateTime args) { PortOrderDate = new DateTime(args.Year, args.Month, args.Day); } // async Task OnColorChange(object value) // { // Anaesthetist v = value as Anaesthetist; // if (v.Id != BoxColor.Id) // { // BoxList = await orderInfoDao.GetOperationNum(BoxColor.Id);// await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList(); // BoxNum = BoxList.FirstOrDefault(); // } // } //重置 async Task reloadGrid() { OrderNo = ""; OrderDate = DateTime.MinValue; firstLod = 1; await grid.Reload(); } void OnCellClick(DataGridCellMouseEventArgs args) { if (args.Data.DetailInfo.SetManuNo != null) { args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.Where(m => m.ManuNo == args.Data.DetailInfo.SetManuNo).FirstOrDefault(); } if (args.Data.DetailInfo.drugManuNo == null) { args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.FirstOrDefault(); } args.Data.ItemIsChecked = !args.Data.ItemIsChecked; grid.EditRow(args.Data); } //确认 async Task Confirm() { if (selectedOrderInfos == null) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择处方", Duration = 4000 } ); return; } if (BoxNum == null) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择药箱", Duration = 4000 } ); return; } if (selectedOrderInfos.Any(it => it.DetailInfo.drugManuNo == null && (string.IsNullOrEmpty(it.DetailInfo.SetManuNo)))) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择批次信息", Duration = 4000 } ); return; } selectedOrderInfos.Where(oi => oi.DetailInfo.drugManuNo != null && !string.IsNullOrEmpty(oi.DetailInfo.drugManuNo.ManuNo)).ToList().ForEach(oi => oi.DetailInfo.SetManuNo = oi.DetailInfo.drugManuNo.ManuNo); selectedOrderInfos.Where(oi => !string.IsNullOrEmpty(oi.DetailInfo.SetManuNo)).ToList().ForEach(oi => oi.DetailInfo.drugManuNo = new() { ManuNo = oi.DetailInfo.SetManuNo }); //弹出药品合计信息,确认无误后进行核对,取消则不核对 //弹出确认提示框 // var b = await dialogService.OpenAsync( // $"核对确认", // new Dictionary() { { "selectedOrderInfos", selectedOrderInfos } }, // new DialogOptions() { Width = "80vw", Resizable = true, Draggable = true, ShowClose = false }); // if (b) // { bool bResult = await orderInfoDao.CheckOrderInfo(selectedOrderInfos, BoxNum); if (bResult) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 } ); //await GetInitialDate(); await grid.Reload(); } else { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"处方已核对失败", Duration = 4000 } ); } // } } PageData result; protected override async Task OnInitializedAsync() { BoxColorList = setting.Value.boxColor.Split(',').Select(it => new Anaesthetist { Name = it,Id=it=="白"?1:2 }).ToList(); BoxColor = BoxColorList.FirstOrDefault(); NamesList = setting.Value.anaesthetist_name.Split(',').Select(it => new Anaesthetist { Name = it }).ToList(); NameInfo = NamesList.FirstOrDefault(); BoxList = await orderInfoDao.GetOperationNum(0);// await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList(); BoxNum = BoxList.FirstOrDefault(); //await GetInitialDate(); await base.OnInitializedAsync(); } async Task LoadData(LoadDataArgs args) { if (firstLod == 1) { return; } // BoxList=BoxList.Where(bl => bl.BoxNo == BoxColor.Id).ToList(); // BoxNum = BoxList.FirstOrDefault(); string? anaesthetistName = NameInfo.Name == "未选择" ? null : NameInfo.Name; string? roomName = BoxNum == null ? "" : setting.Value.roomName + BoxNum.BoxName.ToString().PadLeft(2, '0'); result = await orderInfoDao.GetAllOrderInfo(anaesthetistName, roomName, PatientName, OrderNo, OrderDate, args.Top, args.Skip); isLoading = true; orderInfos = result.Desserts; count = result.TotalDesserts; // if (result != null) // { // isLoading = true; // orderInfos = result.Desserts; // // Update the count // count = result.TotalDesserts; // logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}"); // // Update the Data property // if (Name != null) // { // orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name); // logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()},Name{Name.Name}"); // count = orderInfos.Count(); // } // if (OrderDate != null && OrderDate != DateTime.MinValue) // { // orderInfos = orderInfos.Where(it => it.ChargeDate.Date >= OrderDate.Value.Date); // logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}"); // // Update the count // count = orderInfos.Count(); // } // if (!string.IsNullOrEmpty(OrderNo)) // { // orderInfos = orderInfos.Where(it => it.OrderNo.Contains(OrderNo)); // logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}-OrderNo{OrderNo}"); // // Update the count // count = orderInfos.Count(); // } // if (Name != null && OrderDate != null && OrderDate != DateTime.MinValue && !string.IsNullOrEmpty(OrderNo)) // { // orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name && it.ChargeDate.Date == OrderDate.Value.Date && it.OrderNo.Contains(OrderNo)); // logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}"); // // Update the count // count = orderInfos.Count(); // } // if (BoxNum != null&&BoxNum.BoxName!=99&&BoxNum.BoxName!=111) // { // string roomName = setting.Value.roomName + BoxNum.BoxName.ToString().PadLeft(2, '0'); // orderInfos = orderInfos.Where(it => it.RoomName == roomName); // logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()};roomName{roomName}"); // count = orderInfos.Count(); // } // logger.Info($"LoadData结束:{DateTime.Now},{orderInfos.Count()}"); // orderInfos = orderInfos.Skip(args.Skip.Value).Take(args.Top.Value).ToList(); // logger.Info($"LoadData结束:{DateTime.Now},{orderInfos.Count()} -{args.Skip.Value}-{args.Top.Value}"); // await InvokeAsync(StateHasChanged); // //查找该麻醉师对应的手术室 // //List roomNameList = orderInfos.Select(it => it.RoomName).Distinct().ToList(); // // List roomNameList = orderInfos.Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToList(); // // BoxList = await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList(); // // BoxNum = BoxList.FirstOrDefault(); isLoading = false; // } } //麻醉药品使用登记本导出 async Task StockExport() { if (PortOrderDate == DateTime.MinValue) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择处方时间再导出", Duration = 4000 } ); return; } PageData pageData = await reportDataDao.GetOrderInfoData(PortOrderDate); GridReportUtil.PrintReport("Usage_Temp.grf", pageData); } // protected override async Task OnInitializedAsync() // { // await base.OnInitializedAsync(); // // orderInfos = dbContext.Employees; // var result = await orderInfoDao.GetAllOrderInfo(OrderNo, OrderDate, args.Top, args.Skip); // // Update the Data property // orderInfos = result.Desserts; // // Update the count // count = result.TotalDesserts; // isLoading = false; // } }