|
@@ -93,6 +93,8 @@ public class SiDownloadService {
|
|
|
return downloadMedicalInsurancePriceLimitCatalogue(prm);
|
|
|
case "1319":
|
|
|
return downloadMedicalInsurancePayFirstCatalogue(prm);
|
|
|
+ case "1319_save":
|
|
|
+ return saveMedicalInsurancePayFirstCatalogue(prm);
|
|
|
case "1901":
|
|
|
return downloadDictionaryList(prm);
|
|
|
}
|
|
@@ -933,6 +935,75 @@ public class SiDownloadService {
|
|
|
return getMapResultVo(result);
|
|
|
}
|
|
|
|
|
|
+ public ResultVo<Map<String, Object>> saveMedicalInsurancePayFirstCatalogue(DwnldPrm prm) {
|
|
|
+ int pageNum = 1;
|
|
|
+ int recordPages = 0;
|
|
|
+ JSONObject input = exec.makeTradeHeader(SiFunction.DOWNLOAD_MEDICAL_INSURANCE_PAY_FIRST_CATALOGUE);
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
+ data.put("updt_time", DateUtil.formatDatetime(prm.getUpdtTime()));
|
|
|
+ data.put("page_num", pageNum);
|
|
|
+ data.put("page_size", 3000);
|
|
|
+ input.getJSONObject("input").put("data", data);
|
|
|
+ JSONObject result = exec.executeTrade(input, SiFunction.DOWNLOAD_MEDICAL_INSURANCE_PAY_FIRST_CATALOGUE);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
+ }
|
|
|
+ if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ JSONObject output = result.getJSONObject(OUTPUT);
|
|
|
+ recordPages = output.getInteger("pages");
|
|
|
+ List<SelfPayFirstCatalogue> list = JSONArray.parseArray(output.getJSONArray("data").toJSONString(), SelfPayFirstCatalogue.class);
|
|
|
+ List<SelfPayFirstCatalogue> tempList = new ArrayList<>();
|
|
|
+ log.info("下载医保目录先自付比例信息并入库:第 {} 页,共 {} 页。", pageNum, recordPages);
|
|
|
+ if (pageNum == 1) {
|
|
|
+ dnlddao.truncateSelfPayCatalogue();
|
|
|
+ }
|
|
|
+ for (SelfPayFirstCatalogue item : list) {
|
|
|
+ tempList.add(item);
|
|
|
+ if (tempList.size() == 100) {
|
|
|
+ dnlddao.insertSelfPayCatalogue(tempList);
|
|
|
+ tempList.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (tempList.size() > 0) {
|
|
|
+ dnlddao.insertSelfPayCatalogue(tempList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ while (pageNum < recordPages) {
|
|
|
+ pageNum += 1;
|
|
|
+ data.replace("page_num", pageNum);
|
|
|
+ input.getJSONObject("input").replace("data", data);
|
|
|
+ result = exec.executeTrade(input, SiFunction.DOWNLOAD_MEDICAL_INSURANCE_PAY_FIRST_CATALOGUE);
|
|
|
+ if (null == result) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (null == result.getInteger(RESULT_CODE)) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
|
|
|
+ }
|
|
|
+ if (result.getIntValue(RESULT_CODE) == 0) {
|
|
|
+ JSONObject output = result.getJSONObject(OUTPUT);
|
|
|
+ List<SelfPayFirstCatalogue> list = JSONArray.parseArray(output.getJSONArray("data").toJSONString(), SelfPayFirstCatalogue.class);
|
|
|
+ List<SelfPayFirstCatalogue> tempList = new ArrayList<>();
|
|
|
+ log.info("下载医保目录先自付比例信息并入库:第 {} 页,共 {} 页。", pageNum, recordPages);
|
|
|
+ for (SelfPayFirstCatalogue item : list) {
|
|
|
+ tempList.add(item);
|
|
|
+ if (tempList.size() == 100) {
|
|
|
+ dnlddao.insertSelfPayCatalogue(tempList);
|
|
|
+ tempList.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (tempList.size() > 0) {
|
|
|
+ dnlddao.insertSelfPayCatalogue(tempList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ prm.setPageNum(1);
|
|
|
+ prm.setPageSize(30);
|
|
|
+ return downloadMedicalInsurancePayFirstCatalogue(prm);
|
|
|
+ }
|
|
|
+
|
|
|
public ResultVo<Map<String, Object>> downloadDictionaryList(DwnldPrm prm) {
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.DOWNLOAD_DICTIONARY_LIST);
|
|
|
DldDictList data = new DldDictList();
|