|
@@ -6,6 +6,7 @@ import com.itextpdf.text.Font;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.simzfeeoprnsystm.dao.RxDao;
|
|
|
import thyyxxk.simzfeeoprnsystm.dicts.SiFunction;
|
|
|
import thyyxxk.simzfeeoprnsystm.pojo.CodeName;
|
|
@@ -32,11 +33,20 @@ import java.util.List;
|
|
|
public class DigitalReceiptService {
|
|
|
private final ExecService exec;
|
|
|
private final RxDao rxDao;
|
|
|
+ private final RestTemplate template;
|
|
|
+ // 处方流转正式地址
|
|
|
+ // private final static String cflzUrl = "http://130.150.161.72:8079/cflz";
|
|
|
+ // private final static String ypcxUrl = "http://130.150.161.72:8079/cflzYpcx";
|
|
|
+
|
|
|
+ // 处方流转测试地址
|
|
|
+ private final static String cflzUrl = "http://130.150.161.72:8079/testCflz";
|
|
|
+ private final static String ypcxUrl = "http://130.150.161.72:8079/testCflzYpcx";
|
|
|
|
|
|
@Autowired
|
|
|
- public DigitalReceiptService(ExecService exec, RxDao rxDao) {
|
|
|
+ public DigitalReceiptService(ExecService exec, RxDao rxDao, RestTemplate template) {
|
|
|
this.exec = exec;
|
|
|
this.rxDao = rxDao;
|
|
|
+ this.template = template;
|
|
|
}
|
|
|
|
|
|
public ResultVo<JSONObject> medicineInquiry(MedicineInquiry inquiry) throws Exception {
|
|
@@ -54,10 +64,12 @@ public class DigitalReceiptService {
|
|
|
String dataRef = JSONObject.toJSONString(inquiry);
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("电子处方药品查询页码:{}", inquiry.getPageNum());
|
|
|
-
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_QUERY_MEDICINE);
|
|
|
-
|
|
|
+ JSONObject result = template.postForObject(ypcxUrl, input, JSONObject.class);
|
|
|
+ log.info("电子处方药品查询结果:{}", result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
@@ -124,9 +136,12 @@ public class DigitalReceiptService {
|
|
|
data.put("diseinfo", JSONArray.parseArray(diseinfoRef));
|
|
|
log.info("明文:{}", data);
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_PRE_CHECK);
|
|
|
+ JSONObject result = template.postForObject(cflzUrl + "/uploadChk", input, JSONObject.class);
|
|
|
log.info("电子处方上传预核验:\n参数:{},\n结果:{}", input, result);
|
|
|
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
@@ -160,8 +175,11 @@ public class DigitalReceiptService {
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_SIGN);
|
|
|
+ JSONObject result = template.postForObject(cflzUrl + "/rxFixmedinsSign", input, JSONObject.class);
|
|
|
log.info("电子处方医保电子签名:\n参数:{},\n结果:{}", input, result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
@@ -178,8 +196,11 @@ public class DigitalReceiptService {
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_UPLOAD);
|
|
|
+ JSONObject result = template.postForObject(cflzUrl + "/rxFileUpld", input, JSONObject.class);
|
|
|
log.info("电子处方上传:\n参数:{},\n结果:{}", input, result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
@@ -195,8 +216,11 @@ public class DigitalReceiptService {
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_REVOKE);
|
|
|
+ JSONObject result = template.postForObject(cflzUrl + "/rxUndo", input, JSONObject.class);
|
|
|
log.info("电子处方撤销:\n参数:{},\n结果:{}", input, result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
@@ -212,8 +236,11 @@ public class DigitalReceiptService {
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_INFO_QUERY);
|
|
|
+ JSONObject result = template.postForObject(cflzUrl + "/hospRxDetlQuery", input, JSONObject.class);
|
|
|
log.info("电子处方信息查询:\n参数:{},\n结果:{}", input, result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
@@ -226,8 +253,11 @@ public class DigitalReceiptService {
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_AUDITING_QUERY);
|
|
|
+ JSONObject result = template.postForObject(cflzUrl + "/rxChkInfoQuery", input, JSONObject.class);
|
|
|
log.info("电子处方审核结果查询:\n参数:{},\n结果:{}", input, result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
@@ -240,8 +270,11 @@ public class DigitalReceiptService {
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
|
JSONObject input = HseEncAndDecUtil.encryptMsg(data);
|
|
|
- JSONObject result = exec.executeTrade(input, SiFunction.RX_SETL_QUERY);
|
|
|
+ JSONObject result = template.postForObject(cflzUrl + "/rxSetlInfoQuery", input, JSONObject.class);
|
|
|
log.info("电子处方取药结果查询:\n参数:{},\n结果:{}", input, result);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|