This commit is contained in:
LiJianZhao 2025-05-16 14:20:08 +08:00
parent 8ed948e608
commit b48570bcc2
8 changed files with 74 additions and 55 deletions

View File

@ -188,7 +188,7 @@ public class SocialRequest {
}
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.setMsgId(data.get("msgid").toString());
om2207A.setSetlinfo(JSONObject.parseObject(data.get("setlinfo").toString(), OM2207A.Setlinfo.class));
@ -227,7 +227,7 @@ public class SocialRequest {
public void call3506(IM3506 im3506) {
httpUtil.callBackMsgId("3506", im3506.buildToMap());
httpUtil.callBackMsgId("3506", im3506.buildToMap(),10000);
}
public void call2202(IM2202 im2202) {
@ -235,8 +235,9 @@ public class SocialRequest {
}
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.setMsgId(jsonObject.get("msgid").toString());
om2208.setSetlinfo(JSONObject.parseObject(jsonObject.get("setlinfo").toString(), OM2208.Setlinfo.class));
om2208.setSetldetail(JSONArray.parseArray(jsonObject.get("setldetail").toString(), OM2208.Setldetail.class));
return om2208;

View File

@ -142,7 +142,7 @@ public class HttpUtil {
logger.info("上个版本号:" + pre_version_name);
JSONObject result = null;
try {
result = callBackMsgId(infno, "data", input);
result = callBackMsgId(infno, "data", input,10000);
} catch (Exception e) {
return null;
}
@ -217,19 +217,22 @@ public class HttpUtil {
JSONObject output = post(config.get("social", "url"), JSON.toJSONString(getparms(infno, tag, input)),timeout);
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));
output.put("msgid",msgId);
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) {
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")
public Result<Object> refund() {
String changeOrderCode = parmsUtil.getString("changeOrderCode");
String changeOrderCode = parmsUtil.getString("changeOrderCode","订单号为空");
chargeService.refund(changeOrderCode);
return success();
}

View File

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

View File

@ -5,6 +5,7 @@ import lombok.Setter;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
@ -26,8 +27,8 @@ public class ReconciliationItemDto {
// 对账结果
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.setChargeType(ChargeTypeEnum.CHARGE.getChargeType());
socialPayLog.setOriginalBalc(setlinfo.getBalc().add(setlinfo.getAcct_pay()));
socialPayLog.setMedfeeSumamt(setlinfo.getMedfee_sumamt());
chargeSocialPayLogMapper.insert(socialPayLog);
}
@ -859,6 +860,7 @@ public class ChargeService extends BaseService {
socialPayLog.setMsgid(om2208.getMsgId());
socialPayLog.setChargeType(ChargeTypeEnum.REFUND.getChargeType());
socialPayLog.setOriginalBalc(setlinfo.getBalc().add(payLog.getAcctPay()));
socialPayLog.setMedfeeSumamt(setlinfo.getMedfee_sumamt());
chargeSocialPayLogMapper.insert(socialPayLog);
}

View File

@ -136,6 +136,9 @@ public class PatientInfoService extends BaseService {
}
Integer beforeIntegral = patientInfo.getIntegralBalance();
Integer finalIntegral = beforeIntegral + addIntegral;
if (finalIntegral < 0){
throw new MessageException("剩余积分积分不足");
}
PatientInfo updatePatient = new PatientInfo();
updatePatient.setId(patientId);
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.request.SocialRequest;
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.util.FileUtil;
import com.syjiaer.clinic.server.common.util.HttpUtil;
@ -33,6 +34,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class SocialReconciliationService extends BaseService {
@ -48,6 +50,7 @@ public class SocialReconciliationService extends BaseService {
private Config config;
@Autowired
private HttpUtil httpUtil;
public List<ReconciliationItemVo> getList(LocalDateTime beginTime, LocalDateTime endTime) {
QueryWrapper<ChargeSocialPayLog> clrQuery = new QueryWrapper<>();
clrQuery.select("clr_type,insutype,clr_optins,count(0) as count");
@ -76,7 +79,7 @@ public class SocialReconciliationService extends BaseService {
vo.setHandlingInstitution(clr_optins);
vo.setSettlementCount(logs.size());
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.setTotalPersonalAccountPayment(log.getAcctPay().add(vo.getTotalPersonalAccountPayment()));
}
@ -87,6 +90,7 @@ public class SocialReconciliationService extends BaseService {
/**
* 对总账
*
* @param dto
* @return
*/
@ -107,7 +111,8 @@ public class SocialReconciliationService extends BaseService {
}
/**
* 明显对账
* 明细对账
*
* @param dto
*/
public List<ReconciliationDetailVo> detailDo(ReconciliationItemDto dto) {
@ -135,14 +140,17 @@ public class SocialReconciliationService extends BaseService {
//生成文件
FileWriter writer = new FileWriter(file);
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<>();
orderQuery.eq("code", log.getChargeOrderCode());
orderQuery.last("limit 1");
ChargeOrder dbOrder = chargeOrderMapper.selectOne(orderQuery);
String line = log.getSetlId() + "\t" + log.getMdtrtId() + "\t" +
log.getPsnNo()+"\t"+dbOrder.getTotalPrice()+"\t"+log.getFundPaySumamt()+"\t" +log.getAcctPay()+"\t"
+"0"+"\n";
log.getPsnNo() + "\t" + log.getMedfeeSumamt() + "\t" + log.getFundPaySumamt() + "\t" + log.getAcctPay() + "\t"
+ refd_setl_flag+ "\n";
writer.write(line);
}
writer.flush();
@ -200,15 +208,13 @@ public class SocialReconciliationService extends BaseService {
log.error("创建文件失败");
throw new MessageException("创建文件失败");
}catch (Exception e){
log.error("未知错误",e);
throw new MessageException("未知错误");
}
}
/**
* 测试明细对账
*
* @return
*/
public List<ReconciliationDetailVo> testDetailDo() {