zjh
2023-10-17 4d1cc2fd7553f3c648da150971cd4a87c282f5ad
ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
@@ -7,6 +7,7 @@
import com.ltkj.common.core.domain.entity.SysUser;
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.common.utils.StringUtils;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
import com.ltkj.hosp.vodomain.AddNewReservationConfirm;
@@ -81,6 +82,12 @@
    private ITjAdviceService tjAdviceService;
    @Resource
    private ISysUserService userService;
    @Resource
    private IJimuOnlineReportService reportService;
    @Resource
    private ITjDwDeptService dwDeptService;
    @Resource
    private ITjPrintOrderService printOrderService;
    @Override
@@ -903,13 +910,54 @@
        redisCache.setCacheMapValue("updateCheckType"+tjNum,tjNum,getAjaxResult(tjNum));
    }
//    @Override
//    @Async("async")
//    public void addRedis(List<TjCustomer> customers) {
//        for (TjCustomer customer : customers) {
//            redisCache.setCacheMapValue("updateCheckType"+customer.getTjNumber(),customer.getTjNumber(),getAjaxResult(customer.getTjNumber()));
//        }
//    }
    @Override
    @Async("async")
    public void getPrintOrderList(List<TjOrder> list) {
        redisCache.setCacheMapValue("getPrintOrderList","0",extracted(0, list));
        redisCache.setCacheMapValue("getPrintOrderList","1",extracted(1, list));
    }
    private List<TjOrder> extracted(Integer type, List<TjOrder> list) {
        List<TjOrder> list1=new ArrayList<>();
        for (TjOrder order : list) {
            TjCustomer tjCustomer = tjCustomerService.selectTjCustomerByCusId(order.getUserId());
            if (null != tjCustomer) {
                order.setTjCustomerSex(tjCustomer.getCusSex());
                order.setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
                order.setGrMoBanId(reportService.getGrMoBanIds());
                order.setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName()));
                if(null!=tjCustomer.getCusPhone())order.setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
                if(null!=tjCustomer.getCusIdcard())order.setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
            }
            String firmId = order.getFirmId();
            if (firmId != null && null != compService.selectDictCompByDrugManufacturerId(String.valueOf(order.getFirmId()))) {
                order.setDictCompName(compService.selectDictCompByDrugManufacturerId(String.valueOf(order.getFirmId())).getCnName());
            }
            if (null != order.getPacId()) {
                if (null != tjPackageService.getById(order.getPacId())) {
                    order.setPacName(tjPackageService.getById(order.getPacId()).getPacName());
                }
                if (null != dwDeptService.getById(order.getPacId())) {
                    order.setPacName(dwDeptService.getById(order.getPacId()).getDwDeptName());
                }
            }
            //从打印记录查出最新打印时间
            TjPrintOrder one = printOrderService.getTjPrintOrderByTjNum(order.getTjNumber());
            if (null != type && type == 1 && one != null) {
                order.setPrintTime(one.getCreateTime());
                order.setPrintName(one.getCreateBy());
                order.setType(1);
                list1.add(order);
            }
            if (null != type && type == 0 && one == null) {
                order.setType(0);
                list1.add(order);
            }
        }
        return list1;
    }
    private void getTjPackageListsByMan(List<TjPackage> tjPackageList) {
        if (null != tjPackageList && tjPackageList.size() > 0) {