Kaynağa Gözat

优化打印参数设置,按照ip设置

hurugang 3 yıl önce
ebeveyn
işleme
2191d2b96a

+ 4 - 4
src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java

@@ -720,7 +720,7 @@ public class MedicalViewApiController {
             mzDepositFile.setAgtordnum(haiciCharge.getAgtOrdNum());
             mzDepositFile.setAmount(haiciCharge.getPayAmt().divide(BigDecimal.valueOf(100)));
             mzDepositFileVo.setMzDepositFiles(Arrays.asList(mzDepositFile));
-            mzChargeDetailService.chargeFee(Constants.BRZZJF_CODE, mzDepositFileVo);
+            mzChargeDetailService.chargeFee(Constants.BRZZJF_CODE, mzDepositFileVo,Constants.BRZZJF_CODE);
             results.put("resultCode", 0);
             results.put("resultMessage", "缴费成功");
             results.put("guideListInfo", "");
@@ -862,7 +862,7 @@ public class MedicalViewApiController {
             mzDepositFileVo.setReceiptNo(Integer.valueOf(arr[2]));
             mzDepositFileVo.setChargeItemCodes(chargeItemCodes);
             User tokenUser = userService.queryUserByUserIdCode(Constants.BRZZJF_CODE);
-            mzChargeDetailService.refundFee(tokenUser.getUserIdCode(), mzDepositFileVo);
+            mzChargeDetailService.refundFee(tokenUser.getUserIdCode(), mzDepositFileVo,Constants.BRZZJF_CODE);
             results.put("resultCode", 0);
             results.put("resultMessage", "退费成功");
             results.put("guideListInfo", "");
@@ -1797,7 +1797,7 @@ public class MedicalViewApiController {
                 return resultMap;
             }
             mzyReqrec.setOpId(Constants.BRZZJF_CODE);
-            int num = mzyReqrecService.saveMzyReqrec(mzyReqrecPageDto);
+            int num = mzyReqrecService.saveMzyReqrec(mzyReqrecPageDto,Constants.BRZZJF_CODE);
             if (num == 0) {
                 resultMap.put("resultCode", -1);
                 resultMap.put("message", "挂号失败,请稍后重试!");
@@ -2101,7 +2101,7 @@ public class MedicalViewApiController {
             MzDepositFile mzDepositFile = new MzDepositFile();
             mzDepositFile.setChequeType(Constants.YBJZ);
             mzDepositFileVo.setMzDepositFiles(Arrays.asList(mzDepositFile));
-            mzChargeDetailService.chargeFee(Constants.DBZJF_CODE, mzDepositFileVo);
+            mzChargeDetailService.chargeFee(Constants.DBZJF_CODE, mzDepositFileVo,Constants.DBZJF_CODE);
             results.put("resultCode", 0);
             results.put("resultMessage", "单病种缴费成功");
             results.put("guideListInfo", "");

+ 5 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.Utils.HttpUtil;
 import cn.hnthyy.thmz.Utils.JsonUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
@@ -350,7 +351,8 @@ public class MzChargeDetailController {
                 int receiptNo = mzChargeDetailService.chargeFeeForByjz(tokenUser.getUserIdCode(), mzDepositFileVo);
                 resultMap.put("receiptNo", receiptNo);
             } else {
-                int receiptNo = mzChargeDetailService.chargeFee(tokenUser.getUserIdCode(), mzDepositFileVo);
+                String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
+                int receiptNo = mzChargeDetailService.chargeFee(tokenUser.getUserIdCode(), mzDepositFileVo,ipAddress);
                 resultMap.put("receiptNo", receiptNo);
             }
             resultMap.put("code", 0);
@@ -745,7 +747,8 @@ public class MzChargeDetailController {
             DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
             User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
             //如果返回的是0,表示全退,大于0,表示新的收费记录的就诊次数
-            int times = mzChargeDetailService.refundFee(tokenUser.getUserIdCode(), mzDepositFileVo);
+            String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
+            int times = mzChargeDetailService.refundFee(tokenUser.getUserIdCode(), mzDepositFileVo,ipAddress);
             resultMap.put("code", 0);
             resultMap.put("times", times);
             resultMap.put("patientId", mzDepositFileVo.getPatientId());

+ 2 - 1
src/main/java/cn/hnthyy/thmz/controller/mz/MzyReqrecController.java

@@ -126,7 +126,8 @@ public class MzyReqrecController {
             DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
             User tokenUser = (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
             mzyReqrec.setOpId(tokenUser.getUserIdCode());
-            int num = mzyReqrecService.saveMzyReqrec(mzyReqrecPageDto);
+            String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
+            int num = mzyReqrecService.saveMzyReqrec(mzyReqrecPageDto,ipAddress);
             if (num == 0) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "挂号失败,请稍后重试!");

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

@@ -66,11 +66,11 @@ public class WindowsController {
         DecodedJWT decodedJWT=TokenUtil.parseJWT(token);
         User tokenUser=(User)JsonUtil.jsontoObject(decodedJWT.getSubject(),User.class);
         try {
-            //String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
-            //windows.setIpAddress(ipAddress);
+            String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
+            windows.setIpAddress(ipAddress);
             windows.setUserIdCode(tokenUser.getUserIdCode());
             windows.setCreateDate(new Date());
-            Windows windowsDb=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
+            Windows windowsDb=windowsService.queryLastWindowsIpAddress(ipAddress);
             if(windowsDb!=null){
                 windows.setId(windowsDb.getId());
             }
@@ -122,11 +122,11 @@ public class WindowsController {
         DecodedJWT decodedJWT=TokenUtil.parseJWT(token);
         User tokenUser=(User)JsonUtil.jsontoObject(decodedJWT.getSubject(),User.class);
         try {
-            //String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
-            //windows.setIpAddress(ipAddress);
+            String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
+            windows.setIpAddress(ipAddress);
             windows.setUserIdCode(tokenUser.getUserIdCode());
             windows.setCreateDate(new Date());
-            Windows windowsDb=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
+            Windows windowsDb=windowsService.queryLastWindowsIpAddress(ipAddress);
             if(windowsDb!=null){
                 windows.setId(windowsDb.getId());
             }
@@ -268,10 +268,10 @@ public class WindowsController {
             return resultMap;
         }
         try {
-            //String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
-            DecodedJWT decodedJWT=TokenUtil.parseJWT(token);
-            User tokenUser=(User)JsonUtil.jsontoObject(decodedJWT.getSubject(),User.class);
-            Windows windows=windowsService.queryLastWindowsByUserIdCode(tokenUser.getUserIdCode(),null);
+            String ipAddress=HttpUtil.getIPAddress(httpServletRequest);
+            //DecodedJWT decodedJWT=TokenUtil.parseJWT(token);
+            //User tokenUser=(User)JsonUtil.jsontoObject(decodedJWT.getSubject(),User.class);
+            Windows windows=windowsService.queryLastWindowsIpAddress(ipAddress);
             if(windows!=null){
                 resultMap.put("code", 0);
                 resultMap.put("message", "查询收费员设置成功");

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

@@ -15,20 +15,33 @@ public interface WindowsMapper {
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int insertUser(Windows windows);
 
+//    /**
+//     * 查询用户的最后一个在使用中的窗口号
+//     *
+//     * @param userIdCode
+//     * @return
+//     */
+//    @Select({"<script>",
+//            "select id,dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address, create_date,update_date from t_windows where user_id_code= #{userIdCode,jdbcType=VARCHAR} " +
+//            "<when test='ipAddress!=null'>",
+//            " or ip_address= #{ipAddress,jdbcType=VARCHAR} ",
+//            "</when>",
+//            "order by create_date desc limit 1",
+//            "</script>"})
+//    Windows selectLastWindowsByUserIdCode(@Param("userIdCode") String userIdCode, @Param("ipAddress") String ipAddress);
+
+
     /**
-     * 查询用户的最后一个在使用中的窗口号
+     * 查询IP地址的最后一个在使用中的窗口号
      *
-     * @param userIdCode
+     * @param ipAddress
      * @return
      */
     @Select({"<script>",
-            "select id,dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address, create_date,update_date from t_windows where user_id_code= #{userIdCode,jdbcType=VARCHAR} " +
-            "<when test='ipAddress!=null'>",
-            " or ip_address= #{ipAddress,jdbcType=VARCHAR} ",
-            "</when>",
+            "select id,dept_no,windows_no,print_index,zy_print_index,cg_print_index,user_id_code,ip_address, create_date,update_date from t_windows where ip_address= #{ipAddress,jdbcType=VARCHAR} " +
             "order by create_date desc limit 1",
             "</script>"})
-    Windows selectLastWindowsByUserIdCode(@Param("userIdCode") String userIdCode, @Param("ipAddress") String ipAddress);
+    Windows selectLastWindowsByIpAddress(@Param("ipAddress") String ipAddress);
 
     /**
      * 更新设置

+ 4 - 2
src/main/java/cn/hnthyy/thmz/service/his/mz/MzChargeDetailService.java

@@ -87,9 +87,10 @@ public interface MzChargeDetailService {
      *
      * @param opId
      * @param mzDepositFileVo
+     * @param ipAddress   客户端IP  自助的时候是传自助编码
      * @return
      */
-    int chargeFee(String opId, MzDepositFileVo mzDepositFileVo) throws MzException;
+    int chargeFee(String opId, MzDepositFileVo mzDepositFileVo,String ipAddress) throws MzException;
 
     /**
      * 查询当前就诊次数的所有取药号与药房信息
@@ -132,9 +133,10 @@ public interface MzChargeDetailService {
      *
      * @param opId
      * @param mzDepositFileVo
+     * @param ipAddress 客户端IP  自助的时候是传自助编码
      * @return
      */
-    int refundFee(String opId, MzDepositFileVo mzDepositFileVo) throws MzException;
+    int refundFee(String opId, MzDepositFileVo mzDepositFileVo,String ipAddress) throws MzException;
 
     /**
      * 获取退费后新产生的缴费明细记录

+ 2 - 1
src/main/java/cn/hnthyy/thmz/service/his/mz/MzyReqrecService.java

@@ -18,10 +18,11 @@ public interface MzyReqrecService {
      * 保存挂号信息
      *
      * @param mzyReqrecPageDto
+     * @param ipAddress 客户端IP  自助的时候是传自助编码
      * @return
      * @throws MzException
      */
-    int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) throws MzException;
+    int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto,String ipAddress) throws MzException;
 
 
     /**

+ 4 - 4
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -651,8 +651,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
-    public int chargeFee(String opId, MzDepositFileVo mzDepositFileVo) throws MzException {
-        Windows windows = windowsMapper.selectLastWindowsByUserIdCode(opId, null);
+    public int chargeFee(String opId, MzDepositFileVo mzDepositFileVo,String ipAddress) throws MzException {
+        Windows windows = windowsMapper.selectLastWindowsByIpAddress(ipAddress);
         if (windows == null) {
             throw new MzException("当前操作人未设置窗口号,请先设置!");
         }
@@ -2640,8 +2640,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
-    public int refundFee(String opId, MzDepositFileVo mzDepositFileVo) throws MzException {
-        Windows windows = windowsMapper.selectLastWindowsByUserIdCode(opId, null);
+    public int refundFee(String opId, MzDepositFileVo mzDepositFileVo,String ipAddress) throws MzException {
+        Windows windows = windowsMapper.selectLastWindowsByIpAddress(ipAddress);
         if (windows == null) {
             throw new MzException("当前操作人未设置窗口号,请先设置!");
         }

+ 2 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzyReqrecServiceImpl.java

@@ -111,13 +111,13 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
-    public int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) throws MzException {
+    public int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto,String ipAddress) throws MzException {
         MzyReqrec mzyReqrec = mzyReqrecPageDto.getMzyReqrec();
         MzPatientMi mzPatientMi = mzPatientMiMapper.selectByPatientId(mzyReqrec.getPatientId());
         if (mzPatientMi == null) {
             throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
         }
-        Windows windows = windowsMapper.selectLastWindowsByUserIdCode(mzyReqrec.getOpId(), null);
+        Windows windows = windowsMapper.selectLastWindowsByIpAddress(ipAddress);
         if (windows == null) {
             throw new MzException("当前操作人未设置窗口号,请先设置!");
         }

+ 7 - 2
src/main/java/cn/hnthyy/thmz/service/impl/thmz/WindowsServiceImpl.java

@@ -23,9 +23,14 @@ public class WindowsServiceImpl implements WindowsService {
 
     }
 
+//    @Override
+//    public Windows queryLastWindowsByUserIdCode(String userIdCode,String ipAddress) {
+//        return windowsMapper.selectLastWindowsByUserIdCode(userIdCode,ipAddress);
+//    }
+
     @Override
-    public Windows queryLastWindowsByUserIdCode(String userIdCode,String ipAddress) {
-        return windowsMapper.selectLastWindowsByUserIdCode(userIdCode,ipAddress);
+    public Windows queryLastWindowsIpAddress(String ipAddress) {
+        return windowsMapper.selectLastWindowsByIpAddress(ipAddress);
     }
 
     @Override

+ 10 - 3
src/main/java/cn/hnthyy/thmz/service/thmz/WindowsService.java

@@ -11,12 +11,19 @@ public interface WindowsService {
      */
     int saveWindows(Windows windows);
 
+//    /**
+//     * 查询用户的最后一个在使用中的窗口号
+//     * @param userIdCode
+//     * @return
+//     */
+//    Windows queryLastWindowsByUserIdCode(String userIdCode,String ipAddress);
+
     /**
-     * 查询用户的最后一个在使用中的窗口号
-     * @param userIdCode
+     * 查询IP地址的最后一个在使用中的窗口号
+     * @param ipAddress
      * @return
      */
-    Windows queryLastWindowsByUserIdCode(String userIdCode,String ipAddress);
+    Windows queryLastWindowsIpAddress(String ipAddress);
 
     /**
      * 更新打印机下标