去掉docus封装的mybatisplus,druid数据源,使用多数据源DS
parent
5977556e45
commit
388d6f10a3
@ -0,0 +1,37 @@
|
|||||||
|
package com.docus.server.message.controller;
|
||||||
|
|
||||||
|
import com.docus.server.message.mapper.SdRyIcuMapper;
|
||||||
|
import com.docus.server.message.mapper.TBasicMapper;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author WYBDEV
|
||||||
|
*/
|
||||||
|
@Api("多数据源测试")
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/dynamic/test")
|
||||||
|
public class DynamicDatasourceTestController {
|
||||||
|
@Autowired
|
||||||
|
TBasicMapper tBasicMapper;
|
||||||
|
@Autowired
|
||||||
|
SdRyIcuMapper sdRyIcuMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("根据病案主键")
|
||||||
|
@GetMapping("/getPatient")
|
||||||
|
public Object getPatient(@RequestParam("patientId") String patientId,@RequestParam("db")String db){
|
||||||
|
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
|
||||||
|
|
||||||
|
stringObjectHashMap.put(sdRyIcuMapper.getClass().getName(), sdRyIcuMapper.getById(patientId));
|
||||||
|
stringObjectHashMap.put( tBasicMapper.getClass().getName(),tBasicMapper.getDischargeCount(patientId));
|
||||||
|
return stringObjectHashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.docus.server.message.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@DS("icu")
|
||||||
|
@Mapper
|
||||||
|
public interface SdRyIcuMapper {
|
||||||
|
Map<String,Object> getById(@Param("id") String patientId);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.docus.server.message.mapper.SdRyIcuMapper">
|
||||||
|
|
||||||
|
<select id="getById" resultType="java.util.Map">
|
||||||
|
SELECT *
|
||||||
|
FROM `docus_medicalrecord`.t_basic tb
|
||||||
|
WHERE tb.patient_id=#{id}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue