zjh
2023-12-21 d423307d3df56feb412d43f939a49195f3fff92e
ltkj-admin/src/main/java/com/ltkj/web/controller/sqlserver/TjSqlController.java
@@ -8,6 +8,7 @@
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.common.enums.DataSourceType;
import com.ltkj.framework.datasource.DynamicDataSourceContextHolder;
import com.ltkj.hosp.domain.TjCustomer;
import com.ltkj.hosp.domain.TjOrder;
import com.ltkj.hosp.domain.TjOrderRemark;
import com.ltkj.hosp.service.*;
@@ -39,7 +40,7 @@
@RestController
@RequestMapping("/sqlserver/getdata")
@Api(tags = "获取从库数据")
@Api(tags = "AAAAAAAAAAA获取从库数据")
public class TjSqlController extends BaseController {
    @Resource
    private TestMapper testMapper;
@@ -62,6 +63,8 @@
    private LtkjHysqdService ltkjHysqdService;
    @Autowired
    public RedisTemplate<Object,Object> redisTemplate;
    @Resource
    private ITjCustomerService tjCustomerService;
    @Resource
    private RedisCache redisCache;
    @Resource
@@ -126,6 +129,7 @@
    @GetMapping("/getMiddleDetail")
    @ApiOperation(value = "查询收费项目详情")
    public AjaxResult getMiddleDetail() {
        List<LtkjMiddleDetail> list = testMapper.getMiddleDetail();
        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
@@ -138,6 +142,7 @@
    @GetMapping("/getMiddleHead")
    @ApiOperation(value = "查询收费信息")
    public AjaxResult getMiddleHead() {
        List<LtkjMiddleHead> list = testMapper.getMiddleHead();
        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
@@ -148,15 +153,32 @@
        return AjaxResult.success(list);
    }
//    @GetMapping("/getVbjitem")
//    @ApiOperation(value = "查看列表")
//    public AjaxResult getVbjitem() {
//        List<LtkjVbjitem> list = testMapper.getVbjitem();
//        return AjaxResult.success(list);
//    }
    @GetMapping("/getMiddleHeadByPartId")
    @ApiOperation(value = "根据身份证号查询收费信息")
    public AjaxResult getMiddleHeadByPartId(@RequestParam String partId) {
        TjCustomer customer = tjCustomerService.getTjCustomerByCusIdCard(partId);
        LtkjMiddleHead pat = testMapper.getMiddleHeadByPartId(customer.getCardId());
        if (null != pat) {
            List<LtkjMiddleDetail> list = testMapper.getMiddleDetailByFeadId(pat.getFeadId());
            DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
            LtkjMiddleHead o = headService.getMiddleHeadByPartId(customer.getCardId());
            if(o==null){
                headService.save(pat);
                for (LtkjMiddleDetail ltkjMiddleDetail : list) {
                    middleDetailService.save(ltkjMiddleDetail);
                }
                testMapper.saveTjProByCusId(customer.getCardId(),customer.getCusIdcard());
            }
            testMapper.saveTjProByCusId(customer.getCardId(),customer.getCusIdcard());
        }
        DynamicDataSourceContextHolder.clearDataSourceType();
        return AjaxResult.success();
    }
    @GetMapping("/getTjPat")
    @ApiOperation(value = "测试getTjPat")
    public AjaxResult getTjPat() {
        List<LtkjTjPat> list = testMapper.getTjPat();
        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
@@ -167,6 +189,31 @@
        return AjaxResult.success(list);
    }
    @GetMapping("/getTjPatByIdCard")
    @ApiOperation(value = "根据身份证号测试getTjPat")
    public AjaxResult getTjPatByIdCard(@RequestParam String idCard) {
        LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(idCard.trim());
        if(null != tjPatByIdCard){
            String fcardNo = tjPatByIdCard.getFcardNo();
            if(null !=fcardNo){
                fcardNo=fcardNo.trim();
                tjPatByIdCard.setFcardNo(fcardNo);
            }
            LtkjTjPat ltkjTjPat = tjvLtkjvtjpatService.getLtkjTjPatByCusIdCard(idCard);
            if(null==ltkjTjPat){
                tjvLtkjvtjpatService.save(tjPatByIdCard);
            }
        }
        DynamicDataSourceContextHolder.clearDataSourceType();
        //再根据身份证号写customer表
        TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(idCard);
        if(null == tjCustomer){
            testMapper.getTjPatByCusId(idCard);
        }
        return AjaxResult.success(tjPatByIdCard);
    }
    @GetMapping("/getExamJcbgd")
    public AjaxResult getExamJcbgd() {
        List<LtkjExamJcbgd> list = testMapper.getExamJcbgd();