Example #1
0
        public Task <int> SubmitForm <TDto>(PunctureEntity entity, TDto dto) where TDto : class
        {
            var userId = _usersService.GetCurrentUserId();

            if (!string.IsNullOrEmpty(entity.F_Id))
            {
                entity.Modify(entity.F_Id);
                entity.F_LastModifyUserId = userId;
                return(_service.UpdateAsync(entity, dto));
            }
            else
            {
                entity.Create();
                if (entity.F_EnabledMark == null)
                {
                    entity.F_EnabledMark = true;
                }
                entity.F_CreatorUserId = userId;
                entity.F_Nurse         = userId;
                return(_service.InsertAsync(entity));
            }
        }
Example #2
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("操作成功。"));
        }
        public async Task <IActionResult> SubmitData([FromBody] SubmitDataInput input)
        {
            if (input == null || string.IsNullOrEmpty(input.patientId))
            {
                return(BadRequest("患者ID未传值!"));
            }
            var userId = _usersService.GetCurrentUserId();

            if (string.IsNullOrEmpty(input.id))//新建
            {
                var entity = new PunctureEntity
                {
                    F_Id            = Common.GuId(),
                    F_CreatorTime   = System.DateTime.Now,
                    F_CreatorUserId = userId,
                    F_Nurse         = userId,
                    F_OperateTime   = input.operateTime ?? System.DateTime.Now,
                    F_IsSuccess     = input.isSucess,
                    F_EnabledMark   = true,
                    F_Point1        = input.point1,
                    F_Point2        = input.point2,
                    F_Pid           = input.patientId
                };

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

                if (patient != null)
                {
                    var visitDate = entity.F_OperateTime.ToDate().Date;
                    var patVisit  = _patVisitApp.GetList().FirstOrDefault(t => t.F_Pid == patient.F_Id && t.F_VisitDate == visitDate);//patient.F_Id, visitDate
                    if (patVisit != null)
                    {
                        //更新治疗单 穿刺者信息
                        patVisit.F_PuncturePerson = userId;
                        await _patVisitApp.UpdateForm(patVisit);
                    }
                    else
                    {
                        return(BadRequest(patient.F_Name + "(" + visitDate.ToDateString() + ")无透析记录!"));
                    }
                }
                else
                {
                    return(BadRequest("患者ID有误!"));
                }
                await _punctureApp.InsertForm(entity);

                return(Ok(entity.F_Id));
            }
            else
            {
                var entity = new PunctureEntity
                {
                    F_LastModifyTime   = DateTime.Now,
                    F_LastModifyUserId = userId
                };
                await _punctureApp.UpdateForm(entity);

                return(Ok(entity.F_Id));
            }
        }
Example #4
0
 public Task <int> UpdateForm(PunctureEntity entity)
 {
     return(_service.UpdatePartialAsync(entity));
 }
Example #5
0
 public Task <int> InsertForm(PunctureEntity entity)
 {
     entity.Create();
     entity.F_CreatorUserId = _usersService.GetCurrentUserId();
     return(_service.InsertAsync(entity));
 }