|
@@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
+import thyyxxk.webserver.constants.YbTjConstant;
|
|
|
+import thyyxxk.webserver.constants.sidicts.TreatmentMethods;
|
|
|
import thyyxxk.webserver.dao.his.casefrontsheet.CaseFrontSheetDao;
|
|
|
import thyyxxk.webserver.dao.his.ybkf.YbCssTjDao;
|
|
|
import thyyxxk.webserver.entity.HeadInfo;
|
|
@@ -18,6 +20,7 @@ import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.casefrontsheet.DisefamilyGrade;
|
|
|
import thyyxxk.webserver.entity.casefrontsheet.OprnDisefamilyGrade;
|
|
|
import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
|
|
|
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.BatjBa4;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.inpatient.YbZyDisDiag;
|
|
|
import thyyxxk.webserver.entity.ybkf.DeptChargeGroup;
|
|
|
import thyyxxk.webserver.entity.ybkf.YbCssImp;
|
|
@@ -41,6 +44,7 @@ import java.math.BigDecimal;
|
|
|
import java.text.MessageFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -431,6 +435,8 @@ public class YbCssTjService {
|
|
|
BigDecimal sumScore = BigDecimal.ZERO;
|
|
|
// 实际总分值
|
|
|
BigDecimal realScore = DecimalUtil.minus(imp.getScore(), imp.getDeductScore() == null ? BigDecimal.ZERO : imp.getDeductScore());
|
|
|
+ // 没有匹配到出院科室
|
|
|
+ boolean notify_flag = true;
|
|
|
|
|
|
for(int i = deptChargeList.size() - 1; i >= 0; i-- ){
|
|
|
YbCssSetlDeptInfo deptInfo = new YbCssSetlDeptInfo();
|
|
@@ -469,13 +475,30 @@ public class YbCssTjService {
|
|
|
deptInfo.setDeptName(ks.getDeptName());
|
|
|
deptInfo.setDoctorId(ks.getDoctorId());
|
|
|
deptInfo.setDoctor(ks.getDoctor());
|
|
|
+
|
|
|
if(ybSetlInfo.getDeptId().equals(ks.getDeptId())){
|
|
|
deptInfo.setShortNo("1");
|
|
|
+ notify_flag = false;
|
|
|
} else {
|
|
|
deptInfo.setShortNo("0");
|
|
|
}
|
|
|
list.add(deptInfo);
|
|
|
}
|
|
|
+
|
|
|
+ // 科室不匹配
|
|
|
+ if(notify_flag){
|
|
|
+ // 取科室费用最多的科室为算人数科室
|
|
|
+ // 重症医学科不能作为算人数科室, 顺延至下一个科室
|
|
|
+ list.sort(Comparator.comparing(YbCssSetlDeptInfo::getMedicalTotalFee).reversed());
|
|
|
+
|
|
|
+ if(YbTjConstant.ICU_DEPT.equals(list.get(0).getDeptId())){
|
|
|
+ list.get(1).setShortNo("1");
|
|
|
+ } else {
|
|
|
+ list.get(0).setShortNo("1");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@@ -1291,4 +1314,129 @@ public class YbCssTjService {
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @description: 长沙市医保出院测算查询
|
|
|
+ * @author: hsh
|
|
|
+ * @date: 2022/9/22 17:13
|
|
|
+ * @param: [dto]
|
|
|
+ * @return: ResultVo<List<Map<String,Object>>>
|
|
|
+ **/
|
|
|
+ public ResultVo<List<Map<String, Object>>> selectCssYbCsTj(YbkfShareDto dto){
|
|
|
+ String beginTime = dto.getStartTime();
|
|
|
+ String endTime = dto.getEndTime();
|
|
|
+ String dept = dto.getDept();
|
|
|
+ String insurName = dto.getInsurName();
|
|
|
+ String zyh = dto.getZyh();
|
|
|
+ long start_times1 = System.currentTimeMillis();
|
|
|
+ List<Map<String, Object>> result = dao.selectCssYbCsTj(beginTime, endTime, dept, insurName, zyh);
|
|
|
+ long end_times1 = System.currentTimeMillis();
|
|
|
+ System.out.println((end_times1-start_times1)/3600);
|
|
|
+
|
|
|
+ // 获取当年长沙市分值测算标准(setl_cc: 决算; test_cc: 测算)
|
|
|
+ String year = endTime.substring(0,4);
|
|
|
+ List<YbParamInfo> testParams = dao.selectYbParamInfoByYear(year, "test_cc");
|
|
|
+ List<YbParamInfo> setlParams = dao.selectYbParamInfoByYear(year, "setl_cc");
|
|
|
+
|
|
|
+ long start_times = System.currentTimeMillis();
|
|
|
+ // 补充主诊断、主手术、分值、预计支付,计算预计的盈亏额
|
|
|
+ for(Map<String, Object> map : result){
|
|
|
+ AddDaginAndBal(testParams, setlParams, map);
|
|
|
+ }
|
|
|
+ long end_times = System.currentTimeMillis();
|
|
|
+ System.out.println((end_times-start_times)/3600);
|
|
|
+ return ResultVoUtil.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 补充主诊断、主手术、分值、预计支付,计算预计的盈亏额
|
|
|
+ * @author: hsh
|
|
|
+ * @date: 2022/9/26 15:44
|
|
|
+ * @param: [paramInfoList, map]
|
|
|
+ * @return: void
|
|
|
+ **/
|
|
|
+ private void AddDaginAndBal(List<YbParamInfo> testParams, List<YbParamInfo> setlParams, Map<String, Object> map) {
|
|
|
+ // 获取标准分值
|
|
|
+ String medinsType = String.valueOf(map.get("yblx"));
|
|
|
+ if(StringUtil.isBlank(medinsType)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ BigDecimal csbz = BigDecimal.ONE;
|
|
|
+ for(YbParamInfo param : testParams){
|
|
|
+ if(medinsType.equals(param.getMedinsType())){
|
|
|
+ csbz = new BigDecimal(param.getParamValue());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal jsbz = BigDecimal.ONE;
|
|
|
+ for(YbParamInfo param : setlParams){
|
|
|
+ if(medinsType.equals(param.getMedinsType())){
|
|
|
+ jsbz = new BigDecimal(param.getParamValue());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 治疗方式与申报类型
|
|
|
+ String zlfs = map.get("zlfs") + "";
|
|
|
+ map.put("zlfs", TreatmentMethods.get(zlfs).getName());
|
|
|
+
|
|
|
+ String zyh = map.get("zyh") + "";
|
|
|
+ Integer times = Integer.parseInt(map.get("zycs") + "");
|
|
|
+
|
|
|
+ List<YbZyDisDiag> zdList = dao.selectYbDiganInfo(zyh, times, "zy_dis_diag_yb_modify");
|
|
|
+ if(zdList.size() == 0){
|
|
|
+ zdList = dao.selectYbDiganInfo(zyh, times, "zy_dis_diag_yb");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<BatjBa4> ba4List = dao.selectYbOprtInfo(zyh, times, "batj_ba4_modify");
|
|
|
+ if(ba4List.size() == 0){
|
|
|
+ ba4List = dao.selectYbOprtInfo(zyh, times, "batj_ba4");
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal tczf = new BigDecimal(map.get("tczf") + "");
|
|
|
+ // 添加主要诊断
|
|
|
+ for (YbZyDisDiag zd : zdList) {
|
|
|
+ // 选择第一诊断作为主诊断
|
|
|
+ if(zd.getDisDiagNo() == 1){
|
|
|
+ String code = zd.getDisDiag();
|
|
|
+ map.put("zdmc", zd.getDisDiagComment());
|
|
|
+ map.put("zdbm", code);
|
|
|
+ BigDecimal fz = selectDiagScore(code, zyh, times);
|
|
|
+
|
|
|
+ if(fz.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ // 无对照分值计算:统筹支付/分值标准
|
|
|
+ fz = DecimalUtil.divide(tczf, csbz, 1);
|
|
|
+ map.put("sblx", "无对照");
|
|
|
+ } else {
|
|
|
+ map.put("sblx", "有对照");
|
|
|
+ }
|
|
|
+ // 计算预计支付
|
|
|
+ BigDecimal yjzf = DecimalUtil.multiply(fz, jsbz);
|
|
|
+ map.put("yjzf", yjzf);
|
|
|
+ map.put("score", fz);
|
|
|
+ map.put("bal", DecimalUtil.minus(yjzf, tczf));
|
|
|
+
|
|
|
+ if(tczf.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ map.put("yjzf", 0);
|
|
|
+ map.put("score", 0);
|
|
|
+ map.put("bal", 0);
|
|
|
+ map.put("sblx", "非正常数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加主要操作手术
|
|
|
+ if(ba4List.size() > 0){
|
|
|
+ for (BatjBa4 ss : ba4List) {
|
|
|
+ if(ss.getSsxh() == 1){
|
|
|
+ map.put("ssbm", ss.getSsbm());
|
|
|
+ map.put("ssmc", ss.getSsmc());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|