|
@@ -82,10 +82,10 @@ public class AppointmentService {
|
|
|
getAllDepartments();
|
|
|
}
|
|
|
|
|
|
- public ResultVo<List<MzClassPojo>> refreshMzClasses() {
|
|
|
+ public ResultVo<String> refreshMzClasses() {
|
|
|
log.info("门诊科室缓存已重置。");
|
|
|
mzClasses = null;
|
|
|
- return getAllDepartments();
|
|
|
+ return ResultVoUtil.success("门诊科室缓存已重置。");
|
|
|
}
|
|
|
|
|
|
public ResultVo<Integer[]> getSourcesByDate(GetSourcesByDateParam param) {
|
|
@@ -112,16 +112,27 @@ public class AppointmentService {
|
|
|
public ResultVo<Object> getDoctorSources(GetDoctorSourcesParam param) {
|
|
|
String url = String.format(ThmzUrls.GET_DOCTOR_BY_DATE_AND_DEPT +
|
|
|
"requestDay=%s&unitCode=%s", param.getDate(), param.getDeptCode());
|
|
|
- return getFromHrgWhereErrorIsSlightly(url);
|
|
|
+ RestTemplate template = new RestTemplate();
|
|
|
+ SourcesRes data = template.getForObject(url, SourcesRes.class);
|
|
|
+ if (null == data || null == data.getResultCode()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (data.getResultCode() == -1) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, data.getResultMessage());
|
|
|
+ }
|
|
|
+ data.getData().removeIf(map -> (int) map.get("leftNum") == 0);
|
|
|
+ if (data.getData().size() == 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR);
|
|
|
+ }
|
|
|
+ for (Map<String, Object> map : data.getData()) {
|
|
|
+ map.put("specialty", dao.selectSpecialty(map.get("doctorCode").toString()));
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(data.getData());
|
|
|
}
|
|
|
|
|
|
public ResultVo<Object> getDoctorArrangement(GetDoctorSourcesParam param) {
|
|
|
String url = String.format(ThmzUrls.GET_REQUEST_BY_DATE_AND_DEPT_AND_DOCTOR +
|
|
|
"requestDay=%s&unitCode=%s&doctorCode=%s", param.getDate(), param.getDeptCode(), param.getDoctorCode());
|
|
|
- return getFromHrgWhereErrorIsSlightly(url);
|
|
|
- }
|
|
|
-
|
|
|
- private ResultVo<Object> getFromHrgWhereErrorIsSlightly(String url) {
|
|
|
RestTemplate template = new RestTemplate();
|
|
|
SourcesRes data = template.getForObject(url, SourcesRes.class);
|
|
|
if (null == data || null == data.getResultCode()) {
|
|
@@ -130,6 +141,10 @@ public class AppointmentService {
|
|
|
if (data.getResultCode() == -1) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, data.getResultMessage());
|
|
|
}
|
|
|
+ data.getData().removeIf(map -> (int) map.get("leftNum") == 0);
|
|
|
+ if (data.getData().size() == 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR);
|
|
|
+ }
|
|
|
return ResultVoUtil.success(data.getData());
|
|
|
}
|
|
|
|