|
@@ -2,8 +2,6 @@ package thyyxxk.wxservice_server.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.itextpdf.text.*;
|
|
|
-import com.itextpdf.text.pdf.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -12,14 +10,14 @@ import org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.wxservice_server.dao.PhysicalExamDao;
|
|
|
import thyyxxk.wxservice_server.entity.ResultVo;
|
|
|
+import thyyxxk.wxservice_server.entity.physicalcheck.IdCardInquiry;
|
|
|
+import thyyxxk.wxservice_server.entity.physicalcheck.PhysicalCheckIndexInquiry;
|
|
|
import thyyxxk.wxservice_server.utils.DateUtil;
|
|
|
import thyyxxk.wxservice_server.utils.PhysicalCheckPDFUtil;
|
|
|
import thyyxxk.wxservice_server.utils.ResultVoUtil;
|
|
|
import thyyxxk.wxservice_server.utils.StringUtil;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.io.OutputStream;
|
|
|
-import java.net.URLEncoder;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -35,19 +33,20 @@ public class PowersiPhysicalCheckService {
|
|
|
this.dao = dao;
|
|
|
}
|
|
|
|
|
|
- public ResultVo<String> getIdCard(String patientId) {
|
|
|
- String idCard = dao.selectIdCard(patientId);
|
|
|
+ public ResultVo<String> getIdCard(IdCardInquiry inquiry) {
|
|
|
+ String idCard = dao.selectIdCard(inquiry);
|
|
|
if (StringUtil.isBlank(idCard)) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "未查询到绑定的身份证号,请手动输入身份证或体检号查询。");
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "未查询到绑定的身份证号,请手动输入身份证查询。");
|
|
|
}
|
|
|
return ResultVoUtil.success(idCard);
|
|
|
}
|
|
|
|
|
|
- public ResultVo<JSONObject> getPhysicalCheckIndex(String idCard, String patientId, Integer pageNo) {
|
|
|
- if (dao.selectSocialNoAndPatIdMatch(idCard, patientId) < 1) {
|
|
|
+ public ResultVo<JSONObject> getPhysicalCheckIndex(PhysicalCheckIndexInquiry inquiry) {
|
|
|
+ if (dao.selectSocialNoAndPatIdMatch(inquiry) < 1) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "就诊人和身份证不匹配,没有查询的权限。");
|
|
|
}
|
|
|
- String url = physicalCheckUrl + "317926227bc2431399c86240375ba549?IDCARD=" + idCard + "&IDCARDTYPE=01&pageNo=" + pageNo;
|
|
|
+ String url = physicalCheckUrl + "317926227bc2431399c86240375ba549?IDCARD=" +
|
|
|
+ inquiry.getIdCard() + "&IDCARDTYPE=01&pageNo=" + inquiry.getPageNo();
|
|
|
RestTemplate template = new RestTemplate();
|
|
|
JSONObject rawdata = template.getForObject(url, JSONObject.class);
|
|
|
if (null == rawdata) {
|
|
@@ -62,7 +61,12 @@ public class PowersiPhysicalCheckService {
|
|
|
for (int i = 0; i < rows.size(); i++) {
|
|
|
JSONObject item = rows.getJSONObject(i);
|
|
|
String checkTime = item.getString("登记日期");
|
|
|
- checkTime = checkTime.substring(0, 4) + "-" + checkTime.substring(4, 6) + "-" + checkTime.substring(6);
|
|
|
+ if (null == checkTime) {
|
|
|
+ checkTime = "";
|
|
|
+ }
|
|
|
+ if (StringUtil.notBlank(checkTime) && checkTime.length() >= 8) {
|
|
|
+ checkTime = checkTime.substring(0, 4) + "-" + checkTime.substring(4, 6) + "-" + checkTime.substring(6);
|
|
|
+ }
|
|
|
item.put("checkTime", checkTime);
|
|
|
}
|
|
|
return ResultVoUtil.success(rawdata);
|