Przeglądaj źródła

盘点药品筛选条件调整,住院发药保存前取消批号编辑状态

WANGJIALIANG 2 lat temu
rodzic
commit
7f686f477b

+ 6 - 5
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpBaseYfMapper.java

@@ -228,7 +228,7 @@ public interface YpBaseYfMapper {
      * @param infusionFlag
      * @return
      */
-    @Select("select * from (SELECT distinct " +
+    @Select("SELECT distinct " +
             "   rtrim(a.code)charge_code," +
             "   a.name," +
             "   a.serial," +
@@ -240,16 +240,17 @@ public interface YpBaseYfMapper {
             "   location=b.location," +
             "   a.py_code," +
             "   group_no=b.group_no," +
-            "   m.name as manufactoryName," +
-            "   visible_flag = case when isnull(a.del_flag,'0')='0'or isnull(b.visible_flag_zy,'0')='0'or isnull(b.visible_flag_mz,'0')='0'then '0'else '1'end" +
+            "   m.name as manufactoryName" +
             " FROM yp_zd_dict a WITH(NOLOCK) left join yp_zd_manufactory m WITH(NOLOCK) on a.manu_code = m.code" +
             ",yp_print_name c WITH(NOLOCK),yp_base_yf b WITH(NOLOCK)" +
             " where a.code=b.charge_code and" +
             "    a.serial=b.serial and" +
             "    a.code  =c.charge_code and" +
             "    b.group_no=#{groupNo} and" +
-            "    isnull(a.infusion_flag,'0') like '${infusionFlag}%')ab " +
-            " where visible_flag like '${visibleFlag}%' order by location")
+            "    isnull(a.infusion_flag,'0') like '${infusionFlag}%'" +
+            "    and ((isnull(a.del_flag,'0') <>'1' and (isnull(visible_flag_zy,'0')<>'1' or" +
+            "    isnull(visible_flag_mz,'0')<>'1')) or ( b.stock_amount <> 0))" +
+            "   order by location")
     List<YpBaseYfVo> selectYpInventoryData(@Param("groupNo") String groupNo, @Param("infusionFlag") String infusionFlag, @Param("visibleFlag") String visibleFlag);
 
     /**

+ 23 - 3
src/main/resources/static/js/yf/ward_prescription.js

@@ -9,6 +9,8 @@ var wardName = "";
 var hzFlag = 0;//最近浏览药单还是科室汇总药单
 var nfdPrintIndex = window.localStorage["nfdPrintIndex"];
 var tableInterval;
+var lastrow;//最后编辑单元格的行
+var lastcell;//最后编辑单元格的列
 $(function () {
     init_daterangepicker();
     $('#reportrange span').html(moment().subtract(10, 'days').format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
@@ -689,6 +691,10 @@ function initSummarizingTable() {
         jsonReader: {
             root: "data", repeatitems: false
         },
+        beforeEditCell:function(rowid, cellname, v, iRow, iCol){
+            lastrow = iRow;
+            lastcell = iCol;
+        },
         afterSaveCell: function (rowid, celname, value, iRow, iCol) {
             if(celname === 'manuNo'){
                 return true
@@ -906,6 +912,10 @@ function initDetailTable() {
         jsonReader: {
             root: "data", repeatitems: false
         },
+        beforeEditCell:function(rowid, cellname, v, iRow, iCol){
+            lastrow = iRow;
+            lastcell = iCol;
+        },
         afterSaveCell: function (rowid, celname, value, iRow, iCol) {
             if(celname === 'manuNo'){
                 return true
@@ -1543,6 +1553,7 @@ function save(flag) {
     if (groupNo === '81') {
         sendZy();
     } else {
+        $("#"+(flag == 0 ? "tb_summarizing_table" : "tb_detail_table")).jqGrid("saveCell",lastrow,lastcell);//当前单元格退出编辑模式
         sendXy(flag);
     }
 }
@@ -1566,8 +1577,17 @@ function sendZy() {
  * @param flag
  */
 function sendXy(flag) {
-    //拿到grid对象
-    var obj = (flag == 0 ? "tb_summarizing_table" : "tb_detail_table");
+    var tableId = (flag == 0 ? "tb_summarizing_table" : "tb_detail_table");
+    var obj = $("#" + tableId);
+    var rowIds = obj.getDataIDs();
+    var arrayData = new Array();
+    if (rowIds.length > 0) {
+        for (var i = 0; i < rowIds.length; i++) {
+            if(obj.getRowData(rowIds[i]).fybz.indexOf('暂缓') == -1){
+                arrayData.push(obj.getRowData(rowIds[i]));
+            }
+        }
+    }
     $(flag == 0 ? "#collect_save" : "#detail_save").attr('disabled', true);
     $.ajax({
         type: "POST",
@@ -1577,7 +1597,7 @@ function sendXy(flag) {
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
         data: JSON.stringify({
             pageNo: hzFlag === 0 ? pageNo : pageNos,
-            yzYpZyOrders: getJQAllData(obj)
+            yzYpZyOrders: arrayData
         }),
         success: function (res) {
             $(flag == 0 ? "#collect_save" : "#detail_save").attr('disabled', false);