public async Task <IActionResult> GetDoctorListByParentOfficeNodeAsync([FromBody] GetDoctorListByParentOfficeNodeRequestDto requestDto) { var officeBiz = new OfficeBiz(); //获取选择的科室model var officeModel = await officeBiz.GetAsync(requestDto.OfficeGuid); var officeIds = new List <string>(); //获取医院下所有科室 var officeModels = await officeBiz.GetHospitalOfficeAllAsync(requestDto.HospitalGuid); if (string.IsNullOrWhiteSpace(requestDto.OfficeGuid)) { var levelOneOffices = officeBiz.GetHospitalOffice(requestDto.HospitalGuid, null); foreach (var item in levelOneOffices) { officeIds.AddRange(officeBiz.GetOfficeListByParentOfficeNode(item.OfficeGuid, officeModels)); } } else { officeIds.AddRange(officeBiz.GetOfficeListByParentOfficeNode(officeModel.OfficeGuid, officeModels)); } requestDto.OfficeIds = officeIds; var response = await new DoctorBiz().GetDoctorListByParentOfficeNodeAsync(requestDto); return(Success(response)); }
public async Task <IActionResult> EvaluvationAsync([FromBody] CreateHospitalEvaluvationRequestDto request) { if (request.Tags.Count() <= 0) { return(Failed(ErrorCode.Empty, "评价标签必填")); } var tag = string.Join("", request.Tags); if (tag.Length > 500) { return(Failed(ErrorCode.Empty, "评价标签超过最大长度限制")); } if (request.Score <= 0 || request.Score > 5) { return(Failed(ErrorCode.Empty, "满意度参数不正确")); } var hospitalBiz = new HospitalBiz(); var hospital = await hospitalBiz.GetAsync(request.HospitalGuid); if (hospital is null) { return(Failed(ErrorCode.Empty, "医院不存在,请检查提交参数")); } if (!hospital.Enable) { return(Failed(ErrorCode.Empty, $"医院“{hospital.HosName}”已被禁用,无法提交")); } var officeBiz = new OfficeBiz(); var office = await officeBiz.GetAsync(request.OfficeGuid); if (office is null) { return(Failed(ErrorCode.Empty, "科室不存在,请检查提交参数")); } if (!office.Enable) { return(Failed(ErrorCode.Empty, $"科室“{office.OfficeName}”已被禁用,无法提交")); } if (!office.HospitalGuid.Equals(hospital.HospitalGuid)) { return(Failed(ErrorCode.Empty, $"科室“{office.OfficeName}”不属于医院“{hospital.HosName}”,无法提交")); } var evaluationBiz = new HospitalEvaluationBiz(); var evaluvation = await evaluationBiz.GetAsync(request.EvaluationGuid); if (evaluvation is null) { return(Failed(ErrorCode.Empty, "预评论参数不正确,请检查")); } if (!string.IsNullOrEmpty(evaluvation.UserGuid)) { return(Failed(ErrorCode.Empty, "已提交,请勿重复提交")); } evaluvation.UserGuid = UserID; evaluvation.HospitalGuid = hospital.HospitalGuid; evaluvation.OfficeGuid = office.OfficeGuid; evaluvation.EvaluationTag = JsonConvert.SerializeObject(request.Tags); evaluvation.Score = request.Score; evaluvation.ConditionDetail = request.ConditionDetail; evaluvation.Anonymous = request.Anonymous; evaluvation.CreatedBy = UserID; evaluvation.LastUpdatedBy = UserID; var result = await evaluationBiz.UpdateAsync(evaluvation); if (!result) { return(Failed(ErrorCode.DataBaseError, "提交评论失败,请稍后重试")); } return(Success()); }