赵文轩
2024-06-05 f552224e3f83b32b9dace6ab0b3c37c861261b3d
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
@@ -7,6 +7,7 @@
import com.ltkj.common.enums.DataSourceType;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.framework.datasource.DynamicDataSourceContextHolder;
import com.ltkj.hosp.domain.TjCustomerBlack;
import com.ltkj.hosp.domain.TjReservation;
import com.ltkj.hosp.mapper.TestMapper;
import com.ltkj.hosp.service.*;
@@ -24,9 +25,12 @@
import com.ltkj.hosp.domain.TjCustomer;
import com.ltkj.common.utils.poi.ExcelUtil;
import com.ltkj.common.core.page.TableDataInfo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -58,6 +62,8 @@
    private LtkjMiddleDetailService middleDetailService;
    @Resource
    private ITjOrderService tjOrderService;
    @Resource
    private TjCustomerBlackService blackService;
    @GetMapping("/newGetTjPat")
    @ApiOperation(value = "查询his数据库返回新的数据")
@@ -66,7 +72,28 @@
                                  @RequestParam(required = false)String pacRemark) {
        List<Map<String, Object>> maps = testMapper.newGetTjPat(pacCode,pacName,pacRemark);
        DynamicDataSourceContextHolder.clearDataSourceType();
//        List<Map<String, Object>> list=new ArrayList<>();
//        if(null !=maps && maps.size()>0){
//            for (Map<String, Object> map : maps) {
//                String pacCode1 = map.get("pacCode").toString();
//                List<String> s = tjOrderService.selectTjOrderByCardId1();
//                if(null !=s && s.size()>0){
//                    if(s.contains(pacCode1)){
////                        maps.remove(map);
//                        continue;
//                    }
//                    list.add(map);
//                }
//            }
//        }
        List<String> strings = tjOrderService.selectTjOrderByCardId1();
        if(null !=strings && strings.size()>0){
            List<Map<String, Object>> collect = maps.stream()
                    .filter(item ->  !strings.contains(item.get("pacCode").toString())).collect(Collectors.toList());
            return AjaxResult.success(collect);
        }
        return AjaxResult.success(maps);
//        return AjaxResult.success(maps);
    }
@@ -97,8 +124,11 @@
                LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(cusIdcard);
                if(null != tjPatByIdCard){
                    String fcardNo = tjPatByIdCard.getFcardNo();
                    if(null !=fcardNo){
                    if(null !=fcardNo && !fcardNo.equals("")){
                        fcardNo=fcardNo.trim();
                        tjPatByIdCard.setFcardNo(fcardNo);
                    }else {
                        fcardNo=cusIdcard.trim();
                        tjPatByIdCard.setFcardNo(fcardNo);
                    }
                    //根据身份证号从数据库拿信息 没有的话保存
@@ -221,6 +251,12 @@
        //从his表抓数据
        LtkjMiddleHead pat = testMapper.getMiddleHeadByPartId(customer.getCardId());
        if (null != pat) {
            LambdaQueryWrapper<LtkjMiddleHead> wq1=new LambdaQueryWrapper<>();
            wq1.eq(LtkjMiddleHead::getFeadId,customer.getCardId());
            headService.remove(wq1);
            LambdaQueryWrapper<LtkjMiddleDetail> wq0=new LambdaQueryWrapper<>();
            wq0.eq(LtkjMiddleDetail::getFheadId,pat.getFeadId());
            middleDetailService.remove(wq0);
            List<LtkjMiddleDetail> list = testMapper.getMiddleDetailByFeadId(pat.getFeadId());
            DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
            LtkjMiddleHead o = headService.getMiddleHeadByPartId(customer.getCardId());
@@ -247,9 +283,15 @@
        List<TjCustomer> list = tjCustomerService.selectTjCustomerList(tjCustomer);
        if(null !=list && list.size()>0){
            for (TjCustomer customer : list) {
                customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
//                customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
                customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                TjCustomerBlack tjCustomerBlack = blackService.isTjCustomerBlack(String.valueOf(customer.getCusId()));
                if(null !=tjCustomerBlack){
                   customer.setIsBlack("Y");
                }else {
                   customer.setIsBlack("N");
                }
            }
        }
        return getDataTable(list);