Browse Source

优化移动医保支付接口

lighter 4 months ago
parent
commit
5b4c12a025

+ 0 - 5
src/main/java/thyyxxk/simzfeeoprnsystm/controller/MobilePayApiController.java

@@ -16,11 +16,6 @@ public class MobilePayApiController {
         this.service = service;
     }
 
-    @GetMapping("/writeMtReceipt")
-    public String writeMtReceipt(@RequestParam("hisOrdNum") String hisOrdNum) {
-       return service.writeMtReceipt(hisOrdNum);
-    }
-
     @PostMapping("/getUpload6201")
     public Upload6201 getUpload6201(@RequestBody InsuinfoRequest request) throws Exception {
         return service.getUpload6201(request);

+ 11 - 8
src/main/java/thyyxxk/simzfeeoprnsystm/service/MobilePayService.java

@@ -11,6 +11,7 @@ import thyyxxk.simzfeeoprnsystm.utils.StringUtil;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.Objects;
 
 @Slf4j
 @Service
@@ -24,22 +25,24 @@ public class MobilePayService {
         this.mzService = mzService;
     }
 
-    public String writeMtReceipt(String hisOrdNum) {
-        String[] arr = hisOrdNum.split("_");
-        if (arr.length != 3) {
-            return "hisOrdNum[" + hisOrdNum + "]不正确!";
-        }
+    private String writeMtReceipt(String patNo, Integer times) {
         MzPatientInfo mzptnt = new MzPatientInfo();
-        mzptnt.setPatNo(arr[0]);
-        mzptnt.setTimes(Integer.parseInt(arr[1]));
+        mzptnt.setPatNo(patNo);
+        mzptnt.setTimes(times);
         return mzService.generateSiMzFees(mzptnt);
     }
 
     public Upload6201 getUpload6201(InsuinfoRequest request) throws Exception {
         Upload6201 upload6201 = dao.selectUpload6201(request.getPatNo(), request.getTimes());
         if (null == upload6201) {
-            throw new Exception("mz_visit_table患者信息为空,请联系医生重开处方。");
+            // mz_visit_table为空
+            throw new Exception("患者就诊信息为空,请联系医生重开处方。");
+        }
+        String wrt = writeMtReceipt(request.getPatNo(), request.getTimes());
+        if (!Objects.equals(wrt, "SUCCESS")) {
+            return null;
         }
+
         upload6201.setMedType("11");
         upload6201.setCaty(upload6201.getDeptId());
         List<Diseinfo> diseinfoList = dao.selectMpDiseinfos(request.getPatNo(), request.getTimes());