Browse Source

调价修改

WANGJIALIANG 2 years ago
parent
commit
cae870824a

+ 6 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpBaseMapper.java

@@ -157,6 +157,12 @@ public interface YpBaseMapper {
             "<when test='miniStockAmount!=null'>",
             ",mini_stock_amount =#{miniStockAmount}",
             "</when>",
+            "<when test='packRetprice!=null'>",
+            ",pack_retprice =#{packRetprice,jdbcType=DECIMAL}",
+            "</when>",
+            "<when test='retprice!=null'>",
+            ",retprice =#{retprice,jdbcType=DECIMAL}",
+            "</when>",
             "</trim>" +
             "<where>" +
             "charge_code = #{chargeCode}" +

+ 31 - 23
src/main/java/cn/hnthyy/thmz/service/impl/his/yp/YpRepriceServiceImpl.java

@@ -2,10 +2,8 @@ package cn.hnthyy.thmz.service.impl.his.yp;
 
 import cn.hnthyy.thmz.Utils.ColumnSqlUtil;
 import cn.hnthyy.thmz.entity.MzException;
-import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
-import cn.hnthyy.thmz.entity.his.yp.YpReprice;
-import cn.hnthyy.thmz.entity.his.yp.YpRepriceStock;
-import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
+import cn.hnthyy.thmz.entity.his.yp.*;
+import cn.hnthyy.thmz.mapper.his.yp.YpBaseMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpBaseYfMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpRepriceMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
@@ -41,6 +39,9 @@ public class YpRepriceServiceImpl implements YpRepricelService {
     @SuppressWarnings("all")
     @Autowired
     private YpBaseYfMapper ypBaseYfMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private YpBaseMapper ypBaseMapper;
 
     @Override
     public List<YpReprice> queryYpReprice(YpReprice ypReprice) {
@@ -98,13 +99,18 @@ public class YpRepriceServiceImpl implements YpRepricelService {
         ypBaseYf.setPackRetprice(ypZdDict.getPackRetprice());
         ypBaseYf.setRetprice(ypZdDict.getRetprice());
         ypBaseYfMapper.updateYpBaseYf(ypBaseYf);
+        YpBase ypBase = new YpBase();
+        ypBase.setChargeCode(yp.getCode());
+        ypBase.setSerial(yp.getSerial());
+        ypBase.setPackRetprice(ypZdDict.getPackRetprice());
+        ypBase.setRetprice(ypZdDict.getRetprice());
+        ypBaseMapper.updateYpBase(ypBase);
         if(ypReprice.getSerial().equals("99")){
-            YpReprice minYpReprice= ypReprice;
-            minYpReprice.setReajustSerial(2);
-            minYpReprice.setSerial("01");
-            minYpReprice.setOrigPrice(yp.getRetprice());
-            minYpReprice.setNewPrice(ypReprice.getNewPrice().divide(yp.getPackSize(),2, BigDecimal.ROUND_HALF_UP));
-            changedNotFieldsOfSql = ColumnSqlUtil.getChangedNotFieldsOfSql(new YpReprice(), minYpReprice, 1);
+            ypReprice.setReajustSerial(2);
+            ypReprice.setSerial("01");
+            ypReprice.setOrigPrice(yp.getRetprice());
+            ypReprice.setNewPrice(ypReprice.getNewPrice().divide(yp.getPackSize(),2, BigDecimal.ROUND_HALF_UP));
+            changedNotFieldsOfSql = ColumnSqlUtil.getChangedNotFieldsOfSql(new YpReprice(), ypReprice, 1);
             if (ypRepriceMapper.insertYpReprice(changedNotFieldsOfSql) != 1) {
                 throw new MzException("插入调价记录异常");
             }
@@ -113,21 +119,23 @@ public class YpRepriceServiceImpl implements YpRepricelService {
             minYpRepriceStock.setSerial("01");
             ypRepriceMapper.insertYpRepriceStockYk(minYpRepriceStock);
             ypRepriceMapper.insertYpRepriceStockYf(minYpRepriceStock);
-            YpZdDict minYpZdDict = ypZdDict;
-            minYpZdDict.setSerial("01");
-            minYpZdDict.setPackRetprice(minYpReprice.getNewPrice());
-            minYpZdDict.setRetprice(minYpZdDict.getPackRetprice());
-            minYpZdDict.setBuyPrice(ypReprice.getNewBuyPrice().divide(yp.getPackSize(),2, BigDecimal.ROUND_HALF_UP));
-            minYpZdDict.setFixPrice(minYpZdDict.getBuyPrice());
-            minYpZdDict.setYbxjPrice(minYpZdDict.getBuyPrice());
-            if (1 != ypZdDictMapper.updateYpZdDict(minYpZdDict)) {
+            ypZdDict.setSerial("01");
+            ypZdDict.setPackRetprice(ypReprice.getNewPrice());
+            ypZdDict.setRetprice(ypZdDict.getPackRetprice());
+            ypZdDict.setBuyPrice(ypReprice.getNewBuyPrice().divide(yp.getPackSize(),2, BigDecimal.ROUND_HALF_UP));
+            ypZdDict.setFixPrice(ypZdDict.getBuyPrice());
+            ypZdDict.setYbxjPrice(ypZdDict.getBuyPrice());
+            if (1 != ypZdDictMapper.updateYpZdDict(ypZdDict)) {
                 throw new MzException("更新药品价格异常");
             }
-            YpBaseYf minYpBaseYf = ypBaseYf;
-            minYpBaseYf.setSerial("01");
-            minYpBaseYf.setPackRetprice(minYpZdDict.getPackRetprice());
-            minYpBaseYf.setRetprice(minYpZdDict.getPackRetprice());
-            ypBaseYfMapper.updateYpBaseYf(minYpBaseYf);
+            ypBaseYf.setSerial("01");
+            ypBaseYf.setPackRetprice(ypZdDict.getPackRetprice());
+            ypBaseYf.setRetprice(ypZdDict.getPackRetprice());
+            ypBaseYfMapper.updateYpBaseYf(ypBaseYf);
+            ypBase.setSerial("01");
+            ypBase.setPackRetprice(ypZdDict.getPackRetprice());
+            ypBase.setRetprice(ypZdDict.getPackRetprice());
+            ypBaseMapper.updateYpBase(ypBase);
         }
         return reajustNo;
     }

+ 1 - 1
src/main/resources/static/js/yf/ward_prescription.js

@@ -1793,7 +1793,6 @@ function sendXy(flag) {
                 }
                 groupNo === '81'?$("#submitFlagSearch").val("4"):$("#submitFlagSearch").val("3");
                 $("#submitFlagSearch").selectpicker('refresh');
-                initButtonChange("#"+(flag == 0 ? 'hz' : 'mx'), (flag == 0 ? 1 : 2));
                 if (confirm("是否需要打印当前药单的口服标签并使用摆药机?")) {
                     if (res.data) {
                         printLabelData(flag, 1);//口服药单,并使用摆药机
@@ -1806,6 +1805,7 @@ function sendXy(flag) {
                         });
                     }
                 }
+                initButtonChange("#"+(flag == 0 ? 'hz' : 'mx'), (flag == 0 ? 1 : 2));
             } else {
                 errorMesage(res);
             }

+ 1 - 1
src/main/resources/static/js/yk/drug_reprice.js

@@ -2,7 +2,7 @@
 var groupYk = window.localStorage["groupYk"];
 $(function () {
     $(".selectpicker").selectpicker();
-    if (groupYk == null) {
+    if (isEmpty(groupYk)) {
         return errorMesageSimaple('药库参数未设置,请在发药参数设置中设置');
     }
     initRecordTable();