|
@@ -2,6 +2,7 @@ package thyyxxk.webserver.controller.yibao;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -18,6 +19,8 @@ import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
import thyyxxk.webserver.utils.TokenUtil;
|
|
|
import thyyxxk.webserver.utils.YbLinksUtil;
|
|
|
|
|
|
+import java.net.InetAddress;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static thyyxxk.webserver.utils.YibaoHttpUtil.equalizeUpload;
|
|
@@ -72,7 +75,7 @@ public class YiBaoController {
|
|
|
@PostMapping("/proofread")
|
|
|
public ResultVo<Object> downloadFeeDetail(@RequestBody ProofreadParam param) {
|
|
|
param.setStaffId(TokenUtil.getTokenUserId());
|
|
|
- return httpPost(YbLinksUtil.normalLinks.get("proofread"), param,"03");
|
|
|
+ return httpPost(YbLinksUtil.normalLinks.get("proofread"), param, "03");
|
|
|
}
|
|
|
|
|
|
@PostMapping("/multipleUpload")
|
|
@@ -135,4 +138,67 @@ public class YiBaoController {
|
|
|
param.setStaffId(TokenUtil.getTokenUserId());
|
|
|
return httpPost("cancelCalculate", param, param.getResponceType());
|
|
|
}
|
|
|
+
|
|
|
+ @Scheduled(cron = "00 00 02 ? * *")
|
|
|
+ public void autoUpload() {
|
|
|
+ if (isDjPc()) {
|
|
|
+ List<Overview> overviews = routines.getAutoUploadOverview();
|
|
|
+ List<Overview> hnsybOverviews = new ArrayList<>();
|
|
|
+ List<Overview> cssybOverviews = new ArrayList<>();
|
|
|
+ List<Overview> xnhybOverviews = new ArrayList<>();
|
|
|
+ overviews.forEach(item -> {
|
|
|
+ routines.hisRecount(item.getInpatientNo(), item.getAdmissTimes(), item.getLedgerSn());
|
|
|
+ settleService.posNegOffset(item);
|
|
|
+ if (item.getResponceType().equals(ResponceType.NEW_RURAL_COOPERATIVE_MEDICAL_INSURANCE)) {
|
|
|
+ xnhybOverviews.add(item);
|
|
|
+ } else if (ResponceType.isChangShaCityMedicalInsurance(item.getResponceType())) {
|
|
|
+ cssybOverviews.add(item);
|
|
|
+ } else {
|
|
|
+ hnsybOverviews.add(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ StartAutoUpload hnsyb = new StartAutoUpload(ResponceType.HUNAN_PROVINCIAL_MEDICAL_INSURANCE, hnsybOverviews);
|
|
|
+ StartAutoUpload cssyb = new StartAutoUpload(ResponceType.CHANGSHA_CITY_RESIDENTS_MEDICAL_INSURANCE, cssybOverviews);
|
|
|
+ StartAutoUpload xnhyb = new StartAutoUpload(ResponceType.NEW_RURAL_COOPERATIVE_MEDICAL_INSURANCE, xnhybOverviews);
|
|
|
+ hnsyb.start();
|
|
|
+ cssyb.start();
|
|
|
+ xnhyb.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean isDjPc() {
|
|
|
+ try {
|
|
|
+ InetAddress addr;
|
|
|
+ addr = InetAddress.getLocalHost();
|
|
|
+ String hostname = addr.getHostName();
|
|
|
+ return "THYYXXK-DJ".equals(hostname);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static class StartAutoUpload extends Thread {
|
|
|
+ private final String responce;
|
|
|
+ private final List<Overview> overviews;
|
|
|
+
|
|
|
+ public StartAutoUpload(String responce, List<Overview> overviews) {
|
|
|
+ this.responce = responce;
|
|
|
+ this.overviews = overviews;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if (responce.equals(ResponceType.NEW_RURAL_COOPERATIVE_MEDICAL_INSURANCE)) {
|
|
|
+ httpPost("multipleUploadFee", overviews, responce);
|
|
|
+ log.info("新农合自动上传完毕,共{}位患者。", overviews.size());
|
|
|
+ } else if (ResponceType.isChangShaCityMedicalInsurance(responce)) {
|
|
|
+ equalizeUpload("cssyb", "multiple", overviews, null, responce);
|
|
|
+ log.info("市医保自动上传完毕,共{}位患者。", overviews.size());
|
|
|
+ } else {
|
|
|
+ equalizeUpload("hnsyb", "multiple", overviews, null, responce);
|
|
|
+ log.info("省医保自动上传完毕,共{}位患者。", overviews.size());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|