|
@@ -1,8 +1,8 @@
|
|
|
package thyyxxk.wxservice_server.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baidu.aip.ocr.AipOcr;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -57,7 +57,7 @@ public class IdCardAnalyzeService {
|
|
|
options.put("detect_risk", "false");
|
|
|
String idCardSide = "front";
|
|
|
byte[] file = Base64.getMimeDecoder().decode(param.getContent().split("base64,")[1]);
|
|
|
- JSONObject res = client.idcard(file, idCardSide, options);
|
|
|
+ org.json.JSONObject res = client.idcard(file, idCardSide, options);
|
|
|
log.info("解析身份证图像结果:{}", res);
|
|
|
if (!res.toString().contains("idcard_number_type")) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "解析身份证服务出现异常,预计明日恢复,请手动输入您的信息。");
|
|
@@ -68,9 +68,9 @@ public class IdCardAnalyzeService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请上传正确的身份证图像!");
|
|
|
}
|
|
|
|
|
|
- private IdCardAnalyzeResult readIdCardInfoFromAipOcr(JSONObject res) {
|
|
|
+ private IdCardAnalyzeResult readIdCardInfoFromAipOcr(org.json.JSONObject res) {
|
|
|
IdCardAnalyzeResult idCard = new IdCardAnalyzeResult();
|
|
|
- JSONObject result = res.getJSONObject("words_result");
|
|
|
+ org.json.JSONObject result = res.getJSONObject("words_result");
|
|
|
String socialNo = result.getJSONObject("公民身份号码").getString("words");
|
|
|
idCard.setName(result.getJSONObject("姓名").getString("words"));
|
|
|
idCard.setSocialNo(socialNo);
|
|
@@ -110,13 +110,13 @@ public class IdCardAnalyzeService {
|
|
|
}
|
|
|
param.setIsDefault(param.getRelation() == 1 ? 1 :0);
|
|
|
RestTemplate template = new RestTemplate();
|
|
|
- com.alibaba.fastjson.JSONObject obj = new com.alibaba.fastjson.JSONObject();
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
obj.put("patIdType", "11");
|
|
|
obj.put("patIdNo", param.getSocialNo());
|
|
|
String result = template.postForObject(hrgApiUrl + "/queryPatientInfo", obj, String.class);
|
|
|
log.info("在绑卡前查询患者信息:\n参数:{}\n结果:{}", obj, result);
|
|
|
if (null != result) {
|
|
|
- com.alibaba.fastjson.JSONObject resobj = com.alibaba.fastjson.JSONObject.parseObject(result);
|
|
|
+ JSONObject resobj = JSONObject.parseObject(result);
|
|
|
if (resobj.getInteger("resultCode") == 0) {
|
|
|
param.setPatientId(resobj.getString("patHisNo"));
|
|
|
param.setIcCardNo(resobj.getString("patCardNo"));
|
|
@@ -125,8 +125,9 @@ public class IdCardAnalyzeService {
|
|
|
}
|
|
|
}
|
|
|
CreatCardParam card = makeCreateCardParam(param);
|
|
|
+ log.info("首诊患者建档参数:{}", JSONObject.toJSONString(card));
|
|
|
CreateCardResponse hrgResponse = template.postForObject(hrgApiUrl + "/savePatientInfo", card, CreateCardResponse.class);
|
|
|
- log.info("首诊患者建档:\n参数:{},\n结果:{}", card, hrgResponse);
|
|
|
+ log.info("首诊患者建档结果:{}", hrgResponse);
|
|
|
if (null == hrgResponse) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
}
|
|
@@ -189,7 +190,7 @@ public class IdCardAnalyzeService {
|
|
|
"\"url\":\"\"}";
|
|
|
PushMessageParam pojo = new PushMessageParam();
|
|
|
pojo.setCardNo(temp.getIcCardNo());
|
|
|
- pojo.setMsgContext(com.alibaba.fastjson.JSONObject.parseObject(msgContent));
|
|
|
+ pojo.setMsgContext(JSONObject.parseObject(msgContent));
|
|
|
pushWxMessageService.pushMessage(pojo);
|
|
|
return ResultVoUtil.success(map);
|
|
|
}
|