zjh
2025-04-08 983d95bdcbb273b4a78efd0058a2a35141be1b51
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysConfigController.java
@@ -3,10 +3,12 @@
import java.text.SimpleDateFormat;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.json.JSONUtil;
import com.ltkj.common.core.domain.entity.SysMenu;
@@ -192,23 +194,23 @@
    @GetMapping ("/shoudongtbjyjcwsxmjg")
    @ApiOperation(value = "手动同步检验检查外送项目结果接口")
    public AjaxResult shoudongtbjyjcwsxmjg(@RequestParam @ApiParam(value = "jy检验 jc检查 jyjc检验和检查") String tblx,
                                           @ApiParam(value = "体检号")@RequestParam String tjh) {
        log.info("手动同步检验或检查结果开始->{}",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
                                           @ApiParam(value = "体检号")@RequestParam String tjh, HttpServletRequest request) {
        String hospId = request.getHeader("hospId");
        log.info("手动同步检验或检查结果开始->{}{}",hospId,DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
        try {
            switch (tblx){
                case "jy":
                    tbjianyan(tjh);
                    tbjianyan(tjh,hospId);
                    log.info("当前同步的是->{} 结果","检验");
                    break;
                case "jc":
                    tbjiancha(tjh);
                    tbjiancha(tjh,hospId);
                    log.info("当前同步的是->{} 结果","检查");
                    break;
                case "jyjc":
                    tbjianyan(tjh);
                    tbjiancha(tjh);
                    tbjianyan(tjh,hospId);
                    tbjiancha(tjh,hospId);
                    log.info("当前同步的是->{} 结果","检验检查");
                    break;
                default:
@@ -228,8 +230,27 @@
        return AjaxResult.success();
    }
    private void tbjianyan(String s) {
    private void tbjianyan(String s,String hosp) {
        try {
            String isWsByView = configService.selectConfigByKey("is_ws_by_view");
            if (StrUtil.isNotBlank(isWsByView) && isWsByView.equals("Y")){
                List<LtkjHysqd> sqd = testMapper.getWsHySqdByView(s);
                if (sqd != null && !sqd.isEmpty()){
                    for (LtkjHysqd hysqd : sqd) {
                        LtkjHysqd jybgid = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh());
                        if (null != jybgid) {
                            ltkjHysqdService.deletedLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh());
                            ltkjHybgdService.deletedLtkjHybgdByTjhAndTmh(hysqd.getTmh());
                        }
                        if (ltkjHysqdService.save(hysqd)) {
                            List<LtkjHybgd> wsbg = testMapper.getWsHyBgdByView(hysqd.getTmh());
                            ltkjHybgdService.saveBatch(wsbg);
                        }
                    }
                }
            }
            List<Aws> awsList = testMapper.getWsxmLtkjHysqdByLisViBySLAVEWS(s);
            if(null !=awsList && !awsList.isEmpty()){
                log.info("外送项目个数->{} 结果",awsList.size());
@@ -239,7 +260,7 @@
                awsService.saveBatch(awsList);
                log.info("保存外送项目成功");
            }
            List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(s);
            List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(s,hosp);
            log.info("原hysqdList->{} 结果", JSONUtil.parseObj(hysqdList));
            List<LtkjHysqd> wssq = testMapper.getWsxmLtkjHysqdByLisVi(s);
            if(null !=wssq && !wssq.isEmpty()){
@@ -272,16 +293,16 @@
    }
    private void tbjiancha(String s) {
    private void tbjiancha(String s,String hosp) {
        String yqbm = configService.selectConfigByKey("common_api_service_hospbm");
        try {
            List<LtkjExamJcsqd> jcsqdList = testMapper.getCcXZxYyPacsLtkjExamJcsqd(s);
            List<LtkjExamJcsqd> jcsqdList = testMapper.getCcXZxYyPacsLtkjExamJcsqd(s,hosp);
            if (null != jcsqdList && !jcsqdList.isEmpty()) {
                DynamicDataSourceContextHolder.clearDataSourceType();
                jcsqdService.deletedLtkjJcsqdByTjhAndTmh(s);
                jcbgdService.deletedLtkjJcbgdByTjhAndTmh(s);
                jcsqdService.saveBatch(jcsqdList);
                List<LtkjExamJcbgd> jcbgdList = testMapper.getCcXZxYyPacsLtkjExamJcbgd(s);
                List<LtkjExamJcbgd> jcbgdList = testMapper.getCcXZxYyPacsLtkjExamJcbgd(s,hosp);
                DynamicDataSourceContextHolder.clearDataSourceType();
                if (null != jcbgdList && !jcbgdList.isEmpty()) jcbgdService.saveBatch(jcbgdList);
                for (LtkjExamJcsqd jcsqd : jcsqdList) {
@@ -322,7 +343,7 @@
    public AjaxResult zx(@RequestParam int day) {
        try {
            List<DictHosp> list = dictHospService.list();
            DateTime dateTime1 = DateUtil.offsetMonth(new Date(), day);
            DateTime dateTime1 = DateUtil.offsetDay(new Date(), day);
            for (DictHosp dictHosp : list) {
                String mallMerchantSecretKey = SecurityUtils.getMallMerchantSecretKey(secret, dictHosp.getHospAreaId(), dictHosp.getHospAreaName(), dateTime1);
                dictHosp.setSecretKey(mallMerchantSecretKey);