Compare commits

..

2 Commits

Author SHA1 Message Date
LiJianZhao c959b4292f Merge branch 'master' of ssh://git.jizhiweb.cn:2222/clinic-v2/server 2025-05-16 14:20:17 +08:00
LiJianZhao b48570bcc2 dev 2025-05-16 14:20:08 +08:00
8 changed files with 74 additions and 55 deletions

View File

@ -188,7 +188,7 @@ public class SocialRequest {
} }
public OM2207A call2207A(IM2207A im2207A) { public OM2207A call2207A(IM2207A im2207A) {
JSONObject data = httpUtil.callBackMsgId("2207A",im2207A.buildToMap()); JSONObject data = httpUtil.callBackMsgId("2207A",im2207A.buildToMap(),10000);
OM2207A om2207A=new OM2207A(); OM2207A om2207A=new OM2207A();
om2207A.setMsgId(data.get("msgid").toString()); om2207A.setMsgId(data.get("msgid").toString());
om2207A.setSetlinfo(JSONObject.parseObject(data.get("setlinfo").toString(), OM2207A.Setlinfo.class)); om2207A.setSetlinfo(JSONObject.parseObject(data.get("setlinfo").toString(), OM2207A.Setlinfo.class));
@ -227,7 +227,7 @@ public class SocialRequest {
public void call3506(IM3506 im3506) { public void call3506(IM3506 im3506) {
httpUtil.callBackMsgId("3506", im3506.buildToMap()); httpUtil.callBackMsgId("3506", im3506.buildToMap(),10000);
} }
public void call2202(IM2202 im2202) { public void call2202(IM2202 im2202) {
@ -235,8 +235,9 @@ public class SocialRequest {
} }
public OM2208 call2208(IM2208 im2208) { public OM2208 call2208(IM2208 im2208) {
JSONObject jsonObject = httpUtil.call("2208", "data", im2208.buildToMap(), 10000); JSONObject jsonObject = httpUtil.callBackMsgId("2208", "data", im2208.buildToMap(), 10000);
OM2208 om2208=new OM2208(); OM2208 om2208=new OM2208();
om2208.setMsgId(jsonObject.get("msgid").toString());
om2208.setSetlinfo(JSONObject.parseObject(jsonObject.get("setlinfo").toString(), OM2208.Setlinfo.class)); om2208.setSetlinfo(JSONObject.parseObject(jsonObject.get("setlinfo").toString(), OM2208.Setlinfo.class));
om2208.setSetldetail(JSONArray.parseArray(jsonObject.get("setldetail").toString(), OM2208.Setldetail.class)); om2208.setSetldetail(JSONArray.parseArray(jsonObject.get("setldetail").toString(), OM2208.Setldetail.class));
return om2208; return om2208;

View File

@ -142,7 +142,7 @@ public class HttpUtil {
logger.info("上个版本号:" + pre_version_name); logger.info("上个版本号:" + pre_version_name);
JSONObject result = null; JSONObject result = null;
try { try {
result = callBackMsgId(infno, "data", input); result = callBackMsgId(infno, "data", input,10000);
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }
@ -217,19 +217,22 @@ public class HttpUtil {
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)),timeout); JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)),timeout);
return output; return output;
} }
public JSONObject callBackMsgId(String infno, Map<String, Object> input) {
Map<String, Object> parmsMap = getparms(infno, input);
String msgId =parmsMap.get("msgid").toString();
public JSONObject callBackMsgId(String infno, Map<String, Object> input,int timeout) {
Map<String, Object> parmsMap = getparms(infno, input);
return callBackMsgIdDo(parmsMap);
}
public JSONObject callBackMsgId(String infno, String tag, Map<String, Object> input,int timeout) {
Map<String, Object> parmsMap = getparms(infno,tag, input);
return callBackMsgIdDo(parmsMap);
}
public JSONObject callBackMsgIdDo(Map<String,Object> parmsMap) {
String msgId =parmsMap.get("msgid").toString();
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(parmsMap)); JSONObject output = post(config.get("social", "url"), JSON.toJSONString(parmsMap));
output.put("msgid",msgId); output.put("msgid",msgId);
return output; return output;
} }
public JSONObject callBackMsgId(String infno, String tag, Map<String, Object> input) {
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)));
return output;
}
public JSONObject callWithOutLog(String infno, String tag, Map<String, Object> input) { public JSONObject callWithOutLog(String infno, String tag, Map<String, Object> input) {
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input))); JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)));

View File

@ -126,7 +126,7 @@ public class ChargeController extends BaseController {
*/ */
@RequestMapping("/refund") @RequestMapping("/refund")
public Result<Object> refund() { public Result<Object> refund() {
String changeOrderCode = parmsUtil.getString("changeOrderCode"); String changeOrderCode = parmsUtil.getString("changeOrderCode","订单号为空");
chargeService.refund(changeOrderCode); chargeService.refund(changeOrderCode);
return success(); return success();
} }

View File

@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
* </p> * </p>
* *
* @author NiuZiYuan * @author NiuZiYuan
* @since 2025-05-12 * @since 2025-05-16
*/ */
@Getter @Getter
@Setter @Setter
@ -120,4 +120,7 @@ public class ChargeSocialPayLog implements Serializable {
@ApiModelProperty("证件号码") @ApiModelProperty("证件号码")
private String certno; private String certno;
@ApiModelProperty("医疗费总额")
private BigDecimal medfeeSumamt;
} }

View File

@ -5,6 +5,7 @@ import lombok.Setter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter @Getter
@Setter @Setter
@ -26,8 +27,8 @@ public class ReconciliationItemDto {
// 对账结果 // 对账结果
private String reconciliationResult; private String reconciliationResult;
//对账开始时间 //对账开始时间
private LocalDate beginTime; private LocalDateTime beginTime;
//对账结束时间 //对账结束时间
private LocalDate endTime; private LocalDateTime endTime;
} }

View File

@ -820,6 +820,7 @@ public class ChargeService extends BaseService {
socialPayLog.setMsgid(om2102A.getMsgId()); socialPayLog.setMsgid(om2102A.getMsgId());
socialPayLog.setChargeType(ChargeTypeEnum.CHARGE.getChargeType()); socialPayLog.setChargeType(ChargeTypeEnum.CHARGE.getChargeType());
socialPayLog.setOriginalBalc(setlinfo.getBalc().add(setlinfo.getAcct_pay())); socialPayLog.setOriginalBalc(setlinfo.getBalc().add(setlinfo.getAcct_pay()));
socialPayLog.setMedfeeSumamt(setlinfo.getMedfee_sumamt());
chargeSocialPayLogMapper.insert(socialPayLog); chargeSocialPayLogMapper.insert(socialPayLog);
} }
@ -859,6 +860,7 @@ public class ChargeService extends BaseService {
socialPayLog.setMsgid(om2208.getMsgId()); socialPayLog.setMsgid(om2208.getMsgId());
socialPayLog.setChargeType(ChargeTypeEnum.REFUND.getChargeType()); socialPayLog.setChargeType(ChargeTypeEnum.REFUND.getChargeType());
socialPayLog.setOriginalBalc(setlinfo.getBalc().add(payLog.getAcctPay())); socialPayLog.setOriginalBalc(setlinfo.getBalc().add(payLog.getAcctPay()));
socialPayLog.setMedfeeSumamt(setlinfo.getMedfee_sumamt());
chargeSocialPayLogMapper.insert(socialPayLog); chargeSocialPayLogMapper.insert(socialPayLog);
} }

View File

@ -136,6 +136,9 @@ public class PatientInfoService extends BaseService {
} }
Integer beforeIntegral = patientInfo.getIntegralBalance(); Integer beforeIntegral = patientInfo.getIntegralBalance();
Integer finalIntegral = beforeIntegral + addIntegral; Integer finalIntegral = beforeIntegral + addIntegral;
if (finalIntegral < 0){
throw new MessageException("剩余积分积分不足");
}
PatientInfo updatePatient = new PatientInfo(); PatientInfo updatePatient = new PatientInfo();
updatePatient.setId(patientId); updatePatient.setId(patientId);
updatePatient.setIntegralBalance(finalIntegral); updatePatient.setIntegralBalance(finalIntegral);

View File

@ -9,6 +9,7 @@ import com.syjiaer.clinic.server.common.api.output.OM3202;
import com.syjiaer.clinic.server.common.api.output.OM9101; import com.syjiaer.clinic.server.common.api.output.OM9101;
import com.syjiaer.clinic.server.common.api.request.SocialRequest; import com.syjiaer.clinic.server.common.api.request.SocialRequest;
import com.syjiaer.clinic.server.common.config.Config; import com.syjiaer.clinic.server.common.config.Config;
import com.syjiaer.clinic.server.common.enums.ChargeTypeEnum;
import com.syjiaer.clinic.server.common.exception.MessageException; import com.syjiaer.clinic.server.common.exception.MessageException;
import com.syjiaer.clinic.server.common.util.FileUtil; import com.syjiaer.clinic.server.common.util.FileUtil;
import com.syjiaer.clinic.server.common.util.HttpUtil; import com.syjiaer.clinic.server.common.util.HttpUtil;
@ -33,6 +34,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
@Service @Service
public class SocialReconciliationService extends BaseService { public class SocialReconciliationService extends BaseService {
@ -48,35 +50,36 @@ public class SocialReconciliationService extends BaseService {
private Config config; private Config config;
@Autowired @Autowired
private HttpUtil httpUtil; private HttpUtil httpUtil;
public List<ReconciliationItemVo> getList(LocalDateTime beginTime, LocalDateTime endTime) { public List<ReconciliationItemVo> getList(LocalDateTime beginTime, LocalDateTime endTime) {
QueryWrapper<ChargeSocialPayLog> clrQuery = new QueryWrapper<>(); QueryWrapper<ChargeSocialPayLog> clrQuery = new QueryWrapper<>();
clrQuery.select("clr_type,insutype,clr_optins,count(0) as count"); clrQuery.select("clr_type,insutype,clr_optins,count(0) as count");
clrQuery.groupBy("clr_type","insutype","clr_optins"); clrQuery.groupBy("clr_type", "insutype", "clr_optins");
clrQuery.ge("setl_time",beginTime); clrQuery.ge("setl_time", beginTime);
clrQuery.le("setl_time",endTime); clrQuery.le("setl_time", endTime);
List<Map<String,Object>> mapList = chargeSocialPayLogMapper.selectMaps(clrQuery); List<Map<String, Object>> mapList = chargeSocialPayLogMapper.selectMaps(clrQuery);
List<ReconciliationItemVo> voList = new ArrayList<>(); List<ReconciliationItemVo> voList = new ArrayList<>();
for (Map<String,Object> item : mapList){ for (Map<String, Object> item : mapList) {
if (item.get("clr_type") == null || item.get("insutype") == null){ if (item.get("clr_type") == null || item.get("insutype") == null) {
continue; continue;
} }
String clr = item.get("clr_type").toString(); String clr = item.get("clr_type").toString();
String insutype = item.get("insutype").toString(); String insutype = item.get("insutype").toString();
String clr_optins = item.get("clr_optins") == null ? "" : item.get("clr_optins").toString(); String clr_optins = item.get("clr_optins") == null ? "" : item.get("clr_optins").toString();
QueryWrapper<ChargeSocialPayLog> listQuery = new QueryWrapper<>(); QueryWrapper<ChargeSocialPayLog> listQuery = new QueryWrapper<>();
listQuery.eq("clr_type",clr); listQuery.eq("clr_type", clr);
listQuery.eq("insutype",insutype); listQuery.eq("insutype", insutype);
listQuery.eq("clr_optins",clr_optins); listQuery.eq("clr_optins", clr_optins);
listQuery.ge("setl_time",beginTime); listQuery.ge("setl_time", beginTime);
listQuery.le("setl_time",endTime); listQuery.le("setl_time", endTime);
List<ChargeSocialPayLog> logs = chargeSocialPayLogMapper.selectList(listQuery); List<ChargeSocialPayLog> logs = chargeSocialPayLogMapper.selectList(listQuery);
ReconciliationItemVo vo = new ReconciliationItemVo(); ReconciliationItemVo vo = new ReconciliationItemVo();
vo.setReconciliationType(clr); vo.setReconciliationType(clr);
vo.setInsuranceType(insutype); vo.setInsuranceType(insutype);
vo.setHandlingInstitution(clr_optins); vo.setHandlingInstitution(clr_optins);
vo.setSettlementCount(logs.size()); vo.setSettlementCount(logs.size());
for (ChargeSocialPayLog log : logs){ for (ChargeSocialPayLog log : logs) {
vo.setTotalMedicalCost(log.getPsnPartAmt().add(vo.getTotalMedicalCost())); vo.setTotalMedicalCost(log.getMedfeeSumamt().add(vo.getTotalMedicalCost()));
vo.setTotalFundPayment(log.getFundPaySumamt().add(vo.getTotalFundPayment())); vo.setTotalFundPayment(log.getFundPaySumamt().add(vo.getTotalFundPayment()));
vo.setTotalPersonalAccountPayment(log.getAcctPay().add(vo.getTotalPersonalAccountPayment())); vo.setTotalPersonalAccountPayment(log.getAcctPay().add(vo.getTotalPersonalAccountPayment()));
} }
@ -87,6 +90,7 @@ public class SocialReconciliationService extends BaseService {
/** /**
* 对总账 * 对总账
*
* @param dto * @param dto
* @return * @return
*/ */
@ -107,16 +111,17 @@ public class SocialReconciliationService extends BaseService {
} }
/** /**
* 明显对账 * 明细对账
*
* @param dto * @param dto
*/ */
public List<ReconciliationDetailVo> detailDo(ReconciliationItemDto dto) { public List<ReconciliationDetailVo> detailDo(ReconciliationItemDto dto) {
QueryWrapper<ChargeSocialPayLog> listQuery = new QueryWrapper<>(); QueryWrapper<ChargeSocialPayLog> listQuery = new QueryWrapper<>();
listQuery.eq("clr_type",dto.getReconciliationType()); listQuery.eq("clr_type", dto.getReconciliationType());
listQuery.eq("insutype",dto.getInsuranceType()); listQuery.eq("insutype", dto.getInsuranceType());
listQuery.eq("clr_optins",dto.getHandlingInstitution()); listQuery.eq("clr_optins", dto.getHandlingInstitution());
listQuery.ge("setl_time",dto.getBeginTime()); listQuery.ge("setl_time", dto.getBeginTime());
listQuery.le("setl_time",dto.getEndTime()); listQuery.le("setl_time", dto.getEndTime());
List<ChargeSocialPayLog> logs = chargeSocialPayLogMapper.selectList(listQuery); List<ChargeSocialPayLog> logs = chargeSocialPayLogMapper.selectList(listQuery);
try { try {
@ -134,23 +139,26 @@ public class SocialReconciliationService extends BaseService {
} }
//生成文件 //生成文件
FileWriter writer = new FileWriter(file); FileWriter writer = new FileWriter(file);
for (ChargeSocialPayLog log : logs){ for (ChargeSocialPayLog log : logs) {
//TODO 退费标志 String refd_setl_flag = "0";
if (ChargeTypeEnum.REFUND.getChargeType().equals(log.getChargeType())){
refd_setl_flag = "1";
}
QueryWrapper<ChargeOrder> orderQuery = new QueryWrapper<>(); QueryWrapper<ChargeOrder> orderQuery = new QueryWrapper<>();
orderQuery.eq("code",log.getChargeOrderCode()); orderQuery.eq("code", log.getChargeOrderCode());
orderQuery.last("limit 1"); orderQuery.last("limit 1");
ChargeOrder dbOrder = chargeOrderMapper.selectOne(orderQuery); ChargeOrder dbOrder = chargeOrderMapper.selectOne(orderQuery);
String line = log.getSetlId()+"\t"+log.getMdtrtId()+"\t"+ String line = log.getSetlId() + "\t" + log.getMdtrtId() + "\t" +
log.getPsnNo()+"\t"+dbOrder.getTotalPrice()+"\t"+log.getFundPaySumamt()+"\t" +log.getAcctPay()+"\t" log.getPsnNo() + "\t" + log.getMedfeeSumamt() + "\t" + log.getFundPaySumamt() + "\t" + log.getAcctPay() + "\t"
+"0"+"\n"; + refd_setl_flag+ "\n";
writer.write(line); writer.write(line);
} }
writer.flush(); writer.flush();
writer.close(); writer.close();
log.info("对账明细文件创建成功,文件路径:"+filePath); log.info("对账明细文件创建成功,文件路径:" + filePath);
//压缩文件为zip包 //压缩文件为zip包
String zipPath = filePath.substring(0,filePath.lastIndexOf("."))+".zip"; String zipPath = filePath.substring(0, filePath.lastIndexOf(".")) + ".zip";
fileUtil.zipFiles(new String[]{filePath},zipPath); fileUtil.zipFiles(new String[]{filePath}, zipPath);
//上传文件 //上传文件
OM9101 om9101 = socialRequest.call9101(zipPath); OM9101 om9101 = socialRequest.call9101(zipPath);
//请求明细对账接口 //请求明细对账接口
@ -170,16 +178,16 @@ public class SocialReconciliationService extends BaseService {
Map<String, Object> input_dw = new HashMap<>(); Map<String, Object> input_dw = new HashMap<>();
String downloadFileName = om3202.getFilename(); String downloadFileName = om3202.getFilename();
input_dw.put("file_qury_no", om3202.getFile_qury_no()); input_dw.put("file_qury_no", om3202.getFile_qury_no());
input_dw.put("fixmedins_code",config.get("social","fixmedinsCode") ); input_dw.put("fixmedins_code", config.get("social", "fixmedinsCode"));
input_dw.put("filename", om3202.getFilename()); input_dw.put("filename", om3202.getFilename());
String savePath = file.getParent(); String savePath = file.getParent();
//下载文件 //下载文件
httpUtil.callToFile("9102", "fsDownloadIn", input_dw, savePath+"\\"+downloadFileName); httpUtil.callToFile("9102", "fsDownloadIn", input_dw, savePath + "\\" + downloadFileName);
//解析文件 //解析文件
List<String> unzip = fileUtil.unzip(savePath,downloadFileName); List<String> unzip = fileUtil.unzip(savePath, downloadFileName);
List<String> readToList = fileUtil.readToList(unzip); List<String> readToList = fileUtil.readToList(unzip);
List<ReconciliationDetailVo> voList = new ArrayList<>(); List<ReconciliationDetailVo> voList = new ArrayList<>();
for (String s : readToList){ for (String s : readToList) {
ReconciliationDetailVo vo = new ReconciliationDetailVo(); ReconciliationDetailVo vo = new ReconciliationDetailVo();
List<String> sList = List.of(s.split("\t")); List<String> sList = List.of(s.split("\t"));
vo.setPsnNo(sList.get(0)); vo.setPsnNo(sList.get(0));
@ -196,19 +204,17 @@ public class SocialReconciliationService extends BaseService {
} }
return voList; return voList;
}catch (IOException io){ } catch (IOException io) {
log.error("创建文件失败"); log.error("创建文件失败");
throw new MessageException("创建文件失败"); throw new MessageException("创建文件失败");
}catch (Exception e){
log.error("未知错误",e);
throw new MessageException("未知错误");
} }
} }
/** /**
* 测试明细对账 * 测试明细对账
*
* @return * @return
*/ */
public List<ReconciliationDetailVo> testDetailDo() { public List<ReconciliationDetailVo> testDetailDo() {
@ -217,7 +223,7 @@ public class SocialReconciliationService extends BaseService {
List<String> unzip = fileUtil.unzip(path, fileName); List<String> unzip = fileUtil.unzip(path, fileName);
List<String> readToList = fileUtil.readToList(unzip); List<String> readToList = fileUtil.readToList(unzip);
List<ReconciliationDetailVo> voList = new ArrayList<>(); List<ReconciliationDetailVo> voList = new ArrayList<>();
for (String s : readToList){ for (String s : readToList) {
ReconciliationDetailVo vo = new ReconciliationDetailVo(); ReconciliationDetailVo vo = new ReconciliationDetailVo();
List<String> sList = List.of(s.split("\t")); List<String> sList = List.of(s.split("\t"));
vo.setPsnNo(sList.get(0)); vo.setPsnNo(sList.get(0));