|
@@ -20,6 +20,7 @@ import thyyxxk.wxservice_server.pojo.inspections.CheckExamParam;
|
|
|
import thyyxxk.wxservice_server.pojo.inspections.ExamIndexResult;
|
|
|
import thyyxxk.wxservice_server.pojo.inspections.detail.*;
|
|
|
import thyyxxk.wxservice_server.utils.ResultVoUtil;
|
|
|
+import thyyxxk.wxservice_server.utils.StringUtil;
|
|
|
|
|
|
import javax.xml.namespace.QName;
|
|
|
import java.lang.reflect.Field;
|
|
@@ -46,10 +47,10 @@ public class InspectionsService {
|
|
|
String sendHead1 = "<message><PATIENT_TYPE>0</PATIENT_TYPE><PTNT_NO>" + param.getPatientId() + "</PTNT_NO>";
|
|
|
String sendHead2 = null;
|
|
|
String sendHead3 = null;
|
|
|
- if (null != tjNo && !tjNo.equals("")) {
|
|
|
+ if (StringUtil.notBlank(tjNo)) {
|
|
|
sendHead2 = "<message><PTNT_NO>" + tjNo + "</PTNT_NO>";
|
|
|
}
|
|
|
- if (null != inpatientNo && !inpatientNo.equals("")) {
|
|
|
+ if (StringUtil.notBlank(inpatientNo)) {
|
|
|
sendHead3 = "<message><PATIENT_TYPE>1</PATIENT_TYPE><PTNT_NO>" + inpatientNo + "</PTNT_NO>";
|
|
|
}
|
|
|
String sendEnd = "<START_TIME>" + param.getStart() + "</START_TIME><END_TIME>" + param.getEnd() + "</END_TIME></message>";
|
|
@@ -125,7 +126,7 @@ public class InspectionsService {
|
|
|
|
|
|
@Async("asyncTask")
|
|
|
public CompletableFuture<ResultVo<ExamDetailResult>> getExamDetail(String orderId) {
|
|
|
- if (orderId == null || orderId.trim().equals("") || orderId.trim().equals("undefined")) {
|
|
|
+ if (StringUtil.isBlank(orderId) || "undefined".equals(orderId.trim())) {
|
|
|
return CompletableFuture.completedFuture(ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "报告ID不能为空!"));
|
|
|
}
|
|
|
String send = "<message><ORDR_ID>" + orderId + "</ORDR_ID></message>";
|
|
@@ -176,7 +177,7 @@ public class InspectionsService {
|
|
|
}
|
|
|
Element codeEl = retEle.element("Code");
|
|
|
String code = codeEl.getStringValue();
|
|
|
- if (code.equals("1")) {
|
|
|
+ if ("1".equals(code)) {
|
|
|
List<ExamIndexResult> examList = new ArrayList<>();
|
|
|
Element resEl = retEle.element("Result");
|
|
|
List<Element> reports = resEl.elements("ReportList");
|
|
@@ -210,7 +211,7 @@ public class InspectionsService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结果集为空!");
|
|
|
}
|
|
|
String code = retEle.elementTextTrim("Code");
|
|
|
- if (code.equals("0")) {
|
|
|
+ if ("0".equals(code)) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, retEle.elementTextTrim("ErrorMsg"));
|
|
|
}
|
|
|
Element reportListEle = retEle.element("Result").element("ReportList");
|
|
@@ -236,30 +237,29 @@ public class InspectionsService {
|
|
|
});
|
|
|
bacteriaResult.setAntibioticResults(antibioticResults);
|
|
|
}
|
|
|
- if (notNull(bacteriaResult.getBAC_ID()))
|
|
|
+ if (StringUtil.notBlank(bacteriaResult.getBAC_ID())) {
|
|
|
bacteriaResults.add(bacteriaResult);
|
|
|
+ }
|
|
|
});
|
|
|
reportItem.setBacteriaResults(bacteriaResults);
|
|
|
}
|
|
|
- if (notNull(reportItem.getITM_VALUE()) || notNull(reportItem.getITM_STR_VALUE())
|
|
|
- || reportItem.getBacteriaResults().size() > 0)
|
|
|
+ if (StringUtil.notBlank(reportItem.getITM_VALUE()) || StringUtil.notBlank(reportItem.getITM_STR_VALUE())
|
|
|
+ || reportItem.getBacteriaResults().size() > 0) {
|
|
|
reportItems.add(reportItem);
|
|
|
+ }
|
|
|
});
|
|
|
detail.setReportItems(reportItems);
|
|
|
return ResultVoUtil.success(detail);
|
|
|
}
|
|
|
|
|
|
- private boolean notNull(String target) {
|
|
|
- return target != null && !target.equals("");
|
|
|
- }
|
|
|
-
|
|
|
private Object reflect(Object pojo, Element element) {
|
|
|
Field[] fields = pojo.getClass().getDeclaredFields();
|
|
|
for (Field field : fields) {
|
|
|
try {
|
|
|
String name = field.getName();
|
|
|
- if (name.equals("bacteriaResults") || name.equals("antibioticResults"))
|
|
|
+ if ("bacteriaResults".equals(name) || "antibioticResults".equals(name)) {
|
|
|
continue;
|
|
|
+ }
|
|
|
Method m = pojo.getClass().getMethod("set" + name, String.class);
|
|
|
m.invoke(pojo, element.elementTextTrim(name));
|
|
|
} catch (Exception e) {
|