zjh
2025-04-10 6d09c6301492d3095ff64dba2336f0d0b69638e6
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjXdPictureController.java
@@ -1,5 +1,6 @@
package com.ltkj.web.controller.system;
import java.security.Security;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
@@ -21,9 +22,13 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import com.ltkj.common.annotation.Log;
import com.ltkj.common.core.controller.BaseController;
@@ -41,6 +46,7 @@
@RestController
@RequestMapping("/picture/picture")
@Api(tags = "体检心电图管理")
@Slf4j
public class TjXdPictureController extends BaseController {
    @Resource
    private ITjXdPictureService tjXdPictureService;
@@ -291,6 +297,8 @@
//            orderList = orderService.getCsTjOrderList(tjNumber, checkStatus, compId, beginTimes, endTimes);
//            return getResult(page, pageSize, orderList, customerList, map);
//        }
        Long deptId = SecurityUtils.getDeptId();
        log.info("影像检查列表(骨密度和心电图)接口 当前登录人科室"+deptId);
        String value = String.valueOf(compId);
        if (tjNumber == null) tjNumber = "";
        if (compId == null) value = "";
@@ -298,23 +306,26 @@
        if (beginTime == null) beginTime = "";
        if (endTime == null) endTime = "";
        if (tcm == null) tcm = "";
        return AjaxResult.success(orderService.getYxJcList(checkStatus,tjNumber, page, pageSize, value, beginTime, endTime, name,tcm));
        return AjaxResult.success(orderService.getYxJcList(checkStatus,tjNumber, page, pageSize, value, beginTime, endTime, name,tcm,deptId.toString()));
    }
    @GetMapping ("/getYxJcXx")
    @ApiOperation (value = "影像检查骨密度心电图页面点击体检人员展示体检项目接口")
    public AjaxResult getYxJcXx(@ApiParam (value = "体检号") @RequestParam String tjNumber) {
        List<CsProVo> list = remarkService.getYxJcXx(tjNumber);
        Long deptId = SecurityUtils.getDeptId();
        log.info("影像检查骨密度心电图页面点击体检人员展示体检项目接口当前登录人科室"+deptId);
        List<CsProVo> list = remarkService.getYxJcXx(tjNumber,deptId.toString());
        return AjaxResult.success(list);
    }
    @GetMapping ("/addYxJcXx")
    @ApiOperation (value = "提交影像检查骨密度心电图结果接口")
    @Transactional
    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
    public AjaxResult addYxJcXx(@ApiParam (value = "体检号") @RequestParam String tjNumber,
                                @ApiParam (value = "项目id") @RequestParam String proId,
                                @ApiParam (value = "检查所见") @RequestParam String jcsj,
                                @ApiParam (value = "检查结论") @RequestParam String jcjl) {
        try {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        TjOrder order = orderService.getOrderByTjNum(tjNumber);
        if(null !=order){
@@ -354,13 +365,19 @@
            return AjaxResult.success();
        }
        return AjaxResult.error("暂无体检记录");
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            log.error("提交影像检查骨密度心电图结果接口"+e.getMessage());
            throw new RuntimeException("提交影像检查骨密度心电图结果接口");
    }
    }
    @Transactional(propagation = Propagation.REQUIRED) // 共享事务
    public void saveTjXdtgmdjgByJcbgd(TjXdtgmdjg xdtgmdjg) {
        try {
        int length = xdtgmdjg.getProId().length();
        // 确保字符串长度至少为6
        String last6 = length >= 6 ? xdtgmdjg.getProId().substring(length - 6) : xdtgmdjg.getProId();
            Date date = new Date();
        LtkjExamJcbgd jcbgd=new LtkjExamJcbgd();
        jcsqdService.deletedLtkjJcsqdByTjhandtmh(xdtgmdjg.getCardId(),xdtgmdjg.getTjh()+last6);
        jcbgdService.deletedLtkjJcbgdByTjhandtmh(xdtgmdjg.getCardId(),xdtgmdjg.getTjh()+last6);
@@ -374,12 +391,15 @@
        jcbgd.setShysdm(xdtgmdjg.getCreateId());
        jcbgd.setYxzd(xdtgmdjg.getJcjl());
        jcbgd.setYxbx("未见异常");
        jcbgd.setZdsj(DateUtil.format(new Date(),"yyyy-MM-dd"));
            jcbgd.setZdsj(DateUtil.format(date,"yyyy-MM-dd"));
        jcbgd.setJcbw("");
        jcbgd.setSqsj(DateUtil.format(new Date(),"yyyy-MM-dd"));
        jcbgd.setCreateTime(new Date());
            jcbgd.setSqsj(DateUtil.format(date,"yyyy-MM-dd"));
            jcbgd.setCreateTime(date);
        jcbgdService.save(jcbgd);
        jcsqdService.saveLtkjExamJcsqd(xdtgmdjg.getCardId());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }