Browse Source

保存窗口打印机配置

lihong 2 tuần trước cách đây
mục cha
commit
8ad2fda260

+ 18 - 10
src/main/java/cn/hnthyy/thmz/controller/mz/WindowsController.java

@@ -1,10 +1,6 @@
 package cn.hnthyy.thmz.controller.mz;
 
-import cn.hnthyy.thmz.Utils.HttpUtil;
-import cn.hnthyy.thmz.Utils.JsonUtil;
-import cn.hnthyy.thmz.Utils.MacAddressUtil;
-import cn.hnthyy.thmz.Utils.R;
-import cn.hnthyy.thmz.Utils.TokenUtil;
+import cn.hnthyy.thmz.Utils.*;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.entity.thmz.Windows;
@@ -13,11 +9,7 @@ import com.auth0.jwt.interfaces.DecodedJWT;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Date;
@@ -94,6 +86,22 @@ public class WindowsController {
         }
     }
 
+    @PostMapping("/saveWindowPrint")
+    public R saveWindowPrint(@RequestBody Windows windows){
+        AssertUtil.isNotBlank(windows.getWindowsNo(),"窗口号不能为空");
+        AssertUtil.isNotBlank(windows.getDeptNo(),"院区号不能为空");
+        AssertUtil.isNotBlank(windows.getIpAddress(),"ip地址不能为空");
+        AssertUtil.isNotBlank(windows.getUserIdCode(),"用户编码不能为空");
+        windows.setCreateDate(new Date());
+        Windows windowsDb= windowsService.queryLastWindowsIpAddress(windows.getIpAddress());
+        if(windowsDb != null){
+            windows.setId(windowsDb.getId());
+        }
+        int num = windowsService.saveWindows(windows);
+        return R.ok();
+    }
+
+
     @GetMapping("/initWindowsCache")
     public R initWindowsCache(){
         windowsService.initWindowsCache();

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/Windows.java

@@ -21,6 +21,8 @@ public class Windows {
     private Integer zyPrintIndex;
     //默认常规打印机下标 一般用途打印机
     private Integer cgPrintIndex;
+    //住院预交金打印机下标 zy_yjj_print_index
+    private Integer zyYjjPrintIndex;
     //普通住院腕带打印机
     private Integer normalWristStrapPrintIndex;
     //儿童住院腕带打印机

+ 7 - 4
src/main/java/cn/hnthyy/thmz/mapper/thmz/WindowsMapper.java

@@ -11,12 +11,12 @@ public interface WindowsMapper {
      * @return
      */
     @Insert("INSERT INTO t_windows(dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address, " +
-            "create_date,update_date,client_ip_address,mis_pos_router_code,normal_wrist_strap_print_index,child_wrist_strap_print_index) " +
+            "create_date,update_date,client_ip_address,mis_pos_router_code,normal_wrist_strap_print_index,child_wrist_strap_print_index,zy_yjj_print_index) " +
             "VALUES " +
             "(#{deptNo,jdbcType=VARCHAR},#{windowsNo,jdbcType=INTEGER},#{printIndex,jdbcType=INTEGER},#{zyPrintIndex,jdbcType=INTEGER}," +
             "#{cgPrintIndex,jdbcType=INTEGER},#{userIdCode,jdbcType=VARCHAR},#{ipAddress,jdbcType=VARCHAR}, " +
             "#{createDate,jdbcType=TIMESTAMP}, #{updateDate,jdbcType=TIMESTAMP},#{clientIpAddress,jdbcType=VARCHAR}," +
-            "#{misPosRouterCode,jdbcType=VARCHAR},#{normalWristStrapPrintIndex,jdbcType=INTEGER},#{childWristStrapPrintIndex,jdbcType=INTEGER})")
+            "#{misPosRouterCode,jdbcType=VARCHAR},#{normalWristStrapPrintIndex,jdbcType=INTEGER},#{childWristStrapPrintIndex,jdbcType=INTEGER},#{zyYjjPrintIndex,jdbcType=INTEGER})")
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int insertUser(Windows windows);
 
@@ -28,7 +28,7 @@ public interface WindowsMapper {
      */
     @Select({"<script>",
             "select top 1 id,dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address,create_date,update_date," +
-            "client_ip_address,mis_pos_router_code,normal_wrist_strap_print_index,child_wrist_strap_print_index " +
+            "client_ip_address,mis_pos_router_code,normal_wrist_strap_print_index,child_wrist_strap_print_index,zy_yjj_print_index " +
             "from t_windows where user_id_code= #{userIdCode,jdbcType=VARCHAR} " +
             "order by create_date desc ",
             "</script>"})
@@ -43,7 +43,7 @@ public interface WindowsMapper {
      */
     @Select({"<script>",
             "select top 1 id,dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address, create_date," +
-            "update_date,client_ip_address,mis_pos_router_code,normal_wrist_strap_print_index,child_wrist_strap_print_index " +
+            "update_date,client_ip_address,mis_pos_router_code,normal_wrist_strap_print_index,child_wrist_strap_print_index,zy_yjj_print_index " +
             "from t_windows where ip_address= #{ipAddress,jdbcType=VARCHAR} " +
             "order by create_date desc ",
             "</script>"})
@@ -79,6 +79,9 @@ public interface WindowsMapper {
             "<when test='childWristStrapPrintIndex!=null'>",
             ",child_wrist_strap_print_index=#{childWristStrapPrintIndex,jdbcType=INTEGER}",
             "</when>",
+            "<when test='zyYjjPrintIndex!=null'>",
+            ",zy_yjj_print_index=#{zyYjjPrintIndex,jdbcType=INTEGER}",
+            "</when>",
             "<when test='ipAddress!=null'>",
             ",ip_address=#{ipAddress}",
             "</when>",