新增四川平武上传医保

取下级所有码逻辑问题优化
scpwxyy
qiuyt 5 months ago
parent add5fecbca
commit 00bea665f2

Binary file not shown.

@ -179,6 +179,12 @@
<!-- <artifactId>okhttp</artifactId>-->
<!-- <version>4.10.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.10.0</version>
</dependency>
</dependencies>

53873
spy.log

File diff suppressed because one or more lines are too long

@ -13,6 +13,7 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.mipsdl.client.CommonHttpClient;
@ -35,6 +36,7 @@ import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.*;
import com.glxp.mipsdl.entity.ctqyy.*;
import com.glxp.mipsdl.entity.inout.*;
import com.glxp.mipsdl.entity.system.ThrYbSetupMapper;
import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity;
import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.mipsdl.entity.thrsys.ThrProductsEntity;
@ -51,6 +53,7 @@ import com.glxp.mipsdl.res.PageSimpleResponse;
import com.glxp.mipsdl.res.ctqyy.CtBaseResponse;
import com.glxp.mipsdl.res.udiwms.*;
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.service.basic.RelCodeDetailService;
import com.glxp.mipsdl.service.order.OrderUploadLogService;
import com.glxp.mipsdl.service.system.SysParamConfigService;
import com.glxp.mipsdl.service.thrsys.ThrCorpService;
@ -131,6 +134,10 @@ public class SjpwxyyClient extends CommonHttpClient {
private VYpzsIoInfoMapper vYpzsIoInfoMapper;
@Resource
private YbClient ybClient;
@Resource
private ThrYbSetupMapper thrYbSetupMapper;
@Resource
private RelCodeDetailService relCodeDetailService;
/**
* xml
@ -653,7 +660,7 @@ public class SjpwxyyClient extends CommonHttpClient {
.selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
.eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk())
.eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()).
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
if (CollectionUtil.isNotEmpty(invoiceList)) {
fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
if (invoiceList.get(0).getInvoiceDate() != null)
@ -1786,9 +1793,10 @@ public class SjpwxyyClient extends CommonHttpClient {
}
public void optionUploadCollectOrder3505(IoCollectOrder ioCollectOrder) {
public BaseResponse optionUploadCollectOrder3505(IoCollectOrder ioCollectOrder) {
//摆药流水号
String stoout_no = ioCollectOrder.getBackupOrderRemark1();
// String stoout_no = ioCollectOrder.getBackupOrderRemark1();
String stoout_no = StringUtils.isBlank(ioCollectOrder.getBackupOrderRemark1()) ? ioCollectOrder.getBackupOrderRemark2() : ioCollectOrder.getBackupOrderRemark1();
List<VInsurNationGoodsPhysic> vInsurNationGoodsPhysics = goodsPhysicMapper.selectList(new LambdaQueryWrapper<VInsurNationGoodsPhysic>().eq(VInsurNationGoodsPhysic::getSTOOUT_NO, stoout_no));
if (CollUtil.isNotEmpty(vInsurNationGoodsPhysics)) {
List<CollectOrderBizResponse> collectOrderBizResponseList = ioCollectOrder.getCollectOrderBizResponseList();
@ -1802,9 +1810,19 @@ public class SjpwxyyClient extends CommonHttpClient {
List<DrugInfoRequest> drugTraceList = new ArrayList<>();
// 遍历fruits数组
for (String code : codes) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(code);
drugTraceList.add(request);
if (StrUtil.isNotBlank(code)) {
List<RelCodeDetail> relCodeDetailList = relCodeDetailService.getAllNext(code);
if(relCodeDetailList!=null && relCodeDetailList.size() >0 ){
for (RelCodeDetail relCodeDetail : relCodeDetailList) {
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(relCodeDetail.getCurCode());
drugTraceList.add(request);
}
}
}
}
Xsck3505Request xsck3505Request = Xsck3505Request.builder()
.med_list_codg(vInsurNationGoodsPhysic.getMED_LIST_CODG())
@ -1852,8 +1870,11 @@ public class SjpwxyyClient extends CommonHttpClient {
baseXsck3505Request.setSelinfoDetail(xsck3505Requests);
String jsonStr = JSONUtil.toJsonStr(baseXsck3505Request);
JSONObject dataJson = JSONObject.parseObject(jsonStr);
ybClient.ybPost("3505A", dataJson);
ybClient.ybPostScyh("3505A", dataJson);
}
return ResultVOUtils.success();
}
@ -1916,10 +1937,6 @@ public class SjpwxyyClient extends CommonHttpClient {
List<DrugInfoRequest> drugTraceList = new ArrayList<>();
// 遍历fruits数组
for (String code : codes) {
//todo
DrugInfoRequest request = new DrugInfoRequest();
request.setDrug_trac_codg(code);
drugTraceList.add(request);

@ -10,7 +10,13 @@ import com.glxp.mipsdl.req.base.UdiwmsQueryUdiInvProductsRequest;
import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.thirddao.njxyy.TestDataMapper;
import com.glxp.mipsdl.util.ResultVOUtils;
//import com.sun.tools.javac.Main;
import com.glxp.mipsdl.util.TestDLL;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -18,11 +24,13 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
public class TestController {
@Resource
TestDataMapper testDataMapper;
@Resource
@ -46,6 +54,61 @@ public class TestController {
}
return ResultVOUtils.success();
}
@PostMapping ("/test/scyh")
public BaseResponse scyh(@RequestBody Map map) {
return ResultVOUtils.success(gmEcbEncryptKe((String) map.get("key"), (String) map.get("code")));
}
public String gmEcbEncryptKe(String key ,String code){
try {
Thread.sleep(10000);
System.out.println("H0grHchTXHPKna8Va/k9zenxltDjrZhhr8rHAXYbXqp4virHfevi1Oafh377WlsU9bDn9R1HgpChs9kS6z92PkT3MvnwsmGhq1TPcbPP9k2w9fRj4EmMcDUUwsWPgu8TSEUdK9n6Z1IzYwf2RjlYHCYO5WgiPbyv80zuXZ4KrwuTlxnPRz3Xqr0wFldMsiTT".length());
// key ="74F8DDC4212A8DFAAD4F23DFBF37BC1CAAB24D3CAD3BC7867972D2A1C5EB6D6B1C300237F18077D87175058D24027A7341FA466A1B96A95851278B67F4F80668";
// code ="H51072700564";
// ByteByReference data = new ByteByReference(10);
Pointer data = new Memory(128);
// Pointer keyData = new Memory(key.length()+1);
// keyData.write(0, key.getBytes(), 0, key.length());
//
// Pointer codeData = new Memory(code.length()+1);
// keyData.write(0, code.getBytes(), 0, code.length());
//
// IntByReference intByReference = new IntByReference(key.length());
// System.out.println("data"+data.getValue());
int ss = TestDLL.instance.gm_ecb_encrypt_key(key,code,key.length(),data);
System.out.println("asdas"+ss);
// for (ByteByReference datum : data) {
// try {
// System.out.println("data"+datum.getValue());
//
// }catch (Exception e){
//
// }
//
// }
System.out.println(data.getString(0));
String str = data.getString(0);
Native.free(Pointer.nativeValue(data));
Pointer.nativeValue(data, 0); //避免Memory对象被GC时重复执行Nativ.free()方法
// Native.free(Pointer.nativeValue(keyData));
// Pointer.nativeValue(keyData, 0); //避免Memory对象被GC时重复执行Nativ.free()方法
//
// Native.free(Pointer.nativeValue(codeData));
// Pointer.nativeValue(codeData, 0); //避免Memory对象被GC时重复执行Nativ.free()方法
//
// Native.free(Pointer.nativeValue(intByReference.getPointer()));
// Pointer.nativeValue(intByReference.getPointer(), 0); //避免Memory对象被GC时重复执行Nativ.free()方法
return str;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
@ -93,5 +94,7 @@ public class ThrYbSetup implements Serializable {
@TableField(value = "signNo")
private String signNo;
@TableField(value = "signData")
private String signData;
private static final long serialVersionUID = 1L;
}

@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.mipsdl.entity.basic.RelCodeDetail;
@ -20,8 +21,17 @@ public class RelCodeDetailService extends ServiceImpl<RelCodeDetailMapper, RelCo
* @return
*/
public List<RelCodeDetail> getAllNext(String code) {
RelCodeDetail relCodeDetail = this.baseMapper.selectOne(
new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getCurCode, code)
);
if(Objects.isNull(relCodeDetail)){
relCodeDetail = new RelCodeDetail();
relCodeDetail.setCurCode(code);
}
List<RelCodeDetail> list = new ArrayList<>();
list.add(relCodeDetail);
fetchAllChildren(code, list);
return list;
}

@ -2,19 +2,31 @@ package com.glxp.mipsdl.service.yb;
import cn.hsa.zephyr.apisdk.ZephyrMedicalClient;
import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
import cn.hsa.zephyr.apisdk.internal.util.StringUtils;
import cn.hsa.zephyr.apisdk.internal.util.encrypt.EncryptionModeEnum;
import cn.hsa.zephyr.apisdk.internal.util.encrypt.SignTypeEnum;
import cn.hsa.zephyr.apisdk.request.ZephyrMedicalRequest;
import cn.hsa.zephyr.apisdk.response.ChsMedicalResponse;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.entity.system.ThrYbSetup;
import com.glxp.mipsdl.entity.system.ThrYbSetupMapper;
import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.service.basic.RelCodeDetailService;
import com.glxp.mipsdl.service.system.ThrYbSetupService;
import com.glxp.mipsdl.util.DateUtil;
import com.glxp.mipsdl.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
@Slf4j
@Service
@ -22,9 +34,14 @@ public class YbClient {
@Resource
ThrYbSetupService thrYbSetupService;
@Resource
ThrYbSetupMapper thrYbSetupMapper;
@Resource
RelCodeDetailService relCodeDetailService;
/**
*
*
* @param apiNo
* @param data
* @return
@ -69,5 +86,115 @@ public class YbClient {
/**
*
*/
public BaseResponse ybPostScyh(String apiNo, JSONObject data) {
log.info("[" + apiNo + "]医保接口请求参数:" + data);
ThrYbSetup thrYbSetup = thrYbSetupService.getSetUp();
if (thrYbSetup == null)
throw new RuntimeException("未配置医保接口");
// 组装访问数据
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
// 获取当前日期和时间
Date now = new Date();
// 使用format方法格式化日期和时间
String formattedDate = dateFormat.format(now);
JSONObject jsonObject = new JSONObject();
jsonObject.put("infno", apiNo);
jsonObject.put("msgid", thrYbSetup.getFixmedins_code() + formattedDate + "0001");
jsonObject.put("insuplc_admdvs", thrYbSetup.getInsuplc_admdvs());
jsonObject.put("mdtrtarea_admvs", thrYbSetup.getMdtrtarea_admvs());
jsonObject.put("recer_sys_code", thrYbSetup.getRecer_sys_code());
jsonObject.put("dev_no", "");
jsonObject.put("dev_safe_info", "");
jsonObject.put("cainfo", thrYbSetup.getAppSecret());
jsonObject.put("signtype", "");
jsonObject.put("infver", thrYbSetup.getInfver());
jsonObject.put("opter_type", thrYbSetup.getOpter_type());
jsonObject.put("opter", thrYbSetup.getOpter());
jsonObject.put("opter_name", thrYbSetup.getOpter_name());
jsonObject.put("inf_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
jsonObject.put("fixmedins_code", thrYbSetup.getFixmedins_code());
jsonObject.put("fixmedins_name", thrYbSetup.getFixmedins_name());
jsonObject.put("app_id", "");
jsonObject.put("enc_type", "");
jsonObject.put("pw_ecToken", "");
// 签到信息时间不为今天就进行签到刷新
String signNo = null;
if (StringUtils.isEmpty(thrYbSetup.getSignNo())
|| Objects.isNull(thrYbSetup.getSignData())
|| !thrYbSetup.getSignData().equals(new SimpleDateFormat("yyyy-MM-dd").format(new Date()))) {
// 签到系统刷新
jsonObject.put("infno", "9001");
JSONObject jsonObjectSignIn = new JSONObject();
JSONObject jsonObjectSignInObg = new JSONObject();
jsonObjectSignInObg.put("opter_no", thrYbSetup.getOpter_no());
jsonObjectSignInObg.put("mac", thrYbSetup.getMac());
jsonObjectSignInObg.put("ip", thrYbSetup.getIp());
jsonObjectSignIn.put("signIn", jsonObjectSignInObg);
jsonObject.put("input", jsonObjectSignIn);
try {
String json = HttpUtil.post(thrYbSetup.getIp(), JSONUtil.toJsonStr(jsonObject));
// String json = "{\n" +
// " \"output\":{\n" +
// " \"signinoutb\":{\n" +
// " \"sign_no\":\"510700G0000005207526\",\n" +
// " \"sign_time\":\"2024-11-09 00:00:00\"\n" +
// " }\n" +
// " },\n" +
// " \"infcode\":0,\n" +
// " \"warn_msg\":null,\n" +
// " \"cainfo\":null,\n" +
// " \"err_msg\":\"success\",\n" +
// " \"refmsg_time\":\"20241109171206549\",\n" +
// " \"signtype\":null,\n" +
// " \"respond_time\":\"20241109171206598\",\n" +
// " \"inf_refmsgid\":\"510000202411091712060847645203\"\n" +
// "}";
Map map = JSONUtil.toBean(json, Map.class);
Map output = (Map) map.get("output");
Map signinoutb = (Map) output.get("signinoutb");
signNo = (String) signinoutb.get("sign_no");
String signTime = (String) signinoutb.get("sign_time");
// 插入签到值和签到时间更新
ThrYbSetup thrYbSetupUpdate = new ThrYbSetup();
thrYbSetupUpdate.setSignNo(signNo);
thrYbSetupUpdate.setSignData(signTime);
thrYbSetupMapper.update(thrYbSetupUpdate, new QueryWrapper<ThrYbSetup>()
.last("limit 1")
);
} catch (Exception e) {
return ResultVOUtils.error(500, "第三方医保签到失败!!"+e.getMessage());
}
// .eq("","")
// ,);
} else {
signNo = thrYbSetup.getSignNo();
}
jsonObject.put("infno", apiNo);
jsonObject.put("input", data);
jsonObject.put("sign_no", signNo);
try {
String json = HttpUtil.post(thrYbSetup.getIp(), JSONUtil.toJsonStr(jsonObject));
log.info("上传医保结果===" + json);
}catch (Exception e){
return ResultVOUtils.error(500, "上传医保失败!!"+e.getMessage());
}
//
return ResultVOUtils.success();
}
public static void main(String[] args) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("infno", "111");
jsonObject.put("data", "222");
System.out.println(JSONUtil.toJsonStr(jsonObject));
}
}

@ -0,0 +1,26 @@
package com.glxp.mipsdl.util;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.sun.jna.Library;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.ByteByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public interface TestDLL extends Library {
//加载dll实例成对象。下面的方法均为dll提供的方法
TestDLL instance = (TestDLL)Native.load("hsafsiyhsafe去@(2).dll",TestDLL.class);
int gm_ecb_encrypt_key(String pub_key, String plain, int plain_len, Pointer cipher);
int gm_ecb_decrypt_key(Pointer pub_key,Pointer cipher,IntByReference cipher_len,Pointer plain);
public static void main(String[] args) {
System.out.println("2024-11-08 00:00:00".length());
}
}
Loading…
Cancel
Save