Compare commits
No commits in common. "c959b4292f1798aacadd731af7602568a6d44729" and "e0ce8e5a68430da02144469cd8426591887a6046" have entirely different histories.
c959b4292f
...
e0ce8e5a68
|
|
@ -188,7 +188,7 @@ public class SocialRequest {
|
|||
}
|
||||
|
||||
public OM2207A call2207A(IM2207A im2207A) {
|
||||
JSONObject data = httpUtil.callBackMsgId("2207A",im2207A.buildToMap(),10000);
|
||||
JSONObject data = httpUtil.callBackMsgId("2207A",im2207A.buildToMap());
|
||||
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(),10000);
|
||||
httpUtil.callBackMsgId("3506", im3506.buildToMap());
|
||||
}
|
||||
|
||||
public void call2202(IM2202 im2202) {
|
||||
|
|
@ -235,9 +235,8 @@ public class SocialRequest {
|
|||
}
|
||||
|
||||
public OM2208 call2208(IM2208 im2208) {
|
||||
JSONObject jsonObject = httpUtil.callBackMsgId("2208", "data", im2208.buildToMap(), 10000);
|
||||
JSONObject jsonObject = httpUtil.call("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;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ public class HttpUtil {
|
|||
logger.info("上个版本号:" + pre_version_name);
|
||||
JSONObject result = null;
|
||||
try {
|
||||
result = callBackMsgId(infno, "data", input,10000);
|
||||
result = callBackMsgId(infno, "data", input);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -217,22 +217,19 @@ 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,int timeout) {
|
||||
public JSONObject callBackMsgId(String infno, Map<String, Object> input) {
|
||||
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)));
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
|
|||
* </p>
|
||||
*
|
||||
* @author NiuZiYuan
|
||||
* @since 2025-05-16
|
||||
* @since 2025-05-12
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -120,7 +120,4 @@ public class ChargeSocialPayLog implements Serializable {
|
|||
|
||||
@ApiModelProperty("证件号码")
|
||||
private String certno;
|
||||
|
||||
@ApiModelProperty("医疗费总额")
|
||||
private BigDecimal medfeeSumamt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import lombok.Setter;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -27,8 +26,8 @@ public class ReconciliationItemDto {
|
|||
// 对账结果
|
||||
private String reconciliationResult;
|
||||
//对账开始时间
|
||||
private LocalDateTime beginTime;
|
||||
private LocalDate beginTime;
|
||||
//对账结束时间
|
||||
private LocalDateTime endTime;
|
||||
private LocalDate endTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -820,7 +820,6 @@ 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);
|
||||
}
|
||||
|
||||
|
|
@ -860,7 +859,6 @@ 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,9 +136,6 @@ 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);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ 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;
|
||||
|
|
@ -34,7 +33,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SocialReconciliationService extends BaseService {
|
||||
|
|
@ -50,36 +48,35 @@ public class SocialReconciliationService extends BaseService {
|
|||
private Config config;
|
||||
@Autowired
|
||||
private HttpUtil httpUtil;
|
||||
|
||||
public List<ReconciliationItemVo> getList(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
public List<ReconciliationItemVo> getList(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||
QueryWrapper<ChargeSocialPayLog> clrQuery = new QueryWrapper<>();
|
||||
clrQuery.select("clr_type,insutype,clr_optins,count(0) as count");
|
||||
clrQuery.groupBy("clr_type", "insutype", "clr_optins");
|
||||
clrQuery.ge("setl_time", beginTime);
|
||||
clrQuery.le("setl_time", endTime);
|
||||
List<Map<String, Object>> mapList = chargeSocialPayLogMapper.selectMaps(clrQuery);
|
||||
clrQuery.groupBy("clr_type","insutype","clr_optins");
|
||||
clrQuery.ge("setl_time",beginTime);
|
||||
clrQuery.le("setl_time",endTime);
|
||||
List<Map<String,Object>> mapList = chargeSocialPayLogMapper.selectMaps(clrQuery);
|
||||
List<ReconciliationItemVo> voList = new ArrayList<>();
|
||||
for (Map<String, Object> item : mapList) {
|
||||
if (item.get("clr_type") == null || item.get("insutype") == null) {
|
||||
for (Map<String,Object> item : mapList){
|
||||
if (item.get("clr_type") == null || item.get("insutype") == null){
|
||||
continue;
|
||||
}
|
||||
String clr = item.get("clr_type").toString();
|
||||
String insutype = item.get("insutype").toString();
|
||||
String clr_optins = item.get("clr_optins") == null ? "" : item.get("clr_optins").toString();
|
||||
QueryWrapper<ChargeSocialPayLog> listQuery = new QueryWrapper<>();
|
||||
listQuery.eq("clr_type", clr);
|
||||
listQuery.eq("insutype", insutype);
|
||||
listQuery.eq("clr_optins", clr_optins);
|
||||
listQuery.ge("setl_time", beginTime);
|
||||
listQuery.le("setl_time", endTime);
|
||||
listQuery.eq("clr_type",clr);
|
||||
listQuery.eq("insutype",insutype);
|
||||
listQuery.eq("clr_optins",clr_optins);
|
||||
listQuery.ge("setl_time",beginTime);
|
||||
listQuery.le("setl_time",endTime);
|
||||
List<ChargeSocialPayLog> logs = chargeSocialPayLogMapper.selectList(listQuery);
|
||||
ReconciliationItemVo vo = new ReconciliationItemVo();
|
||||
vo.setReconciliationType(clr);
|
||||
vo.setInsuranceType(insutype);
|
||||
vo.setHandlingInstitution(clr_optins);
|
||||
vo.setSettlementCount(logs.size());
|
||||
for (ChargeSocialPayLog log : logs) {
|
||||
vo.setTotalMedicalCost(log.getMedfeeSumamt().add(vo.getTotalMedicalCost()));
|
||||
for (ChargeSocialPayLog log : logs){
|
||||
vo.setTotalMedicalCost(log.getPsnPartAmt().add(vo.getTotalMedicalCost()));
|
||||
vo.setTotalFundPayment(log.getFundPaySumamt().add(vo.getTotalFundPayment()));
|
||||
vo.setTotalPersonalAccountPayment(log.getAcctPay().add(vo.getTotalPersonalAccountPayment()));
|
||||
}
|
||||
|
|
@ -90,7 +87,6 @@ public class SocialReconciliationService extends BaseService {
|
|||
|
||||
/**
|
||||
* 对总账
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -111,17 +107,16 @@ public class SocialReconciliationService extends BaseService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 明细对账
|
||||
*
|
||||
* 明显对账
|
||||
* @param dto
|
||||
*/
|
||||
public List<ReconciliationDetailVo> detailDo(ReconciliationItemDto dto) {
|
||||
QueryWrapper<ChargeSocialPayLog> listQuery = new QueryWrapper<>();
|
||||
listQuery.eq("clr_type", dto.getReconciliationType());
|
||||
listQuery.eq("insutype", dto.getInsuranceType());
|
||||
listQuery.eq("clr_optins", dto.getHandlingInstitution());
|
||||
listQuery.ge("setl_time", dto.getBeginTime());
|
||||
listQuery.le("setl_time", dto.getEndTime());
|
||||
listQuery.eq("clr_type",dto.getReconciliationType());
|
||||
listQuery.eq("insutype",dto.getInsuranceType());
|
||||
listQuery.eq("clr_optins",dto.getHandlingInstitution());
|
||||
listQuery.ge("setl_time",dto.getBeginTime());
|
||||
listQuery.le("setl_time",dto.getEndTime());
|
||||
List<ChargeSocialPayLog> logs = chargeSocialPayLogMapper.selectList(listQuery);
|
||||
|
||||
try {
|
||||
|
|
@ -139,26 +134,23 @@ public class SocialReconciliationService extends BaseService {
|
|||
}
|
||||
//生成文件
|
||||
FileWriter writer = new FileWriter(file);
|
||||
for (ChargeSocialPayLog log : logs) {
|
||||
String refd_setl_flag = "0";
|
||||
if (ChargeTypeEnum.REFUND.getChargeType().equals(log.getChargeType())){
|
||||
refd_setl_flag = "1";
|
||||
}
|
||||
for (ChargeSocialPayLog log : logs){
|
||||
//TODO 退费标志
|
||||
QueryWrapper<ChargeOrder> orderQuery = new QueryWrapper<>();
|
||||
orderQuery.eq("code", log.getChargeOrderCode());
|
||||
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" + log.getMedfeeSumamt() + "\t" + log.getFundPaySumamt() + "\t" + log.getAcctPay() + "\t"
|
||||
+ refd_setl_flag+ "\n";
|
||||
String line = log.getSetlId()+"\t"+log.getMdtrtId()+"\t"+
|
||||
log.getPsnNo()+"\t"+dbOrder.getTotalPrice()+"\t"+log.getFundPaySumamt()+"\t" +log.getAcctPay()+"\t"
|
||||
+"0"+"\n";
|
||||
writer.write(line);
|
||||
}
|
||||
writer.flush();
|
||||
writer.close();
|
||||
log.info("对账明细文件创建成功,文件路径:" + filePath);
|
||||
log.info("对账明细文件创建成功,文件路径:"+filePath);
|
||||
//压缩文件为zip包
|
||||
String zipPath = filePath.substring(0, filePath.lastIndexOf(".")) + ".zip";
|
||||
fileUtil.zipFiles(new String[]{filePath}, zipPath);
|
||||
String zipPath = filePath.substring(0,filePath.lastIndexOf("."))+".zip";
|
||||
fileUtil.zipFiles(new String[]{filePath},zipPath);
|
||||
//上传文件
|
||||
OM9101 om9101 = socialRequest.call9101(zipPath);
|
||||
//请求明细对账接口
|
||||
|
|
@ -178,16 +170,16 @@ public class SocialReconciliationService extends BaseService {
|
|||
Map<String, Object> input_dw = new HashMap<>();
|
||||
String downloadFileName = om3202.getFilename();
|
||||
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());
|
||||
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<ReconciliationDetailVo> voList = new ArrayList<>();
|
||||
for (String s : readToList) {
|
||||
List<ReconciliationDetailVo> voList = new ArrayList<>();
|
||||
for (String s : readToList){
|
||||
ReconciliationDetailVo vo = new ReconciliationDetailVo();
|
||||
List<String> sList = List.of(s.split("\t"));
|
||||
vo.setPsnNo(sList.get(0));
|
||||
|
|
@ -204,17 +196,19 @@ public class SocialReconciliationService extends BaseService {
|
|||
}
|
||||
return voList;
|
||||
|
||||
} catch (IOException io) {
|
||||
}catch (IOException io){
|
||||
log.error("创建文件失败");
|
||||
throw new MessageException("创建文件失败");
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("未知错误",e);
|
||||
throw new MessageException("未知错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试明细对账
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<ReconciliationDetailVo> testDetailDo() {
|
||||
|
|
@ -222,8 +216,8 @@ public class SocialReconciliationService extends BaseService {
|
|||
String fileName = "FSI0000296920.zip";
|
||||
List<String> unzip = fileUtil.unzip(path, fileName);
|
||||
List<String> readToList = fileUtil.readToList(unzip);
|
||||
List<ReconciliationDetailVo> voList = new ArrayList<>();
|
||||
for (String s : readToList) {
|
||||
List<ReconciliationDetailVo> voList = new ArrayList<>();
|
||||
for (String s : readToList){
|
||||
ReconciliationDetailVo vo = new ReconciliationDetailVo();
|
||||
List<String> sList = List.of(s.split("\t"));
|
||||
vo.setPsnNo(sList.get(0));
|
||||
|
|
|
|||
Loading…
Reference in New Issue