|
@@ -1,6 +1,8 @@
|
|
|
package thyyxxk.webserver.service.medicalinsurance;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
@@ -56,8 +58,10 @@ import thyyxxk.webserver.entity.querydata.AutoUploadBill;
|
|
|
import thyyxxk.webserver.entity.querydata.JieSuanDanChaXun;
|
|
|
import thyyxxk.webserver.entity.querydata.SiSetlinfoTemp;
|
|
|
import thyyxxk.webserver.entity.querydata.TSetlDeptConf;
|
|
|
+import thyyxxk.webserver.entity.querydata.TUploadDrgGroup;
|
|
|
import thyyxxk.webserver.entity.vo.DrgGroupTestVO;
|
|
|
import thyyxxk.webserver.entity.vo.quality.DiseInfoListVO;
|
|
|
+import thyyxxk.webserver.entity.vo.quality.GroupInfoVO;
|
|
|
import thyyxxk.webserver.entity.vo.quality.OprtInfoListVO;
|
|
|
import thyyxxk.webserver.entity.vo.quality.QualityInfoVO;
|
|
|
import thyyxxk.webserver.entity.vo.quality.SetlBaseInfoVO;
|
|
@@ -105,13 +109,16 @@ public class SetlListUpldService {
|
|
|
private DrgWebServices drgWebServices;
|
|
|
private AutoUploadBillService autoUploadBillService;
|
|
|
private TSetlDeptConfService tSetlDeptConfService;
|
|
|
+ private final TUploadDrgGroupService tUploadDrgGroupService;
|
|
|
+ private final SiLogService siLogService;
|
|
|
|
|
|
public SetlListUpldService(ExecService exec, SiQueryDao queryDao, UpIdCollectionDao upIdCollectionDao,
|
|
|
DismissDao dismissDao, PublicServer publicServer, SendWxInfoService sendWxInfoService,
|
|
|
SiLogDao logDao, CaseFrontSheetMainService caseFrontSheetMainService,
|
|
|
RedisLikeService redisLikeService, DrgWebServices drgWebServices,
|
|
|
AutoUploadBillService autoUploadBillService,
|
|
|
- TSetlDeptConfService tSetlDeptConfService
|
|
|
+ TSetlDeptConfService tSetlDeptConfService,TUploadDrgGroupService tUploadDrgGroupService,
|
|
|
+ SiLogService siLogService
|
|
|
) {
|
|
|
this.exec = exec;
|
|
|
this.queryDao = queryDao;
|
|
@@ -125,6 +132,8 @@ public class SetlListUpldService {
|
|
|
this.drgWebServices = drgWebServices;
|
|
|
this.autoUploadBillService = autoUploadBillService;
|
|
|
this.tSetlDeptConfService = tSetlDeptConfService;
|
|
|
+ this.tUploadDrgGroupService = tUploadDrgGroupService;
|
|
|
+ this.siLogService = siLogService;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -145,6 +154,7 @@ public class SetlListUpldService {
|
|
|
param.setAdmissTimes(times);
|
|
|
sheetVerification(param);
|
|
|
ResultVo<UpldCollection> upldCollection = getUploadInfo(patNo, times, ledgerSn);
|
|
|
+ dealDrgGroup(patNo,times,ledgerSn,upldCollection.getData().getSetlinfo());
|
|
|
if(checkFlag){
|
|
|
checkUploadCondition(patNo, upldCollection,times);
|
|
|
}
|
|
@@ -187,6 +197,53 @@ public class SetlListUpldService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医保中心报错的:【%s】 ", errMsg));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void dealDrgGroup(String patNo, Integer times,Integer ledgerSn, SetlinfoUpld setlinfo) {
|
|
|
+ SiLog siLog = null;
|
|
|
+ try {
|
|
|
+ Integer flag = dao.setlModifyReqAuditFlag(patNo, times);
|
|
|
+ flag = flag == null ? 0 : flag;
|
|
|
+ List<YbZyDisDiag> ybZyDisDiags = dao.zhenDuanXinXi(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb");
|
|
|
+ List<BatjBa4> batjBa4s = dao.shouShuXinXi(patNo, times, flag == 1 ? "batj_ba4_modify" : "batj_ba4");
|
|
|
+ ZyInactpatient param = new ZyInactpatient();
|
|
|
+ param.setInpatientNo(patNo);
|
|
|
+ param.setAdmissTimes(times);
|
|
|
+ param.setNewYbZyDisDiag(ybZyDisDiags);
|
|
|
+ param.setNewBatjBa4(batjBa4s);
|
|
|
+ param.setMedfeeSumamt(dao.getsetlTotalFee(patNo,times,ledgerSn));
|
|
|
+ Map<String, Object> temp = getDrgQualityResult(param, setlinfo);
|
|
|
+ JSONObject resultInfo = (JSONObject)temp.get("result");
|
|
|
+ Object drgParam = temp.get("param");
|
|
|
+ siLog = new SiLog(SiUtil.makeMsgId(),SiFunction.DRG_GROUP_INFO.getCode(),setlinfo.getInsuplc(),redisLikeService.getUserInfoByToken().getCode(),JSON.toJSONString(drgParam),JSON.toJSONString(resultInfo),patNo,times,ledgerSn,1,setlinfo.getPsnNo());
|
|
|
+ if (resultInfo.getBooleanValue("isSuccess")) {
|
|
|
+ JSONObject groupInfo = resultInfo.getJSONObject("result").getJSONObject("group_info");
|
|
|
+ GroupInfoVO groupInfoVO = JSON.parseObject(JSON.toJSONString(groupInfo), GroupInfoVO.class);
|
|
|
+ log.info("分组结果[groupInfoVO]:{}",JSON.toJSONString(groupInfoVO));
|
|
|
+ siLog.setInfcode(0);
|
|
|
+ if(groupInfoVO != null){
|
|
|
+ Map<String, Object> groupInfoVOMap = BeanUtil.beanToMap(groupInfoVO, false, true);
|
|
|
+ TUploadDrgGroup uploadDrgGroup = new TUploadDrgGroup();
|
|
|
+ CopyOptions options = new CopyOptions();
|
|
|
+ options.setIgnoreProperties("group_messages");
|
|
|
+ BeanUtil.fillBeanWithMap(groupInfoVOMap, uploadDrgGroup, true, options);
|
|
|
+ uploadDrgGroup.setPatNo(patNo);
|
|
|
+ uploadDrgGroup.setTimes(times);
|
|
|
+ uploadDrgGroup.setLedgerSn(ledgerSn);
|
|
|
+ uploadDrgGroup.setSetlTime(setlinfo.getSetlEndDate());
|
|
|
+ uploadDrgGroup.setTotalFee(param.getMedfeeSumamt());
|
|
|
+ if(ListUtil.notBlank(groupInfoVO.getGroup_messages())){
|
|
|
+ uploadDrgGroup.setGroupMessages(CollUtil.join(groupInfoVO.getGroup_messages(),";"));
|
|
|
+ }
|
|
|
+ tUploadDrgGroupService.delAndSaveData(uploadDrgGroup);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ siLog.setInfcode(-1);
|
|
|
+ log.error("处理分组结果报错",e);
|
|
|
+ }
|
|
|
+ siLogService.delAndSave(siLog);
|
|
|
+ }
|
|
|
+
|
|
|
private void checkUploadCondition(String patNo, ResultVo<UpldCollection> upldCollection,Integer times) {
|
|
|
if (upldCollection.getCode() != 200) {
|
|
|
throw new BizException(ExceptionEnum.INTERNAL_SERVER_ERROR, upldCollection.getMessage());
|
|
@@ -1834,56 +1891,19 @@ public class SetlListUpldService {
|
|
|
**/
|
|
|
public ResultVo<List<QualityInfoVO>> drgQualityTest(ZyInactpatient param) {
|
|
|
List<QualityInfoVO> qualityInfoVOS;
|
|
|
+ SiLog siLog = null;
|
|
|
try {
|
|
|
- String visitId = param.getInpatientNo() + "_" + param.getAdmissTimes();
|
|
|
SetlinfoUpld setlinfoUpldInfo = getSetlinfoUpldInfo(param.getInpatientNo(), param.getAdmissTimes(), param.getLedgerSn());
|
|
|
AssertUtil.isnotBlank(setlinfoUpldInfo, "结算清单基本信息为空");
|
|
|
- Map<String, Object> tempMap = BeanUtil.beanToMap(setlinfoUpldInfo, true, true);
|
|
|
- SetlBaseInfoVO setlBaseInfoVO = new SetlBaseInfoVO();
|
|
|
- Map<String, Object> drgQualityParam = new HashMap<>();
|
|
|
- BeanUtil.fillBeanWithMap(tempMap, setlBaseInfoVO, true);
|
|
|
- setlBaseInfoVO.setVisit_id(visitId);
|
|
|
- setlBaseInfoVO.setFixmedins_code("H43010500370");
|
|
|
- setlBaseInfoVO.setFixmedins_name("长沙泰和医院");
|
|
|
- setlBaseInfoVO.setTotal_fee(param.getMedfeeSumamt() == null ? null : param.getMedfeeSumamt().toString());
|
|
|
- //格式化一些时间的问题
|
|
|
- formatSetlBaseInfoVO(setlBaseInfoVO, setlinfoUpldInfo);
|
|
|
-
|
|
|
- log.info("setlBaseInfoVO 基本信息传参:{}", JSON.toJSONString(setlBaseInfoVO));
|
|
|
- drgQualityParam.put("base_info", setlBaseInfoVO);
|
|
|
- //诊断
|
|
|
- //先诊断转码 国临 转医保
|
|
|
- if (ListUtil.notBlank(param.getNewYbZyDisDiag())) {
|
|
|
- List<String> disCode = param.getNewYbZyDisDiag().stream().map(YbZyDisDiag::getDisDiag).collect(Collectors.toList());
|
|
|
- List<Map<String, String>> ybDisCodes = dao.listYbDiseOrOprt(disCode, "zd_icd_code_new");
|
|
|
- List<DiseInfoListVO> diseInfoListVOS = ConvertUtil.ybZyDisDiag2DiseInfoListVO(param.getNewYbZyDisDiag(), visitId, ybDisCodes);
|
|
|
- drgQualityParam.put("dise_info_list", diseInfoListVOS);
|
|
|
- } else {
|
|
|
- drgQualityParam.put("dise_info_list", new ArrayList<>(1));
|
|
|
- }
|
|
|
- //手术
|
|
|
- if (ListUtil.notBlank(param.getNewBatjBa4())) {
|
|
|
- List<String> oprtCodes = param.getNewBatjBa4().stream().map(BatjBa4::getSsbm).collect(Collectors.toList());
|
|
|
- List<Map<String, String>> ybOprtCodes = dao.listYbDiseOrOprt(oprtCodes, "zd_icd9_cm3");
|
|
|
- List<String> mzfsCodes = param.getNewBatjBa4().stream().map(BatjBa4::getMzff).collect(Collectors.toList());
|
|
|
- List<Map<String, String>> ybMzfs = dao.listZdAnaesthesia(mzfsCodes);
|
|
|
- List<String> ssysCodes = param.getNewBatjBa4().stream().map(BatjBa4::getSsys).collect(Collectors.toList());
|
|
|
- List<String> mzysCodes = param.getNewBatjBa4().stream().map(BatjBa4::getMzys).collect(Collectors.toList());
|
|
|
- if (ListUtil.notBlank(mzysCodes)) {
|
|
|
- ssysCodes.addAll(mzysCodes);
|
|
|
- }
|
|
|
- //医生转码
|
|
|
- List<Map<String, String>> ysCodeDict = dao.listYbSsys(ssysCodes);
|
|
|
- List<OprtInfoListVO> oprtInfoListVOS = ConvertUtil.batjBa4ToOprtInfoListVO(param.getNewBatjBa4(), visitId, ybOprtCodes, ybMzfs, ysCodeDict);
|
|
|
- drgQualityParam.put("oprt_info_list", oprtInfoListVOS);
|
|
|
- } else {
|
|
|
- drgQualityParam.put("oprt_info_list", new ArrayList<>(1));
|
|
|
- }
|
|
|
- log.info("质控测算传参:{}", JSON.toJSONString(drgQualityParam));
|
|
|
- JSONObject resultInfo = drgWebServices.drgQuality(JSON.parseObject(JSON.toJSONString(drgQualityParam)));
|
|
|
+ Map<String,Object> tempResult = getDrgQualityResult(param, setlinfoUpldInfo);
|
|
|
+ JSONObject resultInfo = (JSONObject)tempResult.get("result");
|
|
|
+ Object qualityParam = tempResult.get("param");
|
|
|
log.info("质控测算返回:{}", JSON.toJSONString(resultInfo));
|
|
|
+ siLog = new SiLog(SiUtil.makeMsgId(),SiFunction.QUALITY_INFO.getCode(),setlinfoUpldInfo.getInsuplc(),redisLikeService.getUserInfoByToken().getCode(),JSON.toJSONString(qualityParam),JSON.toJSONString(resultInfo),param.getInpatientNo(),param.getAdmissTimes(),param.getLedgerSn(),1,setlinfoUpldInfo.getPsnNo());
|
|
|
if (resultInfo.getBooleanValue("isSuccess")) {
|
|
|
+ siLog.setInfcode(0);
|
|
|
JSONArray jsonArray = resultInfo.getJSONObject("result").getJSONArray("quality_info");
|
|
|
+ siLogService.delAndSave(siLog);
|
|
|
if (jsonArray.isEmpty()) {
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "没有质控问题数据");
|
|
|
}
|
|
@@ -1893,10 +1913,14 @@ public class SetlListUpldService {
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "没有质控问题数据");
|
|
|
}
|
|
|
} else {
|
|
|
+ siLog.setInfcode(-1);
|
|
|
+ siLogService.delAndSave(siLog);
|
|
|
throw new BizException(ExceptionEnum.LOGICAL_ERROR, "创智质控测算接口调用失败");
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
+ siLog.setInfcode(-1);
|
|
|
+ siLogService.delAndSave(siLog);
|
|
|
if (e instanceof BizException) {
|
|
|
throw new BizException(ExceptionEnum.LOGICAL_ERROR, e.getMessage());
|
|
|
} else {
|
|
@@ -1907,6 +1931,57 @@ public class SetlListUpldService {
|
|
|
return ResultVoUtil.success(qualityInfoVOS);
|
|
|
}
|
|
|
|
|
|
+ public Map<String,Object> getDrgQualityResult(ZyInactpatient param, SetlinfoUpld setlinfoUpldInfo) {
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ String visitId = param.getInpatientNo() + "_" + param.getAdmissTimes();
|
|
|
+ Map<String, Object> tempMap = BeanUtil.beanToMap(setlinfoUpldInfo, true, true);
|
|
|
+ SetlBaseInfoVO setlBaseInfoVO = new SetlBaseInfoVO();
|
|
|
+ Map<String, Object> drgQualityParam = new HashMap<>();
|
|
|
+ BeanUtil.fillBeanWithMap(tempMap, setlBaseInfoVO, true);
|
|
|
+ setlBaseInfoVO.setVisit_id(visitId);
|
|
|
+ setlBaseInfoVO.setFixmedins_code("H43010500370");
|
|
|
+ setlBaseInfoVO.setFixmedins_name("长沙泰和医院");
|
|
|
+ setlBaseInfoVO.setTotal_fee(param.getMedfeeSumamt() == null ? null : param.getMedfeeSumamt().toString());
|
|
|
+ //格式化一些时间的问题
|
|
|
+ formatSetlBaseInfoVO(setlBaseInfoVO, setlinfoUpldInfo);
|
|
|
+
|
|
|
+ log.info("setlBaseInfoVO 基本信息传参:{}", JSON.toJSONString(setlBaseInfoVO));
|
|
|
+ drgQualityParam.put("base_info", setlBaseInfoVO);
|
|
|
+ //诊断
|
|
|
+ //先诊断转码 国临 转医保
|
|
|
+ if (ListUtil.notBlank(param.getNewYbZyDisDiag())) {
|
|
|
+ List<String> disCode = param.getNewYbZyDisDiag().stream().map(YbZyDisDiag::getDisDiag).collect(Collectors.toList());
|
|
|
+ List<Map<String, String>> ybDisCodes = dao.listYbDiseOrOprt(disCode, "zd_icd_code_new");
|
|
|
+ List<DiseInfoListVO> diseInfoListVOS = ConvertUtil.ybZyDisDiag2DiseInfoListVO(param.getNewYbZyDisDiag(), visitId, ybDisCodes);
|
|
|
+ drgQualityParam.put("dise_info_list", diseInfoListVOS);
|
|
|
+ } else {
|
|
|
+ drgQualityParam.put("dise_info_list", new ArrayList<>(1));
|
|
|
+ }
|
|
|
+ //手术
|
|
|
+ if (ListUtil.notBlank(param.getNewBatjBa4())) {
|
|
|
+ List<String> oprtCodes = param.getNewBatjBa4().stream().map(BatjBa4::getSsbm).collect(Collectors.toList());
|
|
|
+ List<Map<String, String>> ybOprtCodes = dao.listYbDiseOrOprt(oprtCodes, "zd_icd9_cm3");
|
|
|
+ List<String> mzfsCodes = param.getNewBatjBa4().stream().map(BatjBa4::getMzff).collect(Collectors.toList());
|
|
|
+ List<Map<String, String>> ybMzfs = dao.listZdAnaesthesia(mzfsCodes);
|
|
|
+ List<String> ssysCodes = param.getNewBatjBa4().stream().map(BatjBa4::getSsys).collect(Collectors.toList());
|
|
|
+ List<String> mzysCodes = param.getNewBatjBa4().stream().map(BatjBa4::getMzys).collect(Collectors.toList());
|
|
|
+ if (ListUtil.notBlank(mzysCodes)) {
|
|
|
+ ssysCodes.addAll(mzysCodes);
|
|
|
+ }
|
|
|
+ //医生转码
|
|
|
+ List<Map<String, String>> ysCodeDict = dao.listYbSsys(ssysCodes);
|
|
|
+ List<OprtInfoListVO> oprtInfoListVOS = ConvertUtil.batjBa4ToOprtInfoListVO(param.getNewBatjBa4(), visitId, ybOprtCodes, ybMzfs, ysCodeDict);
|
|
|
+ drgQualityParam.put("oprt_info_list", oprtInfoListVOS);
|
|
|
+ } else {
|
|
|
+ drgQualityParam.put("oprt_info_list", new ArrayList<>(1));
|
|
|
+ }
|
|
|
+ log.info("质控测算传参:{}", JSON.toJSONString(drgQualityParam));
|
|
|
+ JSONObject result = drgWebServices.drgQuality(JSON.parseObject(JSON.toJSONString(drgQualityParam)));
|
|
|
+ resultMap.put("result",result);
|
|
|
+ resultMap.put("param",drgQualityParam);
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
private void formatSetlBaseInfoVO(SetlBaseInfoVO setlBaseInfoVO, SetlinfoUpld setlinfoUpldInfo) {
|
|
|
String timepatten = "yyyy-MM-dd HH:mm:ss";
|
|
|
setlBaseInfoVO.setAge(StringUtil.notBlank(setlinfoUpldInfo.getAge()) ? String.valueOf(new BigDecimal(setlinfoUpldInfo.getAge()).intValue()) : null);
|
|
@@ -1976,11 +2051,7 @@ public class SetlListUpldService {
|
|
|
isFertilitySign = true;
|
|
|
}
|
|
|
}
|
|
|
- // 如果是生育住院的那么 医保支付方式 为 1 按项目
|
|
|
- if (isFertilitySign) {
|
|
|
- setlinfoUpld.setHiPaymtd("1");
|
|
|
- }
|
|
|
- setlinfoUpld.setHiPaymtd(getDrgHaiPay(setlinfoUpld.getInsuplc(),setlinfoUpld.getHiPaymtd(),setlinfoUpld.getSetlEndDate()));
|
|
|
+ setlinfoUpld.setHiPaymtd(CommonUtil.calcHiPaymtd(setlinfoUpld.getInsuplc(),medType,setlinfoUpld.getHiType(),setlinfoUpld.getSetlEndDate()).toString());
|
|
|
// 如果是 职工基本医疗保险的话 没有单位名称和地址 那么就 写死成 普通职工 和 现住址
|
|
|
if ("310".equals(setlinfoUpld.getHiType())) {
|
|
|
if (StringUtil.isBlank(setlinfoUpld.getEmpAddr())) {
|
|
@@ -2179,4 +2250,12 @@ public class SetlListUpldService {
|
|
|
Integer day = NumberUtil.isInteger(temp) ? Integer.parseInt(temp) : 7;
|
|
|
return ResultVoUtil.success(day);
|
|
|
}
|
|
|
+
|
|
|
+ public IPage<TUploadDrgGroup> queryDrgGroupPage(TUploadDrgGroup query) {
|
|
|
+ return tUploadDrgGroupService.queryUploadDrgGroupPage(query);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void exportDrgGroupInfo(HttpServletResponse response, TUploadDrgGroup query) {
|
|
|
+ tUploadDrgGroupService.exportDrgGroupInfo(response,query);
|
|
|
+ }
|
|
|
}
|