Ver Fonte

基本完成市门特。

lighter há 4 anos atrás
pai
commit
96c7db400d

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>4.8</version>
+    <version>5.1</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
 

+ 7 - 1
src/main/java/thyyxxk/webserver/controller/markmtfees/MarkMtFeesController.java

@@ -33,7 +33,7 @@ public class MarkMtFeesController {
 
     @GetMapping("/getMtReceipts")
     public ResultVo<Map<String, Object>> getMtReceipts(@RequestParam("patientId") String patientId,
-                                                             @RequestParam("times") Integer times) {
+                                                       @RequestParam("times") Integer times) {
         return service.getMtReceipts(patientId, times);
     }
 
@@ -41,4 +41,10 @@ public class MarkMtFeesController {
     public ResultVo<String> insertMtFees(@Validated @RequestBody MarkMtFeeParam param) {
         return service.insertMtFees(param);
     }
+
+    @GetMapping("/cssybMtPreCal")
+    public ResultVo<Object> cssybMtPreCal(@RequestParam("patientId") String patientId,
+                                                       @RequestParam("times") Integer times) {
+        return service.cssybMtPreCal(patientId, times);
+    }
 }

+ 13 - 17
src/main/java/thyyxxk/webserver/dao_his/markmtfees/MarkMtFeesDao.java

@@ -25,11 +25,6 @@ public interface MarkMtFeesDao {
                               @Param("times") Integer times,
                               @Param("bizType") String bizType);
 
-    @Select("select order_no from mt_fee_info where patient_id=#{patientId} and times=#{times} and receipt_no=#{receiptNo}")
-    List<Integer> selectOrderNos(@Param("patientId") String patientId,
-                                 @Param("times") String times,
-                                 @Param("receiptNo") String receiptNo);
-
     @Insert("insert into mz_charge_detail_yb (patient_id, times, receipt_no, order_no, response_type, yb_type) "+
             "values (#{patientId}, #{times}, #{receiptNo}, #{orderNo}, #{responseType}, #{ybType})")
     void insertMzChargeYb(@Param("patientId") String patientId,
@@ -47,25 +42,26 @@ public interface MarkMtFeesDao {
                                @Param("balance") String balance,
                                @Param("apply") String apply);
 
-    @Insert("insert into mt_part_info (patient_id, times, icd, balance, serial_apply, responce_type, hic_no, "+
-            "icd_code, icd_name, second_icd_code, third_icd_code) values "+
-            "(#{patientId},#{times},null,null,#{bizType},'03',#{hicNo},#{icdCode},#{icdName},#{secondIcdCode},#{thirdIcdCode})")
+    @Insert("insert into mt_part_info (patient_id, times, icd, balance, serial_apply, responce_type, " +
+            "hic_no, icd_code, icd_name, second_icd_code, third_icd_code, mz_serial_no) values "+
+            "(#{patientId},#{times},null,null,#{bizType},'03',#{hicNo},#{icdCode},#{icdName}," +
+            "#{secondIcdCode},#{thirdIcdCode},#{mzSerialNo})")
     void insertCssybMtPartInfo(CssybApplyInfo info);
 
-    @Select("select count(1) from mt_fee_info where patient_id=#{patientId} and times=#{times} " +
-            "and receipt_no=#{receiptNo} and order_no=#{orderNo}")
+    @Select("select count(1) from t_mt_receipt where patient_id=#{patientId} and times=#{times} and " +
+            "receipt_no=#{receiptNo} and order_no=#{orderNo}")
     int selectFeeCount(@Param("patientId") String patientId,
                        @Param("times") Integer times,
                        @Param("receiptNo") Integer receiptNo,
                        @Param("orderNo") Integer orderNo);
 
-    @Insert("insert into mt_fee_info (patient_id, times, his_item_name, medi_item_type, "+
-            "his_item_code, fee_date, input_date, price, quantity, drug_win, usage_flag, "+
-            "input_staff, input_man, serial_no, receipt_no, order_no, charge_fee) values ("+
-            "#{patientId}, #{times}, #{drugName}, #{billItemCode}, #{chargeItemCode}, #{priceTime}, "+
-            "#{priceTime}, #{unitPrice}, #{quantity}, #{drugWin}, 0, #{doctorCode}, "+
-            "#{doctorName}, #{serialNo}, #{receiptNo}, #{orderNo}, #{chargeFee})")
-    void insertBatchedMtFeeInfo(MzReceipt feeInfo);
+    @Insert("insert into t_mt_receipt (patient_id, times, receipt_no, order_no, item_no, his_item_name, " +
+            "his_item_code, fee_date, input_date, medi_item_type, charge_fee, price, quantity, drug_win, " +
+            "input_staff, input_man, serial_no, yb_trans_flag) values (" +
+            "#{patientId},#{times},#{receiptNo},#{orderNo},#{itemNo},#{drugName},#{chargeItemCode}," +
+            "#{priceTime},getdate(),#{billItemCode},#{chargeFee},#{unitPrice},#{quantity},#{drugWin}," +
+            "#{doctorCode},#{doctorName},#{serialNo},0)")
+    void insertBatchedMtFeeInfo(MzReceipt param);
 
     @Select("SELECT a.patient_id,a.social_no,a.name,a.lv_date,a.sex,a.response_type,a.charge_type,a.times,a.age," +
             "a.birth_day,responce_name=b.name,address=a.adress,phone_no=a.phone_no FROM " +

+ 1 - 0
src/main/java/thyyxxk/webserver/pojo/markmtfees/CssybApplyInfo.java

@@ -12,4 +12,5 @@ public class CssybApplyInfo {
     private String icdName;
     private String secondIcdCode;
     private String thirdIcdCode;
+    private String mzSerialNo;
 }

+ 0 - 51
src/main/java/thyyxxk/webserver/pojo/markmtfees/MtFeePojo.java

@@ -1,51 +0,0 @@
-package thyyxxk.webserver.pojo.markmtfees;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-@Data
-public class MtFeePojo {
-    private String patientId;
-    private Integer times;
-    private Integer receiptNo;
-    private Integer orderNo;
-    private String chargeItemCode;
-    private String tcName;
-    private String billItemCode;
-    private Double quantity;
-    private BigDecimal unitPrice;
-    private Integer drugWin;
-    private BigDecimal chargeFee;
-    private String priceTime;
-    private String doctorCode;
-    private String inputMan;
-    private Integer usageFlag = 0;
-    private Integer ybTransFlag = 0;
-    private String serialNo;
-
-    public String getBillItemCode() {
-        switch (billItemCode) {
-            case "010": // 西药
-            case "1":
-                return "1";
-            case "011": // 中成药
-            case "2":
-                return "2";
-            case "012": // 中草药
-            case "3":
-                return "3";
-            default:    // 其他
-                return "0";
-        }
-    }
-
-    public BigDecimal getChargeFee() {
-        BigDecimal price= (getUnitPrice() == null ? BigDecimal.ZERO : getUnitPrice()).setScale(2, BigDecimal.ROUND_HALF_UP);
-        if(BigDecimal.ZERO.compareTo(price)==0){
-            price=BigDecimal.valueOf(0.01);
-        }
-        return price.multiply(BigDecimal.valueOf(getQuantity() == null ? 1D : getQuantity())).multiply(BigDecimal.valueOf(getDrugWin() == null ? 1D : getDrugWin()));
-    }
-}

+ 0 - 32
src/main/java/thyyxxk/webserver/pojo/markmtfees/MzReceipt.java

@@ -17,7 +17,6 @@ public class MzReceipt {
     private String chargeBillCode;
     private Double quantity;
     private BigDecimal unitPrice;
-    private String origPrice;
     private Integer payMark;
     private String serial;
     private String serialNo;
@@ -25,23 +24,16 @@ public class MzReceipt {
     private String groupNo;
     private String specification;
     private Integer confirmFlag;
-    private Integer printFlag;
-    private String execDept;
-    private String warnDept;
     private Integer drugWin;
-    private String priceId;
     private Date priceTime;
     private String dosage;
-    private String windowsNoYf;
     private String billItemCode;
     private String doctorCode;
     private String doctorName;
-    private String cashId;
     private String name;
     private String responceType;
     private String tcNo;
     private String tcName;
-    private Integer delFlag;
     private BigDecimal chargeFee;
 
     public String getDrugName() {
@@ -60,10 +52,6 @@ public class MzReceipt {
         return null == chargeBillCode ? "" : (chargeBillCode).trim();
     }
 
-    public String getOrigPrice() {
-        return null == origPrice ? "" : (origPrice).trim();
-    }
-
     public String getSerial() {
         return null == serial ? "" : (serial).trim();
     }
@@ -80,34 +68,14 @@ public class MzReceipt {
         return null == specification ? "" : (specification).trim();
     }
 
-    public String getExecDept() {
-        return null == execDept ? "" : (execDept).trim();
-    }
-
-    public String getWarnDept() {
-        return null == warnDept ? "" : (warnDept).trim();
-    }
-
-    public String getPriceId() {
-        return null == priceId ? "" : (priceId).trim();
-    }
-
     public String getDosage() {
         return null == dosage ? "" : (dosage).trim();
     }
 
-    public String getWindowsNoYf() {
-        return null == windowsNoYf ? "" : (windowsNoYf).trim();
-    }
-
     public String getDoctorCode() {
         return null == doctorCode ? "" : (doctorCode).trim();
     }
 
-    public String getCashId() {
-        return null == cashId ? "" : (cashId).trim();
-    }
-
     public String getName() {
         return null == name ? "" : (name).trim();
     }

+ 33 - 25
src/main/java/thyyxxk/webserver/service/markmtfees/MarkMtFeesService.java

@@ -7,7 +7,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao_his.markmtfees.MarkMtFeesDao;
-import thyyxxk.webserver.pojo.HrgResponse;
 import thyyxxk.webserver.pojo.ResultVo;
 import thyyxxk.webserver.pojo.markmtfees.*;
 import thyyxxk.webserver.utils.*;
@@ -45,15 +44,15 @@ public class MarkMtFeesService {
         Map<String, Object> data = new HashMap<>();
         data.put("patientId", patientId);
         data.put("times", times);
-        int mtCount;
-        if (param.getResponceType().equals("02")) {
-            mtCount = dao.selectCountMtPartInfo(patientId, times);
-        } else {
-            mtCount = dao.selectCountMtPartInfoForSyb(patientId, times, param.getBizType());
-        }
-        if (mtCount > 0) {
-            return ResultVoUtil.success(data);
-        }
+//        int mtCount;
+//        if (param.getResponceType().equals("02")) {
+//            mtCount = dao.selectCountMtPartInfo(patientId, times);
+//        } else {
+//            mtCount = dao.selectCountMtPartInfoForSyb(patientId, times, param.getBizType());
+//        }
+//        if (mtCount > 0) {
+//            return ResultVoUtil.success(data);
+//        }
         param.setIdCard(socialNo);
         param.setStaffId(TokenUtil.getTokenUserId());
         RestTemplate template = new RestTemplate();
@@ -68,22 +67,20 @@ public class MarkMtFeesService {
             return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "服务器内部错误,查询门特身份信息失败。");
         }
         Map<String, Object> map = FilterUtil.cast(mapRet);
+        if (200 != (int) map.get("code")) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("message").toString());
+        }
         if (param.getResponceType().equals("02")) {
-            if (-1 == (int) map.get("code")) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("msg").toString());
-            }
-            List<Map<String, String>> spinfos = FilterUtil.cast(map.get("spinfo"));
+            Map<String, Object> hnsybRet = FilterUtil.cast(map.get("data"));
+            List<Map<String, String>> spinfos = FilterUtil.cast(hnsybRet.get("spinfo"));
             Map<String, String> spinfo = spinfos.get(0);
             String icd = spinfo.get("icd");
             String serialApply = spinfo.get("serial_apply");
-            spinfos = FilterUtil.cast(map.get("personinfo"));
+            spinfos = FilterUtil.cast(hnsybRet.get("personinfo"));
             String balance = spinfos.get(0).get("last_balance");
             dao.insertHnsybMtPartInfo(patientId, times, icd, balance, serialApply);
             return ResultVoUtil.success(data);
         }
-        if (200 != (int) map.get("code")) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("message").toString());
-        }
         data.put("list", map.get("data"));
         return ResultVoUtil.success(data);
     }
@@ -93,33 +90,28 @@ public class MarkMtFeesService {
         if (mtCount > 0) {
             return ResultVoUtil.success();
         }
+        param.setMzSerialNo(SnowFlakeId.instance().nextId());
         dao.insertCssybMtPartInfo(param);
         return ResultVoUtil.success();
     }
 
     public ResultVo<Map<String, Object>> getMtReceipts(String patientId, Integer times) {
         Map<String, Object> map = new HashMap<>();
-
         List<MzPatient> mzPatients = dao.selectMzPatient(patientId, times);
         if (null == mzPatients || mzPatients.isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patientId + ",就诊次数:" +
                     times + "】未找到此患者的本次就诊信息,请核实。");
         }
-
         MzVisit mzVisit = dao.selectMzVisit(patientId, times);
-
         if (null == mzVisit) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patientId + ",就诊次数:" +
                     times + "】未找到此患者的本次就诊信息,请核实。");
         }
-
         map.put("mzPatient", mzPatients.get(0));
         map.put("mzVisit", mzVisit);
-
         List<MzReceipt> mzReceipts = dao.selectMzReceipts(patientId, times, mzVisit.getReceiptNo());
         mzReceipts.removeIf(item -> item.getBillItemCode().equals("TC") || item.getPayMark() != 5 || item.getChargeItemCode().equals("BILL99"));
 //        mzReceipts.removeIf(item -> item.getBillItemCode().trim().equals("TC") || item.getPayMark() == 5 || item.getChargeItemCode().equals("BILL99"));
-
         Map<Integer, List<MzReceipt>> temp = new HashMap<>();
         mzReceipts.forEach(item -> {
             if (!temp.containsKey(item.getOrderNo())) {
@@ -150,7 +142,6 @@ public class MarkMtFeesService {
         if (param.getResponceType().equals("02")) {
             param.setYbType("13");
         }
-
         MzReceipt receipt = param.getReceipts().get(0);
         int count = dao.selectFeeCount(receipt.getPatientId(), receipt.getTimes(),
                 receipt.getReceiptNo(), receipt.getOrderNo());
@@ -162,4 +153,21 @@ public class MarkMtFeesService {
         param.getReceipts().forEach(dao::insertBatchedMtFeeInfo);
         return ResultVoUtil.success();
     }
+
+    public ResultVo<Object> cssybMtPreCal(String patientId, Integer times) {
+        JSONObject param = new JSONObject();
+        param.put("patientId", patientId);
+        param.put("times", times);
+        param.put("staffId", TokenUtil.getTokenUserId());
+        RestTemplate template = new RestTemplate();
+        Object mapRet = template.postForObject(YbActionLinks.normalLinks.get("cssybMtPreCal"), param, Object.class);
+        if (null == mapRet) {
+            return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "服务器内部错误,门特费用试算失败。");
+        }
+        Map<String, Object> map = FilterUtil.cast(mapRet);
+        if (200 != (int) map.get("code")) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("message").toString());
+        }
+        return ResultVoUtil.success(map.get("data"));
+    }
 }