Пример #1
0
        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));
        }
Пример #2
0
        public IActionResult GetHospitalOfficeTree()
        {
            var hospitalBiz = new HospitalBiz();
            var officeBiz   = new OfficeBiz();
            var hospitals   = hospitalBiz.GetAllHospital();

            if (hospitals == null)
            {
                return(Failed(ErrorCode.Empty, "没有查到医院数据!"));
            }
            var hospitalDto = hospitals.Select(a => a.ToDto <GetHospitalOfficeTreeItemDto>()).ToList();

            foreach (var hospital in hospitalDto)
            {
                var topOffices = officeBiz.GetHospitalOffice(hospital.HospitalGuid, null);
                if (topOffices == null || !topOffices.Any())
                {
                    continue;
                }
                var officeDtos = topOffices.Select(a => a.ToDto <GetHospitalOfficeTreeOfficeItemDto>()).ToList();
                officeDtos.ForEach(GetSubordinateOffeces);
                hospital.Offeces = officeDtos;
            }
            return(Success(hospitalDto));
        }
Пример #3
0
        /// <summary>
        /// 递归获取下属科室
        /// </summary>
        /// <param name="offceDto"></param>
        private void GetSubordinateOffeces(GetHospitalOfficeTreeOfficeItemDto offceDto)
        {
            var officeBiz = new OfficeBiz();
            var offices   = officeBiz.GetHospitalOffice(offceDto.HospitalGuid, offceDto.OfficeGuid);

            if (offices == null || !offices.Any())
            {
                return;
            }
            var tmps = offices.Select(a => a.ToDto <GetHospitalOfficeTreeOfficeItemDto>()).ToList();

            offceDto.SubordinateOffeces = tmps;
            foreach (var item in tmps)
            {
                GetSubordinateOffeces(item);
            }
        }
Пример #4
0
        public IActionResult GetOfficesByParent([FromBody] GetOfficesByParentRequestDto officeDto)
        {
            OfficeBiz officeBiz = new OfficeBiz();
            var       offices   = officeBiz.GetHospitalOffice(officeDto.HospitalGuid, officeDto.ParentOfficeGuid);

            if (offices == null || !offices.Any())
            {
                return(Failed(ErrorCode.Empty, "没有获取到下属科室"));
            }
            var responseDto = offices.Select(a => new GetOfficesByParentResponseDto
            {
                OfficeGuid = a.OfficeGuid,
                OfficeName = a.OfficeName
            });

            return(Success(responseDto));
        }