|
@@ -386,47 +386,12 @@ public class SetlListUpldService {
|
|
|
if (ledgerSn == 0) {
|
|
|
return outpatInformation(patNo, times, ledgerSn);
|
|
|
}
|
|
|
- String medType = dao.getMedicalCategory(patNo, times, ledgerSn);
|
|
|
- boolean isFertilitySign = false;
|
|
|
- if (StringUtil.notBlank(medType)) {
|
|
|
- String[] giveBirth = new String[]{"2106", "2017", "52", "51"};
|
|
|
- if (Arrays.asList(giveBirth).contains(medType)) {
|
|
|
- isFertilitySign = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Integer flag = getModifyFlag(patNo, times);
|
|
|
-
|
|
|
- SetlinfoUpld setlinfoUpld = dao.setlinfo1(patNo, times, ledgerSn);
|
|
|
- dealSetlinfoUpld(patNo, times, setlinfoUpld);
|
|
|
- EntityCopy.Copy(dao.setlinfo2(patNo, times), setlinfoUpld);
|
|
|
- if(StringUtil.isBlank(setlinfoUpld.getRespNursCode())){
|
|
|
- setRespNurs(setlinfoUpld,patNo,times);
|
|
|
- }
|
|
|
- EntityCopy.Copy(dao.setlinfo3(String.format("inpatient_no ='%s'", patNo)), setlinfoUpld);
|
|
|
- EntityCopy.Copy(dao.setlinfo4(patNo, times), setlinfoUpld);
|
|
|
- EntityCopy.Copy(dao.setlinfo5(patNo, times, ledgerSn), setlinfoUpld);
|
|
|
-
|
|
|
- if (patNo.startsWith("JT")) {
|
|
|
- EntityCopy.Copy(dao.singleDiseasePatientInformation(patNo, times), setlinfoUpld);
|
|
|
- }
|
|
|
|
|
|
+ SetlinfoUpld setlinfoUpld = getSetlinfoUpldInfo(patNo, times, ledgerSn);
|
|
|
if (StringUtil.isBlank(setlinfoUpld.getSetlId())) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "结算id为空");
|
|
|
}
|
|
|
- // 特级护理
|
|
|
- setlinfoUpld.setSpgaNurscareDays(nursingDays(dao.teJiHuLi(publicServer.getInpatientNo(patNo), times, ledgerSn, PublicServer.getInfantFlag(patNo))));
|
|
|
- // 一级护理
|
|
|
- setlinfoUpld.setLv1NurscareDays(nursingDays(dao.yiJiHuLi(publicServer.getInpatientNo(patNo), times, ledgerSn, PublicServer.getInfantFlag(patNo))));
|
|
|
- // 二级护理
|
|
|
- setlinfoUpld.setScdNurscareDays(nursingDays(dao.erJiHuLi(publicServer.getInpatientNo(patNo), times, ledgerSn, PublicServer.getInfantFlag(patNo))));
|
|
|
- // 三级护理
|
|
|
- setlinfoUpld.setLv3NurscareDays(nursingDays(dao.sanJiHuLi(publicServer.getInpatientNo(patNo), times, ledgerSn, PublicServer.getInfantFlag(patNo))));
|
|
|
- GetDropdownBox getDropdownBox = dao.userInfo(TokenUtil.getTokenUserId());
|
|
|
- // 医疗机构填报人
|
|
|
- setlinfoUpld.setMedinsFillPsn(getDropdownBox.getName());
|
|
|
- // 医疗机构填报部门
|
|
|
- setlinfoUpld.setMedinsFillDept(getDropdownBox.getDeptName());
|
|
|
+ Integer flag = getModifyFlag(patNo, times);
|
|
|
// 手术
|
|
|
List<OprninfoUpld> oprninfoUpld = dao.oprninfoUplds(patNo, times, flag == 1 ? "batj_ba4_modify" : "batj_ba4");
|
|
|
|
|
@@ -440,15 +405,15 @@ public class SetlListUpldService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // 离院方式 我们是从 0 开始的所以要加 1
|
|
|
- setlinfoUpld.setDscgWay(DecimalUtil.add1(setlinfoUpld.getDscgWay(), "1"));
|
|
|
- // 治疗类别 我们是从 0 开始的所以要加 1
|
|
|
- setlinfoUpld.setTrtType(DecimalUtil.add1(setlinfoUpld.getTrtType(), "10"));
|
|
|
- // 长沙总控的都传这个
|
|
|
- setlinfoUpld.setHsorg("长沙市医疗保障事务中心");
|
|
|
- setlinfoUpld.setHsorgOpter("长沙市医疗保障事务中心");
|
|
|
- // 因为我们是三级医院 所以就是三
|
|
|
- setlinfoUpld.setHiSetlLv("3");
|
|
|
+ // 诊断
|
|
|
+ List<DiseinfoUpld> diseinfos = dao.diseinfo(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb");
|
|
|
+ if (ListUtil.notBlank(diseinfos)) {
|
|
|
+ setlinfoUpld.setDiagCodeCnt(String.valueOf(diseinfos.size()));
|
|
|
+
|
|
|
+ for (int i = 0; i < diseinfos.size(); i++) {
|
|
|
+ diseinfos.get(i).setMaindiagFlag(i == 0 ? "1" : "0");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
String setlId = setlinfoUpld.getSetlId();
|
|
|
List<IteminfoUpld> amtAndOthAmt = dao.totalCost(setlId);
|
|
@@ -458,11 +423,7 @@ public class SetlListUpldService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, chrgitems.getMessage());
|
|
|
}
|
|
|
}
|
|
|
- // 票据代码
|
|
|
- String billNo = dao.billNo(patNo, times, ledgerSn);
|
|
|
- setlinfoUpld.setBillNo(StringUtil.isBlank(billNo)?RandomUtil.randomNumbers(8):billNo);
|
|
|
- setlinfoUpld.setBillCode("143001913350");
|
|
|
- setlinfoUpld.setBizSn(SnowFlakeId.instance().nextId());
|
|
|
+
|
|
|
// 甲类费用
|
|
|
Map<String, IteminfoUpld> jiaLeiFeiYong = dao.aAndBFees(setlId, "01", "claaSumfee").stream().collect(Collectors.toMap(IteminfoUpld::getMedChrgitm, a -> a, (k1, k2) -> k1));
|
|
|
// 乙类费用
|
|
@@ -489,7 +450,7 @@ public class SetlListUpldService {
|
|
|
} else {
|
|
|
item.setOthAmt(a);
|
|
|
}
|
|
|
- if (isFertilitySign) {
|
|
|
+ if (isFertilitySign(patNo, times, ledgerSn)) {
|
|
|
item.setFulamtOwnpayAmt(DecimalUtil.add(item.getFulamtOwnpayAmt(), item.getOthAmt()));
|
|
|
item.setOthAmt("0.00");
|
|
|
}
|
|
@@ -498,55 +459,10 @@ public class SetlListUpldService {
|
|
|
// 重症监护时间
|
|
|
List<IcuinfoUpld> zhongZhenJianHu = getIcuinfoUplds(patNo, times);
|
|
|
List<PayinfoUpld> payinfo = dao.payinfoUpld(patNo, times, ledgerSn);
|
|
|
- // 诊断
|
|
|
- List<DiseinfoUpld> diseinfos = dao.diseinfo(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb");
|
|
|
- if (ListUtil.notBlank(diseinfos)) {
|
|
|
- setlinfoUpld.setDiagCodeCnt(String.valueOf(diseinfos.size()));
|
|
|
|
|
|
- for (int i = 0; i < diseinfos.size(); i++) {
|
|
|
- diseinfos.get(i).setMaindiagFlag(i == 0 ? "1" : "0");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 新生儿入院类型写死为1
|
|
|
- if (StringUtil.notBlank(setlinfoUpld.getNwbBirWt())) {
|
|
|
- setlinfoUpld.setNwbAdmType("1");
|
|
|
- }
|
|
|
- setlinfoUpld.setHiPaymtd(CommonUtil.calcHiPaymtd(setlinfoUpld.getInsuplc(),medType,setlinfoUpld.getHiType(),setlinfoUpld.getSetlEndDate()).toString());
|
|
|
- // 如果是 职工基本医疗保险的话 没有单位名称和地址 那么就 写死成 普通职工 和 现住址
|
|
|
- if ("310".equals(setlinfoUpld.getHiType())) {
|
|
|
- if (StringUtil.isBlank(setlinfoUpld.getEmpAddr())) {
|
|
|
- setlinfoUpld.setEmpAddr(setlinfoUpld.getCurrAddr());
|
|
|
- }
|
|
|
- if (StringUtil.isBlank(setlinfoUpld.getEmpName())) {
|
|
|
- setlinfoUpld.setEmpName("普通职工");
|
|
|
- }
|
|
|
- if (StringUtil.isBlank(setlinfoUpld.getEmpTel())) {
|
|
|
- setlinfoUpld.setEmpTel(setlinfoUpld.getConerTel());
|
|
|
- }
|
|
|
- if(StringUtil.isBlank(setlinfoUpld.getPoscode())){
|
|
|
- setlinfoUpld.setPoscode("410000");
|
|
|
- }
|
|
|
- }
|
|
|
- //性别
|
|
|
- try {
|
|
|
- setlinfoUpld.setGend(IdcardUtil.getGenderByIdCard(setlinfoUpld.getCertno()) == 1 ? "1" : "2");
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
- //再31天再住院目的
|
|
|
- if("-".equals(setlinfoUpld.getDaysRinpPup31())){
|
|
|
- setlinfoUpld.setDaysRinpPup31("");
|
|
|
- setlinfoUpld.setDaysRinpFlag31("1");
|
|
|
- }
|
|
|
- // 呼吸机使用时长
|
|
|
- Integer ventUsedDura = dao.ventilatorUseTime(patNo, times);
|
|
|
- if (ventUsedDura != null) {
|
|
|
- setlinfoUpld.setVentUsedDura(secondsToTime(ventUsedDura));
|
|
|
- }
|
|
|
|
|
|
UpldCollection upldCollection = new UpldCollection();
|
|
|
// 患者的基本信息
|
|
@@ -571,31 +487,22 @@ public class SetlListUpldService {
|
|
|
bldinfo.setBldCat(item.getBldCat()).setBldAmt(item.getBldAmt().toString()).setBldUnt(item.getBldUnit());
|
|
|
upldCollection.getBldinfo().add(bldinfo);
|
|
|
});
|
|
|
- // 医疗类别为 生育
|
|
|
- List<String> birth = Arrays.asList("51", "52", "2106", "2107");
|
|
|
|
|
|
- if (birth.contains(medType)) {
|
|
|
- // 生育类别不需要下面的这些
|
|
|
- upldCollection.getSetlinfo().setNwbAge(null);
|
|
|
- upldCollection.getSetlinfo().setNwbAdmType(null);
|
|
|
- }
|
|
|
- List<String> urbanAndRuralMedicalInsurance = Arrays.asList("390", "392");
|
|
|
- // 城乡医保类型可不填这两项
|
|
|
- if (urbanAndRuralMedicalInsurance.contains(setlinfoUpld.getHiType())) {
|
|
|
- setlinfoUpld.setEmpTel(null);
|
|
|
- setlinfoUpld.setPoscode(null);
|
|
|
- }
|
|
|
- // 颅脑损伤患者昏迷时间 没有就不填写
|
|
|
- if ("0/0/0".equals(setlinfoUpld.getPwcryAfadmComaDura())) {
|
|
|
- setlinfoUpld.setPwcryAfadmComaDura(null);
|
|
|
- }
|
|
|
- if ("0/0/0".equals(setlinfoUpld.getPwcryBfadmComaDura())) {
|
|
|
- setlinfoUpld.setPwcryBfadmComaDura(null);
|
|
|
- }
|
|
|
- setlinfoUpld.setSpPsnType(null);
|
|
|
return ResultVoUtil.success(upldCollection);
|
|
|
}
|
|
|
|
|
|
+ public boolean isFertilitySign(String patNo,Integer times,Integer ledgerSn) {
|
|
|
+ boolean isFertilitySign = false;
|
|
|
+ String medType = dao.getMedicalCategory(patNo, times, ledgerSn);
|
|
|
+ if (StringUtil.notBlank(medType)) {
|
|
|
+ String[] giveBirth = new String[]{"2106", "2017", "52", "51"};
|
|
|
+ if (Arrays.asList(giveBirth).contains(medType)) {
|
|
|
+ isFertilitySign = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return isFertilitySign;
|
|
|
+ }
|
|
|
+
|
|
|
public void dealSetlinfoUpld(String patNo, Integer times, SetlinfoUpld setlinfoUpld) {
|
|
|
// 患者基本信息 先判断签收表是否有数据
|
|
|
//Integer existCaseFrontsheetMain = dao.existCaseFrontsheetMain(patNo, times);
|
|
@@ -2361,15 +2268,16 @@ public class SetlListUpldService {
|
|
|
|
|
|
|
|
|
private SetlinfoUpld getSetlinfoUpldInfo(String patNo, Integer times, Integer ledgerSn) throws Exception {
|
|
|
- // 患者基本信息
|
|
|
SetlinfoUpld setlinfoUpld = dao.setlinfo1(patNo, times, ledgerSn);
|
|
|
- dealSetlinfoUpld(patNo,times,setlinfoUpld);
|
|
|
+ dealSetlinfoUpld(patNo, times, setlinfoUpld);
|
|
|
EntityCopy.Copy(dao.setlinfo2(patNo, times), setlinfoUpld);
|
|
|
+ if(StringUtil.isBlank(setlinfoUpld.getRespNursCode())){
|
|
|
+ setRespNurs(setlinfoUpld,patNo,times);
|
|
|
+ }
|
|
|
EntityCopy.Copy(dao.setlinfo3(String.format("inpatient_no ='%s'", patNo)), setlinfoUpld);
|
|
|
EntityCopy.Copy(dao.setlinfo4(patNo, times), setlinfoUpld);
|
|
|
EntityCopy.Copy(dao.setlinfo5(patNo, times, ledgerSn), setlinfoUpld);
|
|
|
|
|
|
-
|
|
|
if (patNo.startsWith("JT")) {
|
|
|
EntityCopy.Copy(dao.singleDiseasePatientInformation(patNo, times), setlinfoUpld);
|
|
|
}
|
|
@@ -2388,8 +2296,6 @@ public class SetlListUpldService {
|
|
|
setlinfoUpld.setMedinsFillPsn(getDropdownBox.getName());
|
|
|
// 医疗机构填报部门
|
|
|
setlinfoUpld.setMedinsFillDept(getDropdownBox.getDeptName());
|
|
|
-
|
|
|
-
|
|
|
// 离院方式 我们是从 0 开始的所以要加 1
|
|
|
setlinfoUpld.setDscgWay(DecimalUtil.add1(setlinfoUpld.getDscgWay(), "1"));
|
|
|
// 治疗类别 我们是从 0 开始的所以要加 1
|
|
@@ -2399,7 +2305,6 @@ public class SetlListUpldService {
|
|
|
setlinfoUpld.setHsorgOpter("长沙市医疗保障事务中心");
|
|
|
// 因为我们是三级医院 所以就是三
|
|
|
setlinfoUpld.setHiSetlLv("3");
|
|
|
-
|
|
|
// 票据代码
|
|
|
String billNo = dao.billNo(patNo, times, ledgerSn);
|
|
|
setlinfoUpld.setBillNo(StringUtil.isBlank(billNo)?RandomUtil.randomNumbers(8):billNo);
|
|
@@ -2411,13 +2316,6 @@ public class SetlListUpldService {
|
|
|
setlinfoUpld.setNwbAdmType("1");
|
|
|
}
|
|
|
String medType = dao.getMedicalCategory(patNo, times, ledgerSn);
|
|
|
- boolean isFertilitySign = false;
|
|
|
- if (StringUtil.notBlank(medType)) {
|
|
|
- String[] giveBirth = new String[]{"2106", "2017", "52", "51"};
|
|
|
- if (Arrays.asList(giveBirth).contains(medType)) {
|
|
|
- isFertilitySign = true;
|
|
|
- }
|
|
|
- }
|
|
|
setlinfoUpld.setHiPaymtd(CommonUtil.calcHiPaymtd(setlinfoUpld.getInsuplc(),medType,setlinfoUpld.getHiType(),setlinfoUpld.getSetlEndDate()).toString());
|
|
|
// 如果是 职工基本医疗保险的话 没有单位名称和地址 那么就 写死成 普通职工 和 现住址
|
|
|
if ("310".equals(setlinfoUpld.getHiType())) {
|
|
@@ -2430,13 +2328,42 @@ public class SetlListUpldService {
|
|
|
if (StringUtil.isBlank(setlinfoUpld.getEmpTel())) {
|
|
|
setlinfoUpld.setEmpTel(setlinfoUpld.getConerTel());
|
|
|
}
|
|
|
+ if(StringUtil.isBlank(setlinfoUpld.getPoscode())){
|
|
|
+ setlinfoUpld.setPoscode("410000");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //性别
|
|
|
+ try {
|
|
|
+ setlinfoUpld.setGend(IdcardUtil.getGenderByIdCard(setlinfoUpld.getCertno()) == 1 ? "1" : "2");
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //再31天再住院目的
|
|
|
+ if("-".equals(setlinfoUpld.getDaysRinpPup31())){
|
|
|
+ setlinfoUpld.setDaysRinpPup31("");
|
|
|
+ setlinfoUpld.setDaysRinpFlag31("1");
|
|
|
+ }
|
|
|
// 呼吸机使用时长
|
|
|
Integer ventUsedDura = dao.ventilatorUseTime(patNo, times);
|
|
|
if (ventUsedDura != null) {
|
|
|
setlinfoUpld.setVentUsedDura(secondsToTime(ventUsedDura));
|
|
|
}
|
|
|
+
|
|
|
+ // 医疗类别为 生育
|
|
|
+ boolean isFertilitySign = isFertilitySign(patNo,times,ledgerSn);
|
|
|
+ if (isFertilitySign) {
|
|
|
+ // 生育类别不需要下面的这些
|
|
|
+ setlinfoUpld.setNwbAge(null);
|
|
|
+ setlinfoUpld.setNwbAdmType(null);
|
|
|
+ }
|
|
|
+ List<String> urbanAndRuralMedicalInsurance = Arrays.asList("390", "392");
|
|
|
+ // 城乡医保类型可不填这两项
|
|
|
+ if (urbanAndRuralMedicalInsurance.contains(setlinfoUpld.getHiType())) {
|
|
|
+ setlinfoUpld.setEmpTel(null);
|
|
|
+ setlinfoUpld.setPoscode(null);
|
|
|
+ }
|
|
|
// 颅脑损伤患者昏迷时间 没有就不填写
|
|
|
if ("0/0/0".equals(setlinfoUpld.getPwcryAfadmComaDura())) {
|
|
|
setlinfoUpld.setPwcryAfadmComaDura(null);
|
|
@@ -2444,6 +2371,7 @@ public class SetlListUpldService {
|
|
|
if ("0/0/0".equals(setlinfoUpld.getPwcryBfadmComaDura())) {
|
|
|
setlinfoUpld.setPwcryBfadmComaDura(null);
|
|
|
}
|
|
|
+ setlinfoUpld.setSpPsnType(null);
|
|
|
return setlinfoUpld;
|
|
|
}
|
|
|
|