Browse Source

优化插入费用

xiaochan 1 year ago
parent
commit
d219639d5a

+ 9 - 1
src/main/java/thyyxxk/webserver/dao/his/inpatient/casefrontsheet/JieShouHuiZhenDao.java

@@ -41,7 +41,7 @@ public interface JieShouHuiZhenDao {
     @Select("SELECT order_code FROM zd_emp_title where code = #{code} ")
     String getOrderCodeByEmpTit(String code);
 
-    @Select("select  rtrim(a.inpatient_no) inpatient_no , " +
+    @Select("select  rtrim(a.inpatient_no) inpatient_no ,a.admiss_times, " +
             "       b.admiss_date, " +
             "       rtrim(name)                                                                                          name, " +
             "       bed_no, " +
@@ -108,4 +108,12 @@ public interface JieShouHuiZhenDao {
             "        #{deptCode}, #{deptCode},\n" +
             "        1, #{execUnit})")
     void insertYzZyPatientFee(YzZyPatientFee fee);
+
+
+    @Select("select count(1)\n" +
+            "from zy_detail_charge\n" +
+            "where inpatient_no = #{patNO}\n" +
+            "  and admiss_times = #{times}\n" +
+            "  and order_no = #{order} ")
+    int orderFeeCount(String patNO, Integer times, BigDecimal order);
 }

+ 1 - 1
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/JieShouHuiZhenService.java

@@ -122,7 +122,7 @@ public class JieShouHuiZhenService implements Assertion {
             JieShouHuiZhenPojo reqData = dao.getHuanZheXinXi(param.getAdmissTimes(), param.getReqTimes(), param.getInpatientNo());
             dao.wanChenHuiZhen(param);
             dao.updateOrderConsultationCode(orderCode, reqData.getActOrderNo());
-            if (param.getStatusFlag().equals(2)) {
+            if (param.getStatusFlag().equals(2) && dao.orderFeeCount(reqData.getInpatientNo(), reqData.getAdmissTimes(), reqData.getActOrderNo()) == 0) {
                 // 插入費用中间表
                 insertYzZyPatientFee(orderCode, reqData, userInfo);
             }