Prechádzať zdrojové kódy

核酸混检条码变更,混检功能完善,防止重复操作

hurugang 3 rokov pred
rodič
commit
e62bb87965

+ 1 - 1
src/main/java/cn/hnthyy/thmz/common/Constants.java

@@ -352,7 +352,7 @@ public class Constants {
     /**
      * 核酸检测收费项目(混检)编码
      */
-    public static final String HYBRID_TEST_CHARGE_CODE ="019004";
+    public static final String HYBRID_TEST_CHARGE_CODE ="019103";
 
     /**
      * 核酸检测项目的检验物

+ 47 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -12,6 +12,7 @@ import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode;
 import cn.hnthyy.thmz.entity.his.zy.ZyZdAuditItem;
 import cn.hnthyy.thmz.entity.thmz.Clinic;
+import cn.hnthyy.thmz.entity.thmz.HybirdTest;
 import cn.hnthyy.thmz.entity.thmz.PayInfo;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
@@ -26,6 +27,7 @@ import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.his.zy.ZyZdAuditItemService;
 import cn.hnthyy.thmz.service.thmz.ClinicService;
 import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService;
+import cn.hnthyy.thmz.service.thmz.HybirdTestService;
 import cn.hnthyy.thmz.service.thmz.TsmzService;
 import cn.hnthyy.thmz.vo.*;
 import com.auth0.jwt.interfaces.DecodedJWT;
@@ -71,6 +73,8 @@ public class MzChargeDetailController {
     private HaiCiAdapterService haiCiAdapterService;
     @Autowired
     private JcJyItemChargeService jcJyItemChargeService;
+    @Autowired
+    private HybirdTestService hybirdTestService;
     /**
      * 查询费用列表
      *
@@ -1476,6 +1480,49 @@ public class MzChargeDetailController {
     }
 
 
+    /**
+     * 查询患者混采记录
+     *
+     * @param patientId
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/verifyHybridTestStatus", method = {RequestMethod.GET})
+    public Map<String, Object> verifyHybridTestStatus(@RequestParam("patientId") String patientId) {
+        Map<String, Object> results = new HashMap<>();
+        try {
+            if (StringUtils.isBlank(patientId)) {
+                results.put("code", -1);
+                results.put("message", "患者ID不能为空");
+                return results;
+            }
+            Integer times = mzChargeDetailService.queryCountMzChargeDetailByPatientIdAndChargeItemCode(patientId,Constants.HYBRID_TEST_CHARGE_CODE);
+            if (times == null || times<=0) {
+                results.put("code", -1);
+                results.put("message", "当前患者没有已缴费的混采申请");
+                return results;
+            }
+            HybirdTest hybirdTest=hybirdTestService.queryByPatientIdAndTimes(patientId,times);
+            if(hybirdTest!=null){
+                results.put("code", -1);
+                results.put("message", "当前患者本次缴费的混采已经被采集,请勿重复添加");
+                return results;
+            }
+            results.put("code", 0);
+            results.put("times", times);
+            results.put("message", "查询患者混采记录成功");
+            return results;
+        }catch (Exception e) {
+            e.printStackTrace();
+            results.put("code", -1);
+            results.put("message", "查询患者混采记录失败,请联系管理员");
+            log.error("系统异常,错误信息{}", e);
+            return results;
+        }
+    }
+
+
+
     /**
      * 保存处方信息
      *

+ 3 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/MzPatientMiController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.DateUtil;
 import cn.hnthyy.thmz.Utils.IDCardUtil;
 import cn.hnthyy.thmz.Utils.SeedUtil;
 import cn.hnthyy.thmz.Utils.StringUtil;
@@ -435,8 +436,9 @@ public class MzPatientMiController {
             MzPatientMi mzPatientMi = new MzPatientMi();
             mzPatientMi.setSocialNo(SeedUtil.getId());
             mzPatientMi.setName("核酸混检"+number+"人");
-            mzPatientMi.setGender(GenderEnum.UNKNOWN.code.toString());
+            mzPatientMi.setGender(GenderEnum.MAN.code.toString());
             mzPatientMi.setResponseType(Constants.SELF_PAYING_RESPONCE_TYPE);
+            mzPatientMi.setBirthDay(DateUtil.pase("1988-05-04","yyyy-mm-dd"));
             mzPatientMi.setTimes(1);
             mzPatientMi.setAge(30);
             int num=mzPatientMiService.saveMzPatientMi(mzPatientMi);

+ 4 - 1
src/main/java/cn/hnthyy/thmz/entity/thmz/HybirdTest.java

@@ -31,7 +31,10 @@ public class HybirdTest extends PageParams implements Serializable {
 	 * 实际被检人id
 	 */
 	private String patientId;
-
+	/**
+	 * 实际被检人缴费次数
+	 */
+	private Integer times;
 	/**
 	 * 记录时间
 	 */

+ 11 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzChargeDetailMapper.java

@@ -1104,4 +1104,15 @@ public interface MzChargeDetailMapper {
     @Select("SELECT max(isnull(print_flag,0)) as print_flag FROM mz_charge_detail WHERE patient_id=#{patientId} and times=#{times} and order_no=#{orderNo} ")
     Integer selectPrintFlag(@Param("patientId") String patientId, @Param("times") String times
             , @Param("orderNo") Integer orderNo);
+
+    /**
+     * 查询患者是否有已经缴费且未确认的检查记录的缴费次数
+     * @return
+     */
+    @Select("select times from mz_charge_detail where patient_id=#{patientId} and pay_mark =0 and confirm_flag=0 and charge_item_code=#{chargeItemCode} ")
+    Integer selectCountMzChargeDetailByPatientIdAndChargeItemCode(@Param("patientId") String patientId,  @Param("chargeItemCode") String chargeItemCode);
+
+
+
+
 }

+ 15 - 5
src/main/java/cn/hnthyy/thmz/mapper/thmz/HybirdTestMapper.java

@@ -15,8 +15,8 @@ public interface HybirdTestMapper {
      * @param hybirdTest
      * @return
      */
-    @Insert("INSERT INTO t_hybird_test(parent_patient_id,patient_id, create_date) VALUES " +
-            "(#{parentPatientId},#{patientId}, #{createDate})")
+    @Insert("INSERT INTO t_hybird_test(parent_patient_id,patient_id, times,create_date) VALUES " +
+            "(#{parentPatientId},#{patientId},#{times} #{createDate})")
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int insertTHybirdTest(HybirdTest hybirdTest);
 
@@ -28,9 +28,9 @@ public interface HybirdTestMapper {
      */
     @Insert({
             "<script>",
-            "INSERT INTO  t_hybird_test(parent_patient_id,patient_id, create_date) VALUES ",
+            "INSERT INTO  t_hybird_test(parent_patient_id,patient_id, times,create_date) VALUES ",
             "<foreach collection='hybirdTestList' item='item' index='index' separator=','>",
-            " (#{item.parentPatientId},#{item.patientId}, #{item.createDate}) ",
+            " (#{item.parentPatientId},#{item.patientId},#{item.times}, #{item.createDate}) ",
             "</foreach>",
             "</script>"
     })
@@ -77,7 +77,7 @@ public interface HybirdTestMapper {
      * @return
      */
     @Select({"<script>" +
-            "select a.id,parent_patient_id, patient_id, create_date from t_hybird_test a join  (" +
+            "select a.id,parent_patient_id, patient_id,times, create_date from t_hybird_test a join  (" +
             "select id from t_hybird_test where 1=1" +
             "<when test='beginDate!=null'>" +
             " and create_date  <![CDATA[>=]]>#{beginDate} " +
@@ -95,4 +95,14 @@ public interface HybirdTestMapper {
             " order by create_date desc limit #{offset},#{pageSize} )b on a.id=b.id"
             + "</script>"})
     List<HybirdTest> selectHybirdTestWithPage(HybirdTest hybirdTest);
+
+    /**
+     * 根据实际被检人的ID和缴费次数查询混检记录
+     * @param patientId
+     * @param times
+     * @return
+     */
+    @Select("select id,parent_patient_id,patient_id, times,create_date from t_hybird_test where patient_id=#{patientId} and times=#{times}")
+    HybirdTest selectByPatientIdAndTimes(@Param("patientId") String patientId,@Param("times") Integer times);
+
 }

+ 7 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/MzChargeDetailService.java

@@ -438,4 +438,11 @@ public interface MzChargeDetailService {
      * @return
      */
     Integer queryPrintFlag(String patientId, String times, Integer orderNo);
+
+
+    /**
+     * 查询患者是否有已经缴费且未确认的检查记录
+     * @return
+     */
+    Integer queryCountMzChargeDetailByPatientIdAndChargeItemCode(String patientId,String chargeItemCode);
 }

+ 18 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -14,6 +14,7 @@ import cn.hnthyy.thmz.entity.his.zd.JcZdItem;
 import cn.hnthyy.thmz.entity.his.zd.JyZdItem;
 import cn.hnthyy.thmz.entity.his.zd.MzZdYpYsh;
 import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
+import cn.hnthyy.thmz.entity.jy.InspectionsIndex;
 import cn.hnthyy.thmz.entity.thmz.*;
 import cn.hnthyy.thmz.enums.*;
 import cn.hnthyy.thmz.mapper.his.mz.*;
@@ -50,6 +51,7 @@ import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -647,6 +649,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 mzChargeDetail1.setName(name);
                 returnMzChargeDetails.add(mzChargeDetail1);
             }
+            //按时间倒序排序
+            Collections.sort(returnMzChargeDetails, new Comparator(){
+                final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                @Override
+                public int compare(Object o1, Object o2) {
+                    MzChargeDetail i1 =(MzChargeDetail)o1;
+                    MzChargeDetail i2 =(MzChargeDetail)o2;
+                    return (i2.getPriceTime()).compareTo(i1.getPriceTime());
+                }
+            });
         }
         return returnMzChargeDetails;
     }
@@ -660,7 +672,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     public int chargeFee(String opId, MzDepositFileVo mzDepositFileVo, String ipAddress) throws MzException {
         Windows windows = windowsMapper.selectLastWindowsByIpAddress(ipAddress);
-        if (windows == null) {
+        if (windows == null || windows.getWindowsNo() == null) {
             throw new MzException("当前操作人未设置窗口号,请先设置!");
         }
         MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), "mz_visit_table");
@@ -2110,6 +2122,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         return mzChargeDetailMapper.selectPrintFlag(patientId, times, orderNo);
     }
 
+    @Override
+    public Integer queryCountMzChargeDetailByPatientIdAndChargeItemCode(String patientId, String chargeItemCode) {
+        return mzChargeDetailMapper.selectCountMzChargeDetailByPatientIdAndChargeItemCode(patientId,chargeItemCode);
+    }
+
     @Override
     public Clinic nucleicAcidApplication(String patientId) throws MzException {
         MzPrescriptionVo mzPrescriptionVo = new MzPrescriptionVo();

+ 27 - 5
src/main/java/cn/hnthyy/thmz/service/impl/thmz/HybirdTestServiceImpl.java

@@ -7,6 +7,8 @@ import cn.hnthyy.thmz.entity.his.mz.MzDepositFile;
 import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.entity.thmz.Clinic;
 import cn.hnthyy.thmz.entity.thmz.HybirdTest;
+import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.mapper.his.mz.MzChargeDetailMapper;
 import cn.hnthyy.thmz.mapper.thmz.HybirdTestMapper;
 import cn.hnthyy.thmz.service.his.mz.MzChargeDetailService;
 import cn.hnthyy.thmz.service.thmz.HybirdTestService;
@@ -28,8 +30,12 @@ public class HybirdTestServiceImpl implements HybirdTestService {
     @SuppressWarnings("all")
     @Autowired
     private HybirdTestMapper hybirdTestMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private MzChargeDetailMapper mzChargeDetailMapper;
     @Autowired
     private MzChargeDetailService mzChargeDetailService;
+
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     public int saveTHybirdTest(MzPatientMi mzPatientMi) throws MzException {
@@ -45,15 +51,26 @@ public class HybirdTestServiceImpl implements HybirdTestService {
         }
         List<HybirdTest> hybirdTestList = new ArrayList<>();
         Date now = new Date();
+        MzChargeDetail updateMzChargeDetail =new MzChargeDetail();
+        updateMzChargeDetail.setReceiptNo(1);
+        updateMzChargeDetail.setConfirmFlag(YesNoEnum.YES.code);
         for(String str:patientIdLisat){
             if(StringUtils.isBlank(str)){
                 continue;
             }
-            HybirdTest hybirdTest = new HybirdTest();
-            hybirdTest.setParentPatientId(mzPatientMi.getParentPatientId());
-            hybirdTest.setPatientId(str);
-            hybirdTest.setCreateDate(now);
-            hybirdTestList.add(hybirdTest);
+           String [] arr= str.split("_");
+            if(arr!=null&& arr.length==2){
+                HybirdTest hybirdTest = new HybirdTest();
+                hybirdTest.setParentPatientId(mzPatientMi.getParentPatientId());
+                hybirdTest.setPatientId(arr[0]);
+                hybirdTest.setTimes(Integer.valueOf(arr[1]));
+                hybirdTest.setCreateDate(now);
+                hybirdTestList.add(hybirdTest);
+                //设置检验成确费状态
+                updateMzChargeDetail.setPatientId(hybirdTest.getPatientId());
+                updateMzChargeDetail.setTimes(hybirdTest.getTimes());
+                mzChargeDetailMapper.updateMzChargeDetailFull(updateMzChargeDetail);
+            }
         }
         int num= hybirdTestMapper.batchInsertTHybirdTest(hybirdTestList);
         if(num>0){
@@ -97,4 +114,9 @@ public class HybirdTestServiceImpl implements HybirdTestService {
     public List<HybirdTest> queryHybirdTestWithPage(HybirdTest hybirdTest) {
         return hybirdTestMapper.selectHybirdTestWithPage(hybirdTest);
     }
+
+    @Override
+    public HybirdTest queryByPatientIdAndTimes(String patientId, Integer times) {
+        return hybirdTestMapper.selectByPatientIdAndTimes(patientId,times);
+    }
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/HybirdTestService.java

@@ -39,4 +39,13 @@ public interface HybirdTestService {
      * @return
      */
     List<HybirdTest> queryHybirdTestWithPage(HybirdTest hybirdTest);
+
+
+    /**
+     * 根据实际被检人的ID和缴费次数查询混检记录
+     * @param patientId
+     * @param times
+     * @return
+     */
+    HybirdTest queryByPatientIdAndTimes(String patientId,Integer times);
 }

+ 64 - 44
src/main/resources/static/js/mz/hybrid_test.js

@@ -642,51 +642,71 @@ function hybirdTypeModal() {
  * 将当前病人就诊人添加到混采列表
  */
 function addToList() {
-    var userName=$("#userName").val();
-    var gender=$('#gender option:selected').text();
-    var age=$("#age").val();
-    var phoneNum=$("#phoneNum").val();
-    var idCard=$("#idCard").val();
     var patientId=$("#patientId").val();
-    var hybirdPatientId =$("#hybirdPatientId").text();
-    if(hybirdPatientId==null || hybirdPatientId==""){
-        $("#messageModal").modal();
-        $("#messageButton").addClass("hide");
-        $("#messageContent").html("请先创建混检主体再执行该操作!");
-        return;
-    }
-    if(patientId==null){
-        $("#messageModal").modal();
-        $("#messageButton").addClass("hide");
-        $("#messageContent").html("未选择任何待检人,无法进行该操作!");
-        return;
-    }
-    var fullPatientIds=$("#fullPatientIds").val();
-    if(fullPatientIds!=null && fullPatientIds.indexOf(patientId)>0){
-        $("#messageModal").modal();
-        $("#messageButton").addClass("hide");
-        $("#messageContent").html("请不要重复添加该待检人!");
-        clearRegistration();
-        return;
-    }
-    var length=$("#hybirdList").children().length;
-    var hc_number = $("#hc_number").val();
-    if(length>=hc_number){
-        $("#messageModal").modal();
-        $("#messageButton").addClass("hide");
-        $("#messageContent").html("当前混检主体已经达到最大人数,请提交后创建新混检主体再继续操作!");
-        //clearRegistration();
-        return;
-    }
-    fullPatientIds+=","+patientId;
-    $("#fullPatientIds").val(fullPatientIds);
-    var html= '<div class="col-md-6 col-sm-6 col-xs-12 item">';
-    html+=userName+" "+gender+" "+age+"岁 "+phoneNum+" "+idCard+" ";
-    html+='<a style="cursor: pointer;color: #337AB7 !important;" onclick="editUserModal(\''+patientId+'\')">详情</a> ';
-    html+='<a style="cursor: pointer;color: #337AB7 !important;" onclick="deleteFromList(this,\''+patientId+'\')">删除</a>';
-    html+=' </div>';
-    $("#hybirdList").append(html);
-    clearRegistration();
+    $.ajax({
+        type: "GET",
+        url: '/thmz/verifyHybridTestStatus?patientId=' + patientId,
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                var userName=$("#userName").val();
+                var gender=$('#gender option:selected').text();
+                var age=$("#age").val();
+                var phoneNum=$("#phoneNum").val();
+                var idCard=$("#idCard").val();
+                var hybirdPatientId =$("#hybirdPatientId").text();
+                if(hybirdPatientId==null || hybirdPatientId==""){
+                    $("#messageModal").modal();
+                    $("#messageButton").addClass("hide");
+                    $("#messageContent").html("请先创建混检主体再执行该操作!");
+                    return;
+                }
+                if(patientId==null){
+                    $("#messageModal").modal();
+                    $("#messageButton").addClass("hide");
+                    $("#messageContent").html("未选择任何待检人,无法进行该操作!");
+                    return;
+                }
+                var fullPatientIds=$("#fullPatientIds").val();
+                if(fullPatientIds!=null && fullPatientIds.indexOf(patientId)>0){
+                    $("#messageModal").modal();
+                    $("#messageButton").addClass("hide");
+                    $("#messageContent").html("请不要重复添加该待检人!");
+                    clearRegistration();
+                    return;
+                }
+                var length=$("#hybirdList").children().length;
+                var hc_number = $("#hc_number").val();
+                if(length>=hc_number){
+                    $("#messageModal").modal();
+                    $("#messageButton").addClass("hide");
+                    $("#messageContent").html("当前混检主体已经达到最大人数,请提交后创建新混检主体再继续操作!");
+                    //clearRegistration();
+                    return;
+                }
+                fullPatientIds+=","+patientId+"_"+res.times;
+                $("#fullPatientIds").val(fullPatientIds);
+                var html= '<div class="col-md-6 col-sm-6 col-xs-12 item">';
+                html+=userName+" "+gender+" "+age+"岁 "+phoneNum+" "+idCard+" ";
+                html+='<a style="cursor: pointer;color: #337AB7 !important;" onclick="editUserModal(\''+patientId+'\')">详情</a> ';
+                html+='<a style="cursor: pointer;color: #337AB7 !important;" onclick="deleteFromList(this,\''+patientId+'\')">删除</a>';
+                html+=' </div>';
+                $("#hybirdList").append(html);
+                clearRegistration();
+            }else {
+                errorMesage(res);
+            }
+        }
+    });
+
+
+
 }