Ejemplo n.º 1
0
        public async Task <IActionResult> GetFormByVisitIdJson(string keyValue)
        {
            var visitRecord = await _patVisitApp.GetForm(keyValue);

            var data = await _evaluationApp.GetForm(visitRecord.F_Pid, visitRecord.F_VisitDate.ToDate());

            return(Content(data.ToJson()));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> SubmitData([FromBody] SubmitDataInput input)
        {
            var visit = await _patVisitApp.GetForm(input.id);

            if (visit == null)
            {
                return(BadRequest("治疗单主键有误"));
            }
            var user = await _usersService.GetCurrentUserAsync();

            var entity = new DialysisObservationEntity
            {
                F_Id                = Common.GuId(),
                F_Pid               = visit.F_Pid,
                F_VisitDate         = visit.F_VisitDate,
                F_VisitNo           = visit.F_VisitNo,
                F_SSY               = input.ssy,
                F_SZY               = input.szy,
                F_HR                = input.hr,
                F_A                 = input.a,
                F_BF                = input.bf,
                F_UFR               = input.ufr,
                F_V                 = input.v,
                F_C                 = input.c,
                F_T                 = input.t,
                F_UFV               = input.ufv,
                F_TMP               = input.tmp,
                F_GSL               = input.gsl,
                F_MEMO              = input.memo,
                F_Nurse             = user.F_RealName,
                F_NurseOperatorTime = input.operatorTime,
                F_EnabledMark       = true,
                F_CreatorTime       = DateTime.Now,
                F_CreatorUserId     = user.F_Id,
            };
            await _dialysisObservationApp.InsertForm(entity);

            var data = new
            {
                id = entity.F_Id
            };

            return(Ok(data));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetForm(BaseInput input)
        {
            var visitEntity = await _patVisitApp.GetForm(input.KeyValue);

            if (visitEntity == null)
            {
                return(BadRequest("透析记录主键有误"));
            }
            var entity = _machineProcessApp.GetFormByVid(input.KeyValue);

            if (entity == null)
            {
                //生成数据
                var bedInfo = await _dialysisMachineApp.GetForm(visitEntity.F_GroupName, visitEntity.F_DialysisBedNo);

                entity = new MachineProcessEntity
                {
                    F_Id            = Common.GuId(),
                    F_Mid           = bedInfo.F_Id,
                    F_Pid           = visitEntity.F_Pid,
                    F_DialylisNo    = visitEntity.F_DialysisNo,
                    F_PName         = visitEntity.F_Name,
                    F_PGender       = visitEntity.F_Gender,
                    F_Vid           = visitEntity.F_Id,
                    F_VisitDate     = visitEntity.F_VisitDate,
                    F_VisitNo       = visitEntity.F_VisitNo,
                    F_GroupName     = bedInfo.F_GroupName,
                    F_ShowOrder     = bedInfo.F_ShowOrder,
                    F_DialylisBedNo = bedInfo.F_DialylisBedNo,
                    F_MachineName   = bedInfo.F_MachineName,
                    F_MachineNo     = bedInfo.F_MachineNo,
                    F_EnabledMark   = true,
                    F_CreatorTime   = DateTime.Now,
                    F_CreatorUserId = _usersService.GetCurrentUserId()
                };
                _machineProcessApp.InsertForm(entity);
            }
            var data = new
            {
                id            = entity.F_Id,
                operatePerson = entity.F_OperatePerson == null ? "" : (await _usersService.FindUserAsync(entity.F_OperatePerson))?.F_RealName,
                operateTime   = entity.F_OperateTime,
                option1       = entity.F_Option1,
                option2       = entity.F_Option2,
                option3       = entity.F_Option3,
                option4       = entity.F_Option4,
                option5       = entity.F_Option5,
                option6       = entity.F_Option6,
                memo          = entity.F_Memo
            };

            return(Ok(data));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> SaveData([FromBody] SaveDataInput input)
        {
            var patVisitEntity = await _patVisitApp.GetForm(input.VisitId);

            var userId = _usersService.GetCurrentUserId();
            var entity = new PunctureEntity
            {
                F_Pid         = patVisitEntity.F_Pid,
                F_Nurse       = userId,
                F_OperateTime = DateTime.Now,
                F_Point1      = input.Point1,
                F_Point2      = input.Point2,
                F_Memo        = input.Memo,
                F_IsSuccess   = input.IsSuccess,
                F_EnabledMark = true
            };
            await _punctureApp.InsertForm(entity);

            //更新治疗单 穿刺者信息
            patVisitEntity.F_PuncturePerson = userId;
            await _patVisitApp.UpdateForm(patVisitEntity);

            return(Success("操作成功。"));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> CreateReport([FromBody] CreateReportInput input)
        {
            //选择的床位Id
            var bedIds  = input.Ids.Split(',');
            var records = _machineDisinfectionApp.GetListByDate(input.StartDate, input.EndDate)
                          .Where(t => t.F_OperatePerson != null)
                          .Where(t => bedIds.Contains(t.F_Mid))
                          .Select(t => new
            {
                t.F_CheckPerson,
                t.F_DialylisBedNo,
                t.F_EndTime,
                t.F_GroupName,
                t.F_MachineName,
                t.F_MachineNo,
                t.F_Memo,
                t.F_Mid,
                t.F_OperatePerson,
                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_PGender,
                t.F_Pid,
                t.F_PName,
                t.F_ShowOrder,
                t.F_StartTime,
                t.F_Vid,
                t.F_VisitDate,
                t.F_VisitNo,
                t.F_WipeStartTime,
                t.F_WipeEndTime
            })
                          //.GroupBy(t => t.F_Mid)
                          .OrderBy(t => t.F_ShowOrder).ThenBy(t => t.F_VisitDate).ThenBy(t => t.F_VisitNo)
                          .ToList();
            var category = new MachineDisinfectionCategory
            {
                //StartDate = startDate,
                //EndDate = endDate
            };
            //var patVisitApp = new PatVisitApp();
            var users = _usersService.GetUserNameDict("").Select(t => new
            {
                t.F_Id,
                t.F_RealName
            }).ToList();

            foreach (var item in records)
            {
                var findrow = category.MachineInfos.FirstOrDefault(t => t.Mid == item.F_Mid);
                if (findrow == null)
                {
                    findrow = new MachineInfo
                    {
                        Mid           = item.F_Mid,
                        DialylisBedNo = item.F_DialylisBedNo,
                        GroupName     = item.F_GroupName,
                        MachineName   = item.F_MachineName,
                        MachineNo     = item.F_MachineNo,
                        StartDate     = input.StartDate.ToDateString(),
                        EndDate       = input.EndDate.ToDateString()
                    };
                    category.MachineInfos.Add(findrow);
                }

                var element = new DisinfectionInfo
                {
                    CheckPerson       = "",
                    DialysisEndTime   = "",
                    DialysisStartTime = "",
                    DisinfectType     = "",
                    Memo          = item.F_Memo,
                    OperatePerson = "",
                    PGender       = item.F_PGender,
                    PName         = item.F_PName,
                    SurfaceType   = item.F_Option6Value ?? "",
                    VisitDate     = item.F_VisitDate.ToDate().ToDateString(),
                    VisitNo       = item.F_VisitNo.ToInt().ToString(),
                    StartTime     = item.F_StartTime == null
                        ? ""
                        : item.F_StartTime.ToDate().ToDateTimeString(true).Substring(11),
                    EndTime =
                        item.F_EndTime == null ? "" : item.F_EndTime.ToDate().ToDateTimeString(true).Substring(11),
                    WipeEndTime = item.F_WipeEndTime == null
                        ? ""
                        : item.F_WipeEndTime.ToDate().ToDateTimeString(true).Substring(11),
                    WipeStartTime = item.F_WipeStartTime == null
                        ? ""
                        : item.F_WipeStartTime.ToDate().ToDateTimeString(true).Substring(11)
                };
                if (item.F_Option1 == true)
                {
                    element.DisinfectType = "热化学消毒(" + item.F_Option1Value + ")";
                }
                if (item.F_Option2 == true)
                {
                    element.DisinfectType = string.IsNullOrEmpty(element.DisinfectType) ? "化学消毒(" + item.F_Option2Value + ")" : element.DisinfectType + ";" + "化学消毒(" + item.F_Option2Value + ")";
                }
                if (item.F_Option3 == true)
                {
                    element.DisinfectType = string.IsNullOrEmpty(element.DisinfectType) ? "热消毒" : element.DisinfectType + ";" + "热消毒";
                }
                var visitRecord = await _patVisitApp.GetForm(item.F_Vid);

                if (visitRecord != null)
                {
                    element.DialysisStartTime = visitRecord.F_DialysisStartTime == null ? "" : visitRecord.F_DialysisStartTime.ToDate().ToDateTimeString(true).Substring(11);
                    element.DialysisEndTime   = visitRecord.F_DialysisEndTime == null ? "" : visitRecord.F_DialysisEndTime.ToDate().ToDateTimeString(true).Substring(11);
                }
                if (item.F_OperatePerson != null)
                {
                    var finduser = users.FirstOrDefault(t => t.F_Id == item.F_OperatePerson);
                    element.OperatePerson = finduser == null ? "" : finduser.F_RealName;
                }
                if (item.F_CheckPerson != null)
                {
                    var finduser = users.FirstOrDefault(t => t.F_Id == item.F_CheckPerson);
                    element.CheckPerson = finduser == null ? "" : finduser.F_RealName;
                }
                findrow.DisinfectionInfos.Add(element);
            }
            return(Content(_machineDisinfectionApp.GetImageReport(category.MachineInfos)));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> CreateReport([FromBody] CreateReportInput input)
        {
            //选择的床位Id
            var bedIds  = input.Ids.Split(',');
            var records = _machineProcessApp.GetListByDate(input.StartDate, input.EndDate)
                          .Where(t => t.F_OperatePerson != null)
                          .Where(t => bedIds.Contains(t.F_Mid))
                          .Select(t => new
            {
                t.F_DialylisBedNo,
                t.F_GroupName,
                t.F_MachineName,
                t.F_MachineNo,
                t.F_Memo,
                t.F_Mid,
                t.F_OperatePerson,
                t.F_OperateTime,
                t.F_Option1,
                t.F_Option2,
                t.F_Option3,
                t.F_Option4,
                t.F_Option5,
                t.F_Option6,
                t.F_PGender,
                t.F_Pid,
                t.F_PName,
                t.F_ShowOrder,
                t.F_Vid,
                t.F_VisitDate,
                t.F_VisitNo
            })
                          .OrderBy(t => t.F_ShowOrder).ThenBy(t => t.F_VisitDate).ThenBy(t => t.F_VisitNo)
                          .ToList();
            var category = new MachineProcessCategory
            {
            };
            var users = _usersService.GetUserNameDict("").Select(t => new { t.F_Id, t.F_RealName }).ToList();

            foreach (var item in records)
            {
                var findrow = category.ProcessSummeryInfos.FirstOrDefault(t => t.Mid == item.F_Mid);
                if (findrow == null)
                {
                    findrow = new ProcessSummeryInfo
                    {
                        Mid           = item.F_Mid,
                        DialylisBedNo = item.F_DialylisBedNo,
                        GroupName     = item.F_GroupName,
                        MachineName   = item.F_MachineName,
                        MachineNo     = item.F_MachineNo,
                        StartDate     = input.StartDate.ToDateString(),
                        EndDate       = input.EndDate.ToDateString()
                    };
                    category.ProcessSummeryInfos.Add(findrow);
                }
                var element = new ProcessItem
                {
                    OperateTime       = "",
                    DialysisEndTime   = "",
                    DialysisStartTime = "",
                    Memo          = item.F_Memo,
                    OperatePerson = "",
                    PGender       = item.F_PGender,
                    PName         = item.F_PName,
                    VisitDate     = item.F_VisitDate.ToDate().ToDateString(),
                    VisitNo       = item.F_VisitNo.ToInt().ToString()
                };
                element.OperateTime = item.F_OperateTime == null ? "" : item.F_OperateTime.ToDate().ToDateTimeString(true).Substring(11);
                element.Option1     = item.F_Option1 ?? false;
                element.Option2     = item.F_Option2 ?? false;
                element.Option3     = item.F_Option3 ?? false;
                element.Option4     = item.F_Option4 ?? false;
                if (element.Option4 == true)
                {
                    element.Option5 = item.F_Option5 ?? "";
                    element.Option6 = item.F_Option6 ?? "";
                }
                var visitRecord = await _patVisitApp.GetForm(item.F_Vid);

                if (visitRecord != null)
                {
                    element.DialysisStartTime = visitRecord.F_DialysisStartTime == null ? "" : visitRecord.F_DialysisStartTime.ToDate().ToDateTimeString(true).Substring(11);
                    element.DialysisEndTime   = visitRecord.F_DialysisEndTime == null ? "" : visitRecord.F_DialysisEndTime.ToDate().ToDateTimeString(true).Substring(11);
                }
                if (item.F_OperatePerson != null)
                {
                    var finduser = users.FirstOrDefault(t => t.F_Id == item.F_OperatePerson);
                    element.OperatePerson = finduser == null ? "" : finduser.F_RealName;
                }
                findrow.ProcessItems.Add(element);
            }
            return(Content(_machineProcessApp.GetImageReport(category.ProcessSummeryInfos)));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 今日就诊-治疗单详情
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <IActionResult> GetIntactInfo(BaseInput input)
        {
            var entity = await _patVisitApp.GetForm(input.KeyValue);

            var patient = await _patientApp.GetForm(entity.F_Pid);

            var data = new GetIntactInfoOutput
            {
                checkPerson       = entity.F_CheckPerson,
                dialysisStartTime = entity.F_DialysisStartTime,
                dialysisEndTime   = entity.F_DialysisEndTime,
                endPerson         = entity.F_EndPerson,
                memo           = entity.F_Memo,
                percent        = 0,
                puncturePerson = entity.F_PuncturePerson,
                startPerson    = entity.F_StartPerson
            };

            data.patient = new Patients
            {
                patientId     = patient.F_Id,
                headIcon      = patient.F_HeadIcon,
                ideaWeight    = patient.F_IdealWeight,
                maritalStatus = patient.F_MaritalStatus,
                patientGender = patient.F_Gender,
                patientName   = patient.F_Name
            };
            if (patient.F_BirthDay != null)
            {
                data.patient.patientAge = ((DateTime.Now - patient.F_BirthDay.ToDate()).TotalDays / 365).ToInt();
            }
            data.vitalSigns = new VitalSigns
            {
                diastolicPressure = entity.F_DiastolicPressure,
                systolicPressure  = entity.F_SystolicPressure,
                temperature       = entity.F_Temperature,
                pulse             = entity.F_Pulse
            };
            data.dialysisParameter = new DialysisParameter
            {
                accessName           = entity.F_AccessName,
                bloodSpeed           = entity.F_BloodSpeed,
                Ca                   = entity.F_Ca,
                dialysateTemperature = entity.F_DialysateTemperature,
                dialysisType         = entity.F_DialysisType,
                dialyzerType1        = entity.F_DialyzerType1,
                dialyzerType2        = entity.F_DialyzerType2,
                dilutionType         = entity.F_DilutionType,
                estimateHours        = entity.F_EstimateHours,
                exchangeAmount       = entity.F_ExchangeAmount,
                exchangeSpeed        = entity.F_ExchangeSpeed,
                Hco3                 = entity.F_Hco3,
                heparinAddAmount     = entity.F_HeparinAddAmount,
                heparinAddSpeedUnit  = entity.F_HeparinAddSpeedUnit,
                heparinAmount        = entity.F_HeparinAmount,
                heparinType          = entity.F_HeparinType,
                heparinUnit          = entity.F_HeparinUnit,
                K              = entity.F_K,
                LowCa          = entity.F_LowCa,
                Na             = entity.F_Na,
                vascularAccess = entity.F_VascularAccess
            };
            data.weightSet = new WeightSet
            {
                weightYT = entity.F_WeightYT,
                weightST = entity.F_WeightST,
                weightTQ = entity.F_WeightTQ,
                weightTH = entity.F_WeightTH
            };
            var punctureRecord = await _punctureApp.GetSingle(entity.F_Pid, entity.F_VisitDate.ToDate());

            if (punctureRecord != null)
            {
                data.punctureRecord = new PunctureRecord
                {
                    point1 = punctureRecord.F_Point1,
                    point2 = punctureRecord.F_Point2
                }
            }
            ;
            //OrdersApp ordersApp = new OrdersApp();
            var orders = (await _ordersApp.GetList(entity.F_Pid, entity.F_VisitDate.ToDate(), entity.F_VisitDate.ToDate().AddDays(1), true))
                         .Where(t => t.F_OrderType.Equals("药疗")).OrderBy(t => t.F_IsTemporary).ToList();

            //医生医嘱
            foreach (var item in orders)
            {
                data.doctorOrders.Add(new DoctorOrder
                {
                    id                  = item.F_Id,
                    isTemporary         = item.F_IsTemporary,
                    orderText           = item.F_OrderText,
                    orderUnitSpec       = item.F_OrderUnitSpec,
                    orderAmount         = item.F_OrderAmount,
                    orderFrequency      = item.F_OrderFrequency,
                    orderAdministration = item.F_OrderAdministration,
                    orderStatus         = item.F_OrderStatus
                });
            }
            //护士医嘱
            //查询医嘱执行记录
            var orderExecRecord = await _ordersApp.GetPerformedOrderListJson(entity.F_Pid, entity.F_VisitDate.ToDate());

            foreach (var item in orders.Where(t => t.F_OrderStatus >= 1))
            {
                var nurserOrder = new NurserOrder
                {
                    id                  = item.F_Id,
                    isTemporary         = item.F_IsTemporary,
                    orderText           = item.F_OrderText,
                    orderUnitSpec       = item.F_OrderUnitSpec,
                    orderAmount         = item.F_OrderAmount,
                    orderFrequency      = item.F_OrderFrequency,
                    orderAdministration = item.F_OrderAdministration
                };
                var find = orderExecRecord.FirstOrDefault(t => t.F_Oid.Equals(item.F_Id));
                if (find != null)
                {
                    nurserOrder.execTime  = find.F_NurseOperatorTime;
                    nurserOrder.nurseName = find.F_Nurse;
                }
                data.nurserOrders.Add(nurserOrder);
            }
            //观察记录
            var obs = _dialysisObservationApp.GetListByVisit(entity.F_Id);

            foreach (var item in obs.OrderBy(t => t.F_NurseOperatorTime))
            {
                data.observations.Add(new Observations
                {
                    id           = item.F_Id,
                    ssy          = item.F_SSY,
                    szy          = item.F_SZY,
                    hr           = item.F_HR,
                    a            = item.F_A,
                    bf           = item.F_BF,
                    ufr          = item.F_UFR,
                    v            = item.F_V,
                    c            = item.F_C,
                    t            = item.F_T,
                    ufv          = item.F_UFV,
                    tmp          = item.F_TMP,
                    gsl          = item.F_GSL,
                    memo         = item.F_MEMO,
                    nurseName    = item.F_Nurse,
                    operatorTime = item.F_NurseOperatorTime
                });
            }
            return(Ok(data));
        }
        /// <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));
        }