|
@@ -0,0 +1,75 @@
|
|
|
+package thyyxxk.webserver.controller.outpatient.template;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
+import thyyxxk.webserver.entity.ResultVo;
|
|
|
+import thyyxxk.webserver.entity.outpatient.template.TcInquiry;
|
|
|
+import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
+
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/template")
|
|
|
+public class TemplateController {
|
|
|
+ @Value("${appletThmzUrl}")
|
|
|
+ private String appletThmzUrl;
|
|
|
+
|
|
|
+ @PostMapping("/queryTcDepartment")
|
|
|
+ public ResultVo<JSONArray> queryTcDepartment() {
|
|
|
+ String url = appletThmzUrl + "/queryTcDiscuntDept";
|
|
|
+ ResultVo response = new RestTemplate().getForObject(url, ResultVo.class);
|
|
|
+ if (null == response) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (response.getCode() == 0) {
|
|
|
+ response.setCode(200);
|
|
|
+ }
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/queryAllDepartment")
|
|
|
+ public ResultVo<JSONArray> queryAllDepartment() {
|
|
|
+ String url = appletThmzUrl + "/queryAllDept";
|
|
|
+ ResultVo response = new RestTemplate().getForObject(url, ResultVo.class);
|
|
|
+ if (null == response) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (response.getCode() == 0) {
|
|
|
+ response.setCode(200);
|
|
|
+ }
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/queryTcByDepartment")
|
|
|
+ public ResultVo queryTcByDepartment(@RequestBody TcInquiry inquiry) {
|
|
|
+ String url = appletThmzUrl + "/queryTcByDeptCode";
|
|
|
+ ResultVo response = new RestTemplate().postForObject(url, inquiry, ResultVo.class);
|
|
|
+ if (null == response) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (response.getCode() == 0) {
|
|
|
+ response.setCode(200);
|
|
|
+ }
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/queryTcByTemplateId")
|
|
|
+ public ResultVo queryTcByTemplateId(@RequestBody TcInquiry inquiry) {
|
|
|
+ String url = appletThmzUrl + "/queryTcByTemplateId";
|
|
|
+ ResultVo response = new RestTemplate().postForObject(url, inquiry, ResultVo.class);
|
|
|
+ if (null == response) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (response.getCode() == 0) {
|
|
|
+ response.setCode(200);
|
|
|
+ }
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+}
|