package com.ruoyi.web.controller.smartor; import com.ruoyi.common.annotation.AddOrgId; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysDeptService; import com.smartor.domain.Icd10; import com.smartor.domain.ServiceTaskSchedule; import com.smartor.domain.ServiceTaskdiag; import com.smartor.service.IIcd10Service; import com.smartor.service.IServiceTaskScheduleService; import com.smartor.service.IServiceTaskdiagService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import static com.alibaba.fastjson2.JSONValidator.Type.Array; /** * 随访任务组关联Controller * * @author 陈昶聿 * @date 2026-08-06 */ @Api("随访任务组关联") @RestController @RequestMapping("/smartor/taskSchedule") public class ServiceTaskscheduleController extends BaseController { @Autowired private IServiceTaskScheduleService serviceTaskScheduleService; @Autowired private IIcd10Service icd10Service; @Autowired private ISysDeptService sysDeptService; /** * 查询随访任务组科室关联列表 */ @ApiOperation("查询随访任务组科室关联列表") @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") @PostMapping("getTaskScheduleDeptList") public Map getTaskScheduleDeptList(@RequestBody ServiceTaskSchedule serviceTaskSchedule) { List list = new ArrayList<>(); //任务组信息 if(ObjectUtils.isNotEmpty(serviceTaskSchedule.getTaskid())){ ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTaskSchedule.getTaskid()); if(ObjectUtils.isNotEmpty(schedule) && StringUtils.isNotEmpty(schedule.getDeptCodes())){ String[] split = schedule.getDeptCodes().split(","); SysDept sysDept = new SysDept(); sysDept.setOrgid(schedule.getOrgid()); sysDept.setDeptType("1"); sysDept.setDeptCodes(new ArrayList<>(Arrays.asList(split))); list = sysDeptService.selectDeptList(sysDept); } if(ObjectUtils.isNotEmpty(schedule) && StringUtils.isNotEmpty(schedule.getWardCodes())){ String[] split = schedule.getWardCodes().split(","); SysDept sysDept = new SysDept(); sysDept.setOrgid(schedule.getOrgid()); sysDept.setDeptType("2"); sysDept.setDeptCodes(new ArrayList<>(Arrays.asList(split))); list = sysDeptService.selectDeptList(sysDept); } } return getDataTable3(CollectionUtils.isEmpty(list) ? 0 : list.size(), list); } /** * 查询随访任务组疾病关联列表 */ @ApiOperation("查询随访任务组疾病关联列表") @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") @PostMapping("getTaskScheduleDiagList") public Map getTaskScheduleDiagList(@RequestBody ServiceTaskSchedule serviceTaskSchedule) { List list = new ArrayList<>(); //任务组信息 if(ObjectUtils.isNotEmpty(serviceTaskSchedule.getTaskid())){ ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTaskSchedule.getTaskid()); if(ObjectUtils.isNotEmpty(schedule) && StringUtils.isNotEmpty(schedule.getIcd10Codes())){ Icd10 icd10 = new Icd10(); String[] split = schedule.getIcd10Codes().split(","); icd10.setIcdcodes(new ArrayList<>(Arrays.asList(split))); icd10.setOrgid(schedule.getOrgid()); list = icd10Service.selectIcd10List(icd10); } } return getDataTable3(CollectionUtils.isEmpty(list) ? 0 : list.size(), list); } }