Browse Source

缴费成功通知药房接口

WANGJIALIANG 3 years ago
parent
commit
c92231ab77

+ 54 - 0
src/main/java/cn/hnthyy/thmz/controller/api/PharmacyApiController.java

@@ -0,0 +1,54 @@
+package cn.hnthyy.thmz.controller.api;
+
+
+import cn.hnthyy.thmz.service.thmz.DispensingSocketService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/api/v1")
+@Slf4j
+public class PharmacyApiController {
+
+    @Autowired
+    private DispensingSocketService dispensingSocketService;
+    /**
+     * 缴费成功,通知药房
+     *
+     * @return
+     */
+    @RequestMapping(value = "/sendToPharmacy", method = {RequestMethod.GET})
+    public Map<String, Object> sendToPharmacy(@RequestParam("patientId") String patientId, @RequestParam("times") Integer times) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (times == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "门诊次数不能为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(patientId)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "门诊ID不能为空");
+                return resultMap;
+            }
+            dispensingSocketService.sendToMedicineAndDispensing(patientId, times);
+            resultMap.put("code", 0);
+            resultMap.put("message", "通知药房成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("自助机缴费通知药房失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "自助机缴费通知药房失败");
+            return resultMap;
+        }
+    }
+}