zjh
2023-10-25 8c4968ea3bd61c154c71d40f43a2cc22760fef49
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,14 @@
    private ITjAdviceService tjAdviceService;
    @Resource
    private ISysUserService userService;
    @Resource
    private IJimuOnlineReportService reportService;
    @Resource
    private ITjDwDeptService dwDeptService;
    @Resource
    private ITjPrintOrderService printOrderService;
    @Resource
    private IDictSfxmService dictSfxmService;
    @Override
@@ -905,12 +914,75 @@
    @Override
    @Async("async")
    public void addRedis(List<TjCustomer> customers) {
        for (TjCustomer customer : customers) {
            redisCache.setCacheMapValue("updateCheckType"+customer.getTjNumber(),customer.getTjNumber(),getAjaxResult(customer.getTjNumber()));
        }
    public void getPrintOrderList(List<TjOrder> list) {
        redisCache.setCacheMapValue("getPrintOrderList","0",extracted(0, list));
        redisCache.setCacheMapValue("getPrintOrderList","1",extracted(1, list));
    }
    @Override
    @Async("async")
    public void getDictSfxms() {
        List<DictSfxm> dictSfxm = getDictSfxm();
        redisCache.setCacheObject("getDictSfxms",dictSfxm);
    }
    private List<DictSfxm> getDictSfxm() {
        List<DictSfxm> dictSfxms = dictSfxmService.getYjDictSfxmList();
        if (null != dictSfxms && dictSfxms.size() > 0) {
            for (DictSfxm dictSfxm : dictSfxms) {
                List<DictSfxm> sfxms = dictSfxmService.getEjDictSfxmList(dictSfxm.getId());
                if (null != sfxms && sfxms.size() > 0) {
                    for (DictSfxm sfxm : sfxms) {
                        List<DictSfxm> sfx = dictSfxmService.getSjDictSfxmList(dictSfxm.getId());
                        sfxm.setDictSfxms(sfx);
                    }
                }
                dictSfxm.setDictSfxms(sfxms);
            }
        }
        return dictSfxms;
    }
    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) {
            for (TjPackage aPackage : tjPackageList) {
@@ -1337,6 +1409,9 @@
     * @return
     */
    public static String hidePhoneNum(String phoneNum){
        if(null==phoneNum){
            return "";
        }
        if(phoneNum.contains("*")){
            return phoneNum;
        }
@@ -1363,6 +1438,9 @@
     * @return
     */
    public static String hideIdCardNum(String idCardNum){
        if(null==idCardNum){
            return "";
        }
        if(idCardNum.contains("*")){
            return idCardNum;
        }
@@ -1393,6 +1471,9 @@
     * @return
     */
    public static String hideCusName(String cusName){
        if(null==cusName){
            return "";
        }
        if(!cusName.contains("*")){
            String realname=null;
            char[] r =  cusName.toCharArray();
@@ -1414,7 +1495,8 @@
    //临时表添加单项
    public void saveRedisTransitionByProId(String cusId, List<Long> proIds) {
        for (Long proId : proIds) {
            if (null != transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)) && transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)).size() > 0) {
            List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
            if (null != transitionList && transitionList.size() > 0) {
                continue;
            }
            transitionService.saveRedisTransitionByProId(cusId,proId);