示例#1
0
        /// <summary>
        /// 查找单一床位
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <IActionResult> GetFormJson([FromQuery] BaseInput input)
        {
            var data = await _dialysisMachineApp.GetForm(input.KeyValue);

            //data = data ?? app.GetMachineByBedNo(input.keyValue);
            return(Ok(data));
        }
        //monday: new Date(weekStart).Format("yyyy-MM-dd"),
        //                id: id,
        //                pid: availableTags[id].id,
        //                dialysisNo: availableTags[id].recordNo,
        //                pname: availableTags[id].name,
        //                colname: name,
        //                val: val,
        //                iRow: iRow,
        //                iCol: iCol,
        //                group: $gridList.getCell(iRow, 1),
        //                bedNo: $gridList.getCell(iRow, 1),
        //                bid: $gridList.getCell(iRow, 'F_BId')

        /// <summary>
        /// 保存排班单元格数据
        /// </summary>
        /// <param name="monday"></param>
        /// <param name="pid"></param>
        /// <param name="pname"></param>
        /// <param name="dialysisNo"></param>
        /// <param name="colname"></param>
        /// <param name="value"></param>
        /// <param name="iRow"></param>
        /// <param name="iCol"></param>
        /// <param name="group"></param>
        /// <param name="bedNo"></param>
        /// <param name="bid"></param>
        /// <returns></returns>
        //[HttpPost]
        public async Task <IActionResult> SaveCellData(DateTime monday, string pid, string pname, int dialysisNo,
                                                       string colname, string value, string iRow, string iCol, string group, string bedNo, string bid)
        {
            var visitDate = monday.Date;
            var visitNo   = 0;

            switch (colname)
            {
            case "F_Monday1":
                visitDate = visitDate.AddDays(0);
                visitNo   = 1;
                break;

            case "F_Monday2":
                visitDate = visitDate.AddDays(0);
                visitNo   = 2;
                break;

            case "F_Monday3":
                visitDate = visitDate.AddDays(0);
                visitNo   = 3;
                break;

            case "F_Tuesday1":
                visitDate = visitDate.AddDays(1);
                visitNo   = 1;
                break;

            case "F_Tuesday2":
                visitDate = visitDate.AddDays(1);
                visitNo   = 2;
                break;

            case "F_Tuesday3":
                visitDate = visitDate.AddDays(1);
                visitNo   = 3;
                break;

            case "F_Wednesday1":
                visitDate = visitDate.AddDays(2);
                visitNo   = 1;
                break;

            case "F_Wednesday2":
                visitDate = visitDate.AddDays(2);
                visitNo   = 2;
                break;

            case "F_Wednesday3":
                visitDate = visitDate.AddDays(2);
                visitNo   = 3;
                break;

            case "F_Thursday1":
                visitDate = visitDate.AddDays(3);
                visitNo   = 1;
                break;

            case "F_Thursday2":
                visitDate = visitDate.AddDays(3);
                visitNo   = 2;
                break;

            case "F_Thursday3":
                visitDate = visitDate.AddDays(3);
                visitNo   = 3;
                break;

            case "F_Friday1":
                visitDate = visitDate.AddDays(4);
                visitNo   = 1;
                break;

            case "F_Friday2":
                visitDate = visitDate.AddDays(4);
                visitNo   = 2;
                break;

            case "F_Friday3":
                visitDate = visitDate.AddDays(4);
                visitNo   = 3;
                break;

            case "F_Saturday1":
                visitDate = visitDate.AddDays(5);
                visitNo   = 1;
                break;

            case "F_Saturday2":
                visitDate = visitDate.AddDays(5);
                visitNo   = 2;
                break;

            case "F_Saturday3":
                visitDate = visitDate.AddDays(5);
                visitNo   = 3;
                break;

            case "F_Sunday1":
                visitDate = visitDate.AddDays(6);
                visitNo   = 1;
                break;

            case "F_Sunday2":
                visitDate = visitDate.AddDays(6);
                visitNo   = 2;
                break;

            case "F_Sunday3":
                visitDate = visitDate.AddDays(6);
                visitNo   = 3;
                break;
            }
            if (visitNo == 0)
            {
                return(Success("参数错误!"));
            }

            var bedEntity = await _machineApp.GetForm(bid);

            var entity = _dialysisScheduleApp.GetList().FirstOrDefault(r =>
                                                                       r.F_BId == bid && r.F_VisitDate == visitDate && r.F_VisitNo == visitNo);

            if (entity == null)
            {
                if (string.IsNullOrWhiteSpace(pid))
                {
                    return(Success("操作成功,无数据变化"));
                }
                else
                {
                    entity = new DialysisScheduleEntity();
                }
            }
            else
            {
                if (string.IsNullOrWhiteSpace(pid))
                {
                    await _dialysisScheduleApp.DeleteForm(entity.F_Id);

                    return(Success("操作成功,数据已删除"));
                }
            }
            if (!string.IsNullOrWhiteSpace(pid))
            {
                var record = _dialysisScheduleApp.GetList()
                             .FirstOrDefault(t => t.F_PId == pid && t.F_VisitDate == visitDate);
                if (record != null)
                {
                    return(Error(record.F_Name + "今日已排班,床号:" + record.F_DialysisBedNo + ",班次:" + record.F_VisitNo));
                }
            }

            entity.F_BId           = bedEntity.F_Id;
            entity.F_DialysisBedNo = bedEntity.F_DialylisBedNo;
            entity.F_DialysisNo    = dialysisNo;
            entity.F_DialysisType  = bedEntity.F_DefaultType;
            entity.F_GroupName     = bedEntity.F_GroupName;
            entity.F_Name          = pname;
            entity.F_PId           = pid;
            entity.F_Sort          = bedEntity.F_ShowOrder;
            entity.F_VisitDate     = visitDate;
            entity.F_VisitNo       = visitNo;

            await _dialysisScheduleApp.SubmitForm(entity, entity.F_Id);

            return(Success("操作成功。"));
        }
示例#3
0
        public async Task <IActionResult> GetFilterList(GetFilterListInput input)
        {
            var bedInfo = await _dialysisMachineApp.GetForm(input.keyValue);

            var list = _patVisitApp.GetList()//input.startDate.ToDate(), input.endDate.ToDate(), bedInfo.F_GroupName, bedInfo.F_DialylisBedNo, true
                       .Where(t => t.F_VisitDate >= input.startDate.ToDate() &&
                              t.F_VisitDate <= input.endDate.ToDate() &&
                              t.F_GroupName == bedInfo.F_GroupName &&
                              t.F_DialysisBedNo == bedInfo.F_DialylisBedNo &&
                              t.F_DialysisStartTime != null &&
                              t.F_DialysisEndTime != null
                              )
                       .Select(t => new
            {
                vid               = t.F_Id,
                pid               = t.F_Pid,
                dialysisNo        = t.F_DialysisNo,
                patientName       = t.F_Name,
                patientGender     = t.F_Gender,
                visitDate         = t.F_VisitDate,
                visitNo           = t.F_VisitNo,
                groupName         = t.F_GroupName,
                dialysisBedNo     = t.F_DialysisBedNo,
                dialysisStartTime = t.F_DialysisStartTime,
                dialysisEndTime   = t.F_DialysisEndTime
            }).ToList();
            var processes = _machineProcessApp.GetList(input.startDate.ToDate(), input.endDate.ToDate(), input.keyValue)
                            .Select(t => new
            {
                id            = t.F_Id,
                vid           = t.F_Vid,
                operatePerson = t.F_OperatePerson,
                operateTime   = t.F_OperateTime,
                option1       = t.F_Option1,
                option2       = t.F_Option2,
                option3       = t.F_Option3,
                option4       = t.F_Option4,
                option5       = t.F_Option5,
                option6       = t.F_Option6,
                memo          = t.F_Memo
            }).ToList();
            var data = new
            {
                machine = new
                {
                    groupName   = bedInfo.F_GroupName,
                    bedNo       = bedInfo.F_DialylisBedNo,
                    showOrder   = bedInfo.F_ShowOrder,
                    machineName = bedInfo.F_MachineName,
                    machineNo   = bedInfo.F_MachineNo,
                    defaultType = bedInfo.F_DefaultType
                },
                rows = list.GroupJoin(processes, v => v.vid, p => p.vid, (v, p) => new
                {
                    v.vid,
                    isProcessed = p.Count() > 0,
                    //v.dialysisBedNo,
                    v.patientName,
                    v.patientGender,
                    v.visitDate,
                    v.visitNo,
                    v.dialysisStartTime,
                    v.dialysisEndTime,
                    processItem = p.FirstOrDefault()
                }).Select(t => t).OrderBy(t => t.visitDate).ThenBy(t => t.visitNo)
            };

            return(Ok(data));
        }
        public async Task <IActionResult> GetFormJson(string keyValue)
        {
            var data = await _dialysisMachineApp.GetForm(keyValue);

            return(Content(data.ToJson()));
        }