|
@@ -2,6 +2,7 @@ package thyyxxk.webserver.service.medicalinsurance;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -10,12 +11,14 @@ import thyyxxk.webserver.constants.sidicts.SiFunction;
|
|
|
import thyyxxk.webserver.constants.YesOrNo;
|
|
|
import thyyxxk.webserver.constants.sidicts.*;
|
|
|
import thyyxxk.webserver.dao.his.medicalinsurance.SiQueryDao;
|
|
|
+import thyyxxk.webserver.dao.his.medicalinsurance.SiSetlinfoDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.dictionary.PureCodeName;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.inpatient.InHspPsnInfo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.outpatient.SpcChrDiseAcct;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.query.*;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetldetail;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setllist.*;
|
|
|
import thyyxxk.webserver.service.wxapi.SendWxInfoService;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
@@ -35,15 +38,17 @@ public class SiQueryService {
|
|
|
private final ExecService exec;
|
|
|
private final SiQueryDao dao;
|
|
|
private final SendWxInfoService wxsrvc;
|
|
|
+ private final SiSetlinfoDao setlinfoDao;
|
|
|
private static final String RESULT_CODE = "infcode";
|
|
|
private static final String ERROR_MESSAGE = "err_msg";
|
|
|
private static final String OUTPUT = "output";
|
|
|
|
|
|
@Autowired
|
|
|
- public SiQueryService(ExecService exec, SiQueryDao dao, SendWxInfoService wxsrvc) {
|
|
|
+ public SiQueryService(ExecService exec, SiQueryDao dao, SendWxInfoService wxsrvc, SiSetlinfoDao setlinfoDao) {
|
|
|
this.exec = exec;
|
|
|
this.dao = dao;
|
|
|
this.wxsrvc = wxsrvc;
|
|
|
+ this.setlinfoDao = setlinfoDao;
|
|
|
}
|
|
|
|
|
|
public ResultVo<SiPatInfo> getSiPatInfo(QryPsnBsInfo qryPsnBsInfo) {
|
|
@@ -1188,11 +1193,24 @@ public class SiQueryService {
|
|
|
String begntime = condition.getMonth() + "-01 00:00:00.000";
|
|
|
String endtime = DateUtil.getMonthEndtime(condition.getMonth());
|
|
|
List<BaseSetlStatistics> baseStatistics;
|
|
|
- if (condition.getAdmdvs() == 1) {
|
|
|
- baseStatistics = dao.selectBaseSetlStatisticsInProvince(begntime, endtime, condition.getInsutype());
|
|
|
- } else {
|
|
|
- baseStatistics = dao.selectBaseSetlStatisticsOutProvince(begntime, endtime, condition.getInsutype());
|
|
|
+
|
|
|
+ switch (condition.getAdmdvsType()) {
|
|
|
+ case 1:
|
|
|
+ baseStatistics = dao.selectBaseSetlStatisticsInProvinceLevel(begntime, endtime, condition.getInsutype());
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ baseStatistics = dao.selectBaseSetlStatisticsInChangshaCity(begntime, endtime, condition.getInsutype());
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ baseStatistics = dao.selectBaseSetlStatisticsInProvinceOtherCities(begntime, endtime, condition.getInsutype());
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ baseStatistics = dao.selectBaseSetlStatisticsOutProvince(begntime, endtime, condition.getInsutype());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ baseStatistics = dao.selectBaseSetlStatisticsInAllPlaces(begntime, endtime, condition.getInsutype());
|
|
|
}
|
|
|
+
|
|
|
if (null == baseStatistics || baseStatistics.isEmpty()) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
|
|
|
}
|
|
@@ -1209,10 +1227,9 @@ public class SiQueryService {
|
|
|
if (null == admdvsName) {
|
|
|
PureCodeName region = dao.selectAdmdvsNameAndParentName(key);
|
|
|
if (null == region) {
|
|
|
- admdvsName = dao.selectAdmdvsName(key);
|
|
|
- } else {
|
|
|
- admdvsName = region.getCode() + region.getName();
|
|
|
+ region = dao.selectAdmdvsName(key);
|
|
|
}
|
|
|
+ admdvsName = region.getCode() + region.getName();
|
|
|
regionMap.put(key, admdvsName);
|
|
|
}
|
|
|
if (tempMap.containsKey(admdvsName)) {
|
|
@@ -1229,6 +1246,7 @@ public class SiQueryService {
|
|
|
List<BaseSetlStatistics> mapStatistics = entry.getValue();
|
|
|
SetlStatisticResult resultItem = new SetlStatisticResult();
|
|
|
resultItem.setAdmdvsName(entry.getKey());
|
|
|
+ resultItem.setInsuplcAdmdvs(entry.getValue().get(0).getInsuplcAdmdvs().substring(0, 4) + "00");
|
|
|
resultItem.setPsnSumamt(mapStatistics.size());
|
|
|
String medfeeSumamt = "0";
|
|
|
String baseMedFundpaySumamt = "0";
|
|
@@ -1256,4 +1274,37 @@ public class SiQueryService {
|
|
|
}
|
|
|
return ResultVoUtil.success(resultList);
|
|
|
}
|
|
|
+
|
|
|
+ public ResultVo<List<SiSetlinfo>> selectSetldetailStatistics(SetlCondition condition) {
|
|
|
+ String begntime = condition.getMonth() + "-01 00:00:00.000";
|
|
|
+ String endtime = DateUtil.getMonthEndtime(condition.getMonth());
|
|
|
+ String insuplcAdmdvs = condition.getInsuplcAdmdvs().substring(0, 4) + "%";
|
|
|
+ QueryWrapper<SiSetlinfo> wrapper = new QueryWrapper<>();
|
|
|
+ wrapper.eq("insutype", condition.getInsutype());
|
|
|
+ wrapper.eq("setl_type", ClrType.INPATIENT.getCode());
|
|
|
+ wrapper.eq("revoked", YesOrNo.NO.getCode());
|
|
|
+ wrapper.apply("setl_time>='" + begntime + "'");
|
|
|
+ wrapper.apply("setl_time<='" + endtime + "'");
|
|
|
+ wrapper.apply("insuplc_admdvs like'" + insuplcAdmdvs + "'");
|
|
|
+ List<SiSetlinfo> list = setlinfoDao.selectList(wrapper);
|
|
|
+ Map<String, String> regionMap = new HashMap<>();
|
|
|
+ list.forEach(item -> {
|
|
|
+ String admdvsName = regionMap.get(item.getInsuplcAdmdvs());
|
|
|
+ if (null == admdvsName) {
|
|
|
+ PureCodeName region = dao.selectAdmdvsNameAndParentName(item.getInsuplcAdmdvs());
|
|
|
+ if (null == region) {
|
|
|
+ region = dao.selectAdmdvsName(item.getInsuplcAdmdvs());
|
|
|
+ if (null == region) {
|
|
|
+ region = dao.selectAdmdvsNameAndParentName(item.getInsuplcAdmdvs().substring(0, 4) + "00");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ admdvsName = region.getCode() + region.getName();
|
|
|
+ regionMap.put(item.getInsuplcAdmdvs(), admdvsName);
|
|
|
+ }
|
|
|
+ item.setInsuplcAdmdvsName(admdvsName);
|
|
|
+ FilterUtil.filterCodeToName(item);
|
|
|
+ });
|
|
|
+ return ResultVoUtil.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
}
|