package com.ruoyi.web.controller.system; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.domain.HospData; import com.ruoyi.system.mapper.HospDataMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * 医院数据Controller * * @author ruoyi * @date 2024-01-16 */ @RestController @RequestMapping("/system/hospital") public class HospDataController extends BaseController { @Autowired private HospDataMapper hospDataMapper; /** * 搜索医院 * 支持根据医院名称、地址、地域进行模糊搜索 * @param keyword 搜索关键词(医院名称、地址、简称、省市区) * @param region 地域关键词(用于过滤省市区) */ @GetMapping("/search") public AjaxResult searchHospitals( @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "region", required = false) String region) { List list = hospDataMapper.searchHospitals(keyword, region); return success(list); } /** * 根据ID获取医院详情 */ @GetMapping("/detail") public AjaxResult getHospitalDetail(@RequestParam("hospId") Integer hospId) { HospData hospital = hospDataMapper.selectHospDataById(hospId); return success(hospital); } /** * 获取常用转出医院列表 * @param serviceOrdClass 分公司编码(service_order_class) * @param region 地域关键词(可选) */ @GetMapping("/frequent/out") public AjaxResult getFrequentOutHospitals( @RequestParam("serviceOrdClass") String serviceOrdClass, @RequestParam(value = "region", required = false) String region) { // 查询常用转出医院ID列表 List hospIds = hospDataMapper.selectFrequentOutHospitalIds(serviceOrdClass); if (hospIds == null || hospIds.isEmpty()) { return success(); } Integer homeHospId=hospDataMapper.getHomeHospId(); if (!hospIds.contains(homeHospId)) { hospIds.add(0,homeHospId); } // 根据ID列表查询医院详情 List hospitals = hospDataMapper.selectHospDataByIds(hospIds, region); return success(hospitals); } /** * 获取常用转入医院列表 * @param serviceOrdClass 分公司编码(service_order_class) * @param region 地域关键词(可选) */ @GetMapping("/frequent/in") public AjaxResult getFrequentInHospitals( @RequestParam("serviceOrdClass") String serviceOrdClass, @RequestParam(value = "region", required = false) String region) { // 查询常用转入医院ID列表 List hospIds = hospDataMapper.selectFrequentInHospitalIds(serviceOrdClass); if (hospIds == null || hospIds.isEmpty()) { return success(); } Integer homeHospId=hospDataMapper.getHomeHospId(); if (!hospIds.contains(homeHospId)) { hospIds.add(0,homeHospId); } // 根据ID列表查询医院详情 List hospitals = hospDataMapper.selectHospDataByIds(hospIds, region); return success(hospitals); } }