赵文轩
2024-11-01 14f9208da19b7030a1c65a40897f9f4146a74d44
ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
@@ -18,7 +18,7 @@
import com.ltkj.web.controller.lis.LisApiMethod;
import com.ltkj.web.controller.pacs.PacsApiMethodService;
import com.ltkj.web.controller.service.TjSysAsyncServiceImpl;
import com.ltkj.web.controller.system.TjSamplingController;
import com.ltkj.web.controller.system.SamplingServiceApi;
import jdk.nashorn.internal.runtime.logging.Logger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -81,7 +81,7 @@
    @Autowired
    private ITjSamplingService tjSamplingService;
    @Autowired
    private TjSamplingController samplingController;
    private SamplingServiceApi samplingService;
    //将方法返回值解析成json格式
@@ -276,6 +276,7 @@
                    String mxfyxmbm = detail.getMxfyxmbm();
                    tree.setHisXmdm(mxfyxmbm);
                    tree.setType("检验");
                    tree.setService("his");
                    tree.setTjPrice(String.valueOf(detail.getProjg()));
                    LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>();
                    if (detail.getSfzhfy().equals("1"))
@@ -383,6 +384,7 @@
                    String mxfyxmbm = detail.getMxfyxmbm();
                    tree.setHisXmdm(mxfyxmbm);
                    tree.setType("检查");
                    tree.setService("his");
                    tree.setTjPrice(String.valueOf(detail.getProjg()));
                    LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>();
                    if (detail.getSfzhfy().equals("1"))
@@ -585,7 +587,8 @@
            LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>();
            wrapper.eq(TjSampling::getTjNum,tjOrder.getTjNumber());
            List<TjSampling> list = tjSamplingService.list(wrapper);
//            log.info("采样数据 ->{}",list);
            log.info("采样数据 ->{}",list);
            if (!list.isEmpty()) {
            Map<String, List<TjSampling>> listMap = list.stream().collect(Collectors.groupingBy(TjSampling::getSpecimenTypeCode));
//            log.info("分组后 ->{}",JSONUtil.toJsonStr(listMap));
            ArrayList<String> ids = new ArrayList<>();
@@ -611,10 +614,11 @@
                    ids.add(samplings.get(0).getId());
                }
            }
            Boolean confirmed = samplingController.confirmSamplingApi(ids, "Y", "Y");
                Boolean confirmed = samplingService.confirmSamplingApi(ids, "Y", "N");
            if (!confirmed){
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return AjaxResult.error("处理失败");
                }
            }
        }
@@ -817,17 +821,34 @@
                    }
                }
            }
            // 作废检验申请
            // 作废检验申请 TODO
            if (jysqdh != null && !jysqdh.isEmpty()){
                for (String sqdh : jysqdh) {
                List<String> huoQuJysqdhNotBuLu = orderService.getHuoQuJysqdhNotBuLu(order.getCardId());
                List<String> huoQuJysqdhBuLu = orderService.getHuoQuJysqdhBuLu(order.getCardId());
                for (String sqdh : huoQuJysqdhNotBuLu) {
                    AjaxResult cancelLisAjaxResult = lisApiMethod.cancel(sqdh, order.getCardId(), customer1.getCusName());
                    log.info("lis请求返回 ->{}",JSONUtil.toJsonStr(cancelLisAjaxResult));
                    if (cancelLisAjaxResult.get("code").toString().equals("200")){
                    String result = cancelLisAjaxResult.get("data").toString();
                    JSONObject object = JSONUtil.parseObj(result);
                    String code= object.getStr("ResultCode");
                    if(code.equals("1")){
                        orderService.delHuoQuJysqdh(order.getCardId());
                    }
                    } else {
                        String str = JSONUtil.parseObj(cancelLisAjaxResult.get("result").toString()).getJSONObject("Response").getStr("ResultContent");
                        if (str.contains("申请已作废"))
                            orderService.delHuoQuJysqdh(order.getCardId());
                    }
                }
                for (String s : huoQuJysqdhBuLu) {
                    ajaxResult = controller.Outpindeltestapply(order.getCardId(), "00029", s);
                    result2 = getAjaxResult(ajaxResult);
                    object1 = getJSONObject(result2);
                    code1 = object1.getStr("ResultCode");
                    if (code1.equals("0")) {
                        orderService.delHuoQuJysqdh(order.getCardId());
                    }
                }
            }