Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateParameter([FromBody] UpdateParameterInput input)
        {
            var entity = new PatVisitEntity
            {
                F_Id                   = input.id,
                F_DialysisType         = input.dialysisType,
                F_DilutionType         = input.dilutionType,
                F_ExchangeAmount       = input.exchangeAmount,
                F_ExchangeSpeed        = input.exchangeSpeed,
                F_BloodSpeed           = input.bloodSpeed,
                F_DialysateTemperature = input.dialysateTemperature,
                F_EstimateHours        = input.estimateHours,
                F_VascularAccess       = input.vascularAccess,
                F_AccessName           = input.accessName,
                F_DialyzerType1        = input.dialyzerType1,
                F_DialyzerType2        = input.dialyzerType2,
                F_HeparinType          = input.heparinType,
                F_HeparinAmount        = input.heparinAmount,
                F_HeparinUnit          = input.heparinUnit,
                F_HeparinAddAmount     = input.heparinAddAmount,
                F_HeparinAddSpeedUnit  = input.heparinAddSpeedUnit,
                F_Ca                   = input.Ca,
                F_K     = input.K,
                F_Na    = input.Na,
                F_Hco3  = input.Hco3,
                F_LowCa = input.LowCa
            };
            await _patVisitApp.UpdateForm(entity);

            return(Ok("操作成功"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> UpdateVitalSigns([FromBody] UpdateVitalSignsInput input)
        {
            var entity = new PatVisitEntity
            {
                F_Id = input.id,
                F_SystolicPressure  = input.systolicPressure,
                F_DiastolicPressure = input.diastolicPressure,
                F_Pulse             = input.pulse,
                F_Temperature       = input.temperature
            };
            await _patVisitApp.UpdateForm(entity);

            return(Ok("操作成功"));
        }
        public async Task <IActionResult> SubmitFormCreatePatVisit([FromBody] BaseInput input)
        {
            //总数
            int count = 0;
            //新增数
            int addnum = 0;

            //SettingApp settingApp = new SettingApp();
            //var list = keyValue.ToJArrayObject().Select(t =>t.Value<string>("F_Id"));
            foreach (var id in input.KeyValue.ToJArrayObject().Select(t => t.Value <string>("F_Id")))
            {
                var schedule = await _dialysisScheduleApp.GetForm(id);

                count++;
                var patient = await _patientApp.GetForm(schedule.F_PId);

                //判断是否存在申请单
                if (_patVisitApp.GetList().Count(t => t.F_Pid == patient.F_Id && t.F_VisitDate == schedule.F_VisitDate) > 0)
                {
                    continue;
                }

                //查询透析参数
                var settings = (await _settingApp.GetList(schedule.F_PId)).OrderByDescending(t => t.F_CreatorTime);

                if (string.IsNullOrEmpty(schedule.F_DialysisType))
                {
                    schedule.F_DialysisType = "HD";
                }

                var            firstSetting = settings.FirstOrDefault(t => t.F_DialysisType == schedule.F_DialysisType);
                PatVisitEntity entity;
                if (firstSetting != null)
                {
                    entity = new PatVisitEntity
                    {
                        F_VisitDate        = schedule.F_VisitDate,
                        F_VisitNo          = schedule.F_VisitNo,
                        F_BirthDay         = patient.F_BirthDay,
                        F_Pid              = patient.F_Id,
                        F_DialysisBedNo    = schedule.F_DialysisBedNo,
                        F_DialysisNo       = patient.F_DialysisNo,
                        F_DialysisType     = schedule.F_DialysisType,
                        F_EnabledMark      = true,
                        F_Gender           = patient.F_Gender,
                        F_GroupName        = schedule.F_GroupName,
                        F_HeparinAddAmount = firstSetting.F_HeparinAddAmount,
                        F_HeparinAmount    = firstSetting.F_HeparinAmount,
                        F_HeparinType      = firstSetting.F_HeparinType,
                        F_HeparinUnit      = firstSetting.F_HeparinUnit,
                        F_AccessName       = firstSetting.F_AccessName,
                        F_BloodSpeed       = firstSetting.F_BloodSpeed,
                        F_Ca    = firstSetting.F_Ca,
                        F_K     = firstSetting.F_K,
                        F_Na    = firstSetting.F_Na,
                        F_Hco3  = firstSetting.F_Hco3,
                        F_LowCa = firstSetting.F_LowCa,
                        F_DialysateTemperature = firstSetting.F_DialysateTemperature,
                        F_DialyzerType1        = firstSetting.F_DialyzerType1,
                        F_DialyzerType2        = firstSetting.F_DialyzerType2,
                        F_DilutionType         = firstSetting.F_DilutionType,
                        F_EstimateHours        = firstSetting.F_EstimateHours,
                        F_VascularAccess       = firstSetting.F_VascularAccess,
                        F_InpNo         = patient.F_PatientNo,
                        F_RecordNo      = patient.F_RecordNo,
                        F_IsCritical    = false,
                        F_Name          = patient.F_Name,
                        F_PatientSourse = null
                    };
                }
                else
                {
                    entity = new PatVisitEntity
                    {
                        F_VisitDate        = schedule.F_VisitDate,
                        F_VisitNo          = schedule.F_VisitNo,
                        F_BirthDay         = patient.F_BirthDay,
                        F_Pid              = patient.F_Id,
                        F_DialysisBedNo    = schedule.F_DialysisBedNo,
                        F_DialysisNo       = patient.F_DialysisNo,
                        F_DialysisType     = schedule.F_DialysisType,
                        F_EnabledMark      = true,
                        F_Gender           = patient.F_Gender,
                        F_GroupName        = schedule.F_GroupName,
                        F_HeparinAddAmount = null,
                        F_HeparinAmount    = null,
                        F_HeparinType      = null,
                        F_HeparinUnit      = null,
                        F_InpNo            = patient.F_PatientNo,
                        F_RecordNo         = patient.F_RecordNo,
                        F_IsCritical       = false,
                        F_Name             = patient.F_Name,
                        F_PatientSourse    = null
                    };
                }
                await _patVisitApp.SubmitForm(entity, new object());

                addnum++;
            }
            return(Success("操作成功,新增治疗单 " + addnum + " 个  , 总数:" + count));
        }
Ejemplo n.º 4
0
        public Task <int> SubmitForm <TDto>(PatVisitEntity entity, TDto dto) where TDto : class
        {
            if (!string.IsNullOrEmpty(entity.F_Id))
            {
                entity.Modify(entity.F_Id);

                if (entity.F_WeightTQ != null)//手工录入透前体重
                {
                    var expression = ExtLinq.True <PatVisitEntity>();
                    expression = expression.And(t => t.F_Id == entity.F_Id);
                    var find = _service.IQueryable(expression).Select(t => new
                    {
                        //t.F_Pid,
                        t.F_FirstWeightTime,
                        //t.F_WeightYT,
                        t.F_VisitDate
                    }).FirstOrDefault();
                    if (find != null)
                    {
                        if (find.F_FirstWeightTime == null && find.F_VisitDate.ToDate().Date == DateTime.Now.Date)
                        {
                            entity.F_FirstWeightTime = DateTime.Now;
                        }
                    }
                }

                return(_service.UpdateAsync(entity, dto));
            }
            else
            {
                entity.Create();

                if (entity.F_VisitDate == null)
                {
                    entity.F_VisitDate = DateTime.Now.Date;
                }
                if (entity.F_FirstWeightTime == null && entity.F_WeightTQ != null)
                {
                    entity.F_FirstWeightTime = DateTime.Now;
                }


                //查询30天内最近的一次透析记录
                var exp = ExtLinq.True <PatVisitEntity>();
                exp = exp.And(t => t.F_Pid == entity.F_Pid);
                var dt = DateTime.Now.AddDays(-30).Date;
                exp = exp.And(t => t.F_VisitDate >= dt);
                var findList   = _service.IQueryable(exp).OrderByDescending(t => t.F_VisitDate);
                var lastEntity = findList.FirstOrDefault(t => t.F_DialysisType == entity.F_DialysisType && t.F_DialysisType != null) ?? findList.FirstOrDefault();
                //var lastEntity = _service.IQueryable(exp).OrderByDescending(t=>t.F_VisitDate).ToList().FirstOrDefault();

                if (lastEntity != null)
                {
                    if (entity.F_WeightSXTH == null)
                    {
                        entity.F_WeightSXTH = lastEntity.F_WeightTH;
                    }
                    //复制其他的值
                    if (entity.F_AccessName == null)
                    {
                        entity.F_AccessName = lastEntity.F_AccessName;
                    }
                    if (entity.F_Ca == null)
                    {
                        entity.F_Ca = lastEntity.F_Ca;
                    }
                    if (entity.F_DialyzerType1 == null)
                    {
                        entity.F_DialyzerType1 = lastEntity.F_DialyzerType1;
                    }
                    if (entity.F_DialyzerType1 == null)
                    {
                        entity.F_DialyzerType1 = lastEntity.F_DialyzerType1;
                    }
                    if (entity.F_DialyzerType2 == null)
                    {
                        entity.F_DialyzerType2 = lastEntity.F_DialyzerType2;
                    }
                    if (entity.F_DilutionType == null)
                    {
                        entity.F_DilutionType = lastEntity.F_DilutionType;
                    }
                    if (entity.F_Hco3 == null)
                    {
                        entity.F_Hco3 = lastEntity.F_Hco3;
                    }
                    if (entity.F_IsCritical == null)
                    {
                        entity.F_IsCritical = lastEntity.F_IsCritical;
                    }
                    if (entity.F_K == null)
                    {
                        entity.F_K = lastEntity.F_K;
                    }
                    if (entity.F_Na == null)
                    {
                        entity.F_Na = lastEntity.F_Na;
                    }
                    if (entity.F_PatientSourse == null)
                    {
                        entity.F_PatientSourse = lastEntity.F_PatientSourse;
                    }
                    if (entity.F_VascularAccess == null)
                    {
                        entity.F_VascularAccess = lastEntity.F_VascularAccess;
                    }

                    if (entity.F_BloodSpeed == null)
                    {
                        entity.F_BloodSpeed = lastEntity.F_BloodSpeed;
                    }
                    if (entity.F_DialysateTemperature == null)
                    {
                        entity.F_DialysateTemperature = lastEntity.F_DialysateTemperature;
                    }
                    if (entity.F_EstimateHours == null)
                    {
                        entity.F_EstimateHours = lastEntity.F_EstimateHours;
                    }
                }

                //抗凝剂 策略 以透析参数设置为主,不存在是查询最后一次的透析记录
                lastEntity = findList.FirstOrDefault();
                if (lastEntity != null)
                {
                    if (entity.F_HeparinAddAmount == null)
                    {
                        entity.F_HeparinAddAmount = lastEntity.F_HeparinAddAmount;
                    }
                    if (entity.F_HeparinAmount == null)
                    {
                        entity.F_HeparinAmount = lastEntity.F_HeparinAmount;
                    }
                    if (entity.F_HeparinType == null)
                    {
                        entity.F_HeparinType = lastEntity.F_HeparinType;
                    }
                    if (entity.F_HeparinUnit == null)
                    {
                        entity.F_HeparinUnit = lastEntity.F_HeparinUnit;
                    }
                }

                entity.F_EnabledMark = true;

                return(_service.InsertAsync(entity));
            }
        }
Ejemplo n.º 5
0
 public Task <int> UpdateForm(PatVisitEntity entity)
 {
     return(_service.UpdatePartialAsync(entity));
 }
Ejemplo n.º 6
0
 public Task <int> InsertForm(PatVisitEntity entity)
 {
     return(_service.InsertAsync(entity));
 }