wlzboy
2025-10-25 a5b842f1f6ab32f1af39f4bcb7e45217e94db761
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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<HospData> 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);
    }
}