|
@@ -8,11 +8,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import thyyxxk.simzfeeoprnsystm.dao.RxDao;
|
|
|
import thyyxxk.simzfeeoprnsystm.dicts.SiFunction;
|
|
|
+import thyyxxk.simzfeeoprnsystm.pojo.ResultVo;
|
|
|
import thyyxxk.simzfeeoprnsystm.pojo.digitalreceipt.*;
|
|
|
import thyyxxk.simzfeeoprnsystm.pojo.digitalreceipt.request.*;
|
|
|
-import thyyxxk.simzfeeoprnsystm.utils.DateUtil;
|
|
|
-import thyyxxk.simzfeeoprnsystm.utils.Global;
|
|
|
-import thyyxxk.simzfeeoprnsystm.utils.StringUtil;
|
|
|
+import thyyxxk.simzfeeoprnsystm.utils.*;
|
|
|
import thyyxxk.simzfeeoprnsystm.utils.rxsign.HseEncAndDecUtil;
|
|
|
|
|
|
import com.itextpdf.text.*;
|
|
@@ -37,7 +36,7 @@ public class DigitalReceiptService {
|
|
|
this.rxDao = rxDao;
|
|
|
}
|
|
|
|
|
|
- public JSONObject rxPreCheck(RxPreCheckRequest request) throws Exception {
|
|
|
+ public ResultVo<JSONObject> rxPreCheck(RxPreCheckRequest request) throws Exception {
|
|
|
String dataRef = JSONObject.toJSONStringWithDateFormat(request.getRxPreCheck(), "yyyy-MM-dd HH:mm:ss");
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
String rxdrugdetailRef = JSONArray.toJSONStringWithDateFormat(request.getRxDrugDetailList(), "yyyy-MM-dd HH:mm:ss");
|
|
@@ -53,7 +52,7 @@ public class DigitalReceiptService {
|
|
|
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
- return result;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
|
|
|
JSONObject decryptResult = HseEncAndDecUtil.decryptMsg(result);
|
|
@@ -69,10 +68,10 @@ public class DigitalReceiptService {
|
|
|
rxUpload.setRxFile(createRxPdf(request));
|
|
|
rxDao.insertRxPrecheck(request.getPatientId(), request.getTimes(), rxUpload);
|
|
|
deleteRxPdfFile(request);
|
|
|
- return decryptResult;
|
|
|
+ return ResultVoUtil.success(decryptResult);
|
|
|
}
|
|
|
|
|
|
- public JSONObject rxSign(RxSignRequest request) throws Exception {
|
|
|
+ public ResultVo<JSONObject> rxSign(RxSignRequest request) throws Exception {
|
|
|
String dataRef = JSONObject.toJSONStringWithDateFormat(request.getRxSign(), "yyyy-MM-dd HH:mm:ss");
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
@@ -81,16 +80,16 @@ public class DigitalReceiptService {
|
|
|
log.info("电子处方医保电子签名:\n参数:{},\n结果:{}", input, result);
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
- return result;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
JSONObject decryptResult = HseEncAndDecUtil.decryptMsg(result);
|
|
|
String signDigest = decryptResult.getString("signDigest");
|
|
|
String rxFile = decryptResult.getString("rxFile");
|
|
|
rxDao.updateSignDigest(request.getPatientId(), request.getTimes(), signDigest, rxFile);
|
|
|
- return decryptResult;
|
|
|
+ return ResultVoUtil.success(decryptResult);
|
|
|
}
|
|
|
|
|
|
- public JSONObject rxUpload(RxUploadRequest request) throws Exception {
|
|
|
+ public ResultVo<JSONObject> rxUpload(RxUploadRequest request) throws Exception {
|
|
|
String dataRef = JSONObject.toJSONStringWithDateFormat(request.getRxUpload(), "yyyy-MM-dd HH:mm:ss");
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
@@ -99,15 +98,15 @@ public class DigitalReceiptService {
|
|
|
log.info("电子处方上传:\n参数:{},\n结果:{}", input, result);
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
- return result;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
JSONObject decryptResult = HseEncAndDecUtil.decryptMsg(result);
|
|
|
String hiRxno = decryptResult.getString("hiRxno");
|
|
|
rxDao.updateRxState(hiRxno, RxState.UPLOADED);
|
|
|
- return decryptResult;
|
|
|
+ return ResultVoUtil.success(decryptResult);
|
|
|
}
|
|
|
|
|
|
- public JSONObject rxRevoke(RxRevokeRequest request) throws Exception {
|
|
|
+ public ResultVo<JSONObject> rxRevoke(RxRevokeRequest request) throws Exception {
|
|
|
String dataRef = JSONObject.toJSONStringWithDateFormat(request.getRxRevoke(), "yyyy-MM-dd HH:mm:ss");
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
@@ -116,15 +115,15 @@ public class DigitalReceiptService {
|
|
|
log.info("电子处方撤销:\n参数:{},\n结果:{}", input, result);
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
- return result;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
JSONObject decryptResult = HseEncAndDecUtil.decryptMsg(result);
|
|
|
String hiRxno = decryptResult.getString("hiRxno");
|
|
|
rxDao.updateRxState(hiRxno, RxState.REVOKED);
|
|
|
- return decryptResult;
|
|
|
+ return ResultVoUtil.success(decryptResult);
|
|
|
}
|
|
|
|
|
|
- public JSONObject rxInfoQuery(RxInfoQueryRequest request) throws Exception {
|
|
|
+ public ResultVo<JSONObject> rxInfoQuery(RxInfoQueryRequest request) throws Exception {
|
|
|
String dataRef = JSONObject.toJSONStringWithDateFormat(request.getRxInfoQuery(), "yyyy-MM-dd HH:mm:ss");
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
@@ -133,12 +132,12 @@ public class DigitalReceiptService {
|
|
|
log.info("电子处方信息查询:\n参数:{},\n结果:{}", input, result);
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
- return result;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
- return HseEncAndDecUtil.decryptMsg(result);
|
|
|
+ return ResultVoUtil.success(HseEncAndDecUtil.decryptMsg(result));
|
|
|
}
|
|
|
|
|
|
- public JSONObject rxAuditingQuery(RxAuditingQueryRequest request) throws Exception {
|
|
|
+ public ResultVo<JSONObject> rxAuditingQuery(RxAuditingQueryRequest request) throws Exception {
|
|
|
String dataRef = JSONObject.toJSONStringWithDateFormat(request.getRxAuditingQuery(), "yyyy-MM-dd HH:mm:ss");
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
@@ -147,12 +146,12 @@ public class DigitalReceiptService {
|
|
|
log.info("电子处方审核结果查询:\n参数:{},\n结果:{}", input, result);
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
- return result;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
- return HseEncAndDecUtil.decryptMsg(result);
|
|
|
+ return ResultVoUtil.success(HseEncAndDecUtil.decryptMsg(result));
|
|
|
}
|
|
|
|
|
|
- public JSONObject rxSetlQuery(RxSetlQueryRequest request) throws Exception {
|
|
|
+ public ResultVo<JSONObject> rxSetlQuery(RxSetlQueryRequest request) throws Exception {
|
|
|
String dataRef = JSONObject.toJSONStringWithDateFormat(request.getRxSetlQuery(), "yyyy-MM-dd HH:mm:ss");
|
|
|
JSONObject data = JSONObject.parseObject(dataRef);
|
|
|
log.info("明文:{}", data);
|
|
@@ -161,9 +160,9 @@ public class DigitalReceiptService {
|
|
|
log.info("电子处方取药结果查询:\n参数:{},\n结果:{}", input, result);
|
|
|
Integer code = result.getInteger("code");
|
|
|
if (null == code || code != 0){
|
|
|
- return result;
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString("message"));
|
|
|
}
|
|
|
- return HseEncAndDecUtil.decryptMsg(result);
|
|
|
+ return ResultVoUtil.success(HseEncAndDecUtil.decryptMsg(result));
|
|
|
}
|
|
|
|
|
|
private String createRxPdf(RxPreCheckRequest request) throws Exception {
|