3/14 安溪县

axxyy
wangwei 4 months ago
parent c5e75597b3
commit 0f46e0f2c0

@ -10,6 +10,7 @@ import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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;
@ -20,6 +21,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.glxp.mipsdl.client.CommonHttpClient;
import com.glxp.mipsdl.client.ptxhyy.entity.HisProductEntity;
import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
@ -33,9 +35,11 @@ import com.glxp.mipsdl.dao.inout.IoOrderDao;
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
import com.glxp.mipsdl.dao.thrsys.*;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.axxyy.DeptDict;
import com.glxp.mipsdl.entity.axxyy.PriceDict;
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
import com.glxp.mipsdl.entity.basic.BasicCorpEntity;
import com.glxp.mipsdl.entity.basic.BasicSkProjectEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.entity.inout.*;
import com.glxp.mipsdl.entity.njxyy.A005;
@ -170,7 +174,7 @@ public class AxxyyClient extends CommonHttpClient {
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<root>\n" +
"<code>" + "" + "</code>\n" +
"<name>红细胞</name>\n" +
"<name></name>\n" +
"<spell>" + "" + "</spell>\n" +
"<invalid>" + "" + "</invalid>\n" +
"<subject>" + "" + "</subject>\n" +
@ -627,12 +631,7 @@ public class AxxyyClient extends CommonHttpClient {
return baseResponse;
}
@Override
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_WAREHOUSE_QUERY_URL), udiwmsWarehouseRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) {
@ -997,18 +996,67 @@ public class AxxyyClient extends CommonHttpClient {
if (dataVo.getCode() != 0){
return ResultVOUtils.error(500,"获取项目字典错误");
}
List<PriceDict> list = dataVo.getList(PriceDict.class);
log.error("最终获取的收费项目: " + list);
// log.error("获取智业收费项目:::::: " + response);
List<BasicSkProjectResponse> basicSkProjectEntities = new ArrayList<>();
log.info("总数:" + list.size());
for (PriceDict priceDict : list) {
BasicSkProjectResponse basicSkProjectResponse = new BasicSkProjectResponse();
basicSkProjectResponse.setCode(priceDict.getCode());
basicSkProjectResponse.setName(priceDict.getName());
basicSkProjectResponse.setPrice(priceDict.getPrice());
basicSkProjectResponse.setGgxh(priceDict.getSpell());
basicSkProjectResponse.setType(2);
basicSkProjectResponse.setCreateTime(new Date());
basicSkProjectResponse.setUpdateTime(new Date());
basicSkProjectResponse.setRemark("自动下载");
basicSkProjectEntities.add(basicSkProjectResponse);
}
PageSimpleResponse<BasicSkProjectResponse> PriceDictResponse = new PageSimpleResponse<>();
PriceDictResponse.setTotal((long) basicSkProjectEntities.size()); // 设置总数
PriceDictResponse.setList(basicSkProjectEntities); // 设置列表
log.error("职业返回收费项目信息:::::::::::" + PriceDictResponse);
return ResultVOUtils.success(PriceDictResponse);
}catch (Exception e){
log.error("获取智业收费项目失败" );
log.error("Response: " + e.getMessage());
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果");
}
return null;
}
@Override
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
try {
// 发送请求
String response = callInterface(getMsgHeader("getDeptDict"), XmlBuilder.buildDeptBody("","","",""));
String xml = getXml(response);
if (xml == null){
return ResultVOUtils.error(500,"获取科室字典错误");
}
DataVo dataVo = getDataVo(xml);
if (dataVo.getCode() != 0){
return ResultVOUtils.error(500,"获取科室字典错误");
}
List<DeptDict> list = dataVo.getList(DeptDict.class);
log.info("总数:" + list.size());
List<UdiwmsWarehouseDetail> udiwmsWarehouseDetails = new ArrayList<>();
for (DeptDict deptDict : list) {
UdiwmsWarehouseDetail udiwmsWarehouseDetail = new UdiwmsWarehouseDetail();
udiwmsWarehouseDetail.setCode(deptDict.getCode());
udiwmsWarehouseDetail.setName(deptDict.getName());
udiwmsWarehouseDetails.add(udiwmsWarehouseDetail);
}
PageSimpleResponse<UdiwmsWarehouseDetail> DeptDictResponse = new PageSimpleResponse<>();
DeptDictResponse.setTotal((long) udiwmsWarehouseDetails.size()); // 设置总数
DeptDictResponse.setList(udiwmsWarehouseDetails); // 设置列表
log.error("职业返回收费项目信息:::::::::::" + DeptDictResponse);
return ResultVOUtils.success(DeptDictResponse);
}catch (Exception e){
log.error("异常信息:{}", e);
return ResultVOUtils.error(500, "网络错误,或远程服务器异常无法返回正确结果");
}
}
private static final String WSDL_URL = "http://173.19.192.196:8882/OTHER/BtmsEntranceWs?wsdl";
@ -1078,8 +1126,10 @@ public class AxxyyClient extends CommonHttpClient {
public DataVo getDataVo(String xml){
try {
log.error("获取到的xml文件数据" + xml);
XmlMapper xmlMapper = new XmlMapper();
JsonNode xmlNode = xmlMapper.readTree(xml.getBytes());
JsonNode xmlNode = xmlMapper.readTree(xml.getBytes("UTF-8"));
// 创建 JSON 映射器
ObjectMapper jsonMapper = new ObjectMapper();
String json = jsonMapper.writeValueAsString(xmlNode);
@ -1090,5 +1140,56 @@ public class AxxyyClient extends CommonHttpClient {
}
}
// public static void main(String[] args) {
// try {
// XmlMapper xmlMapper = new XmlMapper();
// JsonNode xmlNode = xmlMapper.readTree(xml.getBytes());
// // 创建 JSON 映射器
// ObjectMapper jsonMapper = new ObjectMapper();
// String json = jsonMapper.writeValueAsString(xmlNode);
// DataVo dataVo = JSONUtil.toBean(json,DataVo.class);
//// System.out.println("hahahhah" + dataVo.getList(DeptDict.class));
// List<DeptDict> list = dataVo.getList(DeptDict.class);
//
// log.info("总数:" + list.size());
// List<UdiwmsWarehouseDetail> udiwmsWarehouseDetails = new ArrayList<>();
// for (DeptDict deptDict : list) {
// UdiwmsWarehouseDetail udiwmsWarehouseDetail = new UdiwmsWarehouseDetail();
// udiwmsWarehouseDetail.setCode(deptDict.getCode());
// udiwmsWarehouseDetail.setName(deptDict.getName());
// udiwmsWarehouseDetails.add(udiwmsWarehouseDetail);
// }
// BaseResponse<Object> objectBaseResponse = new BaseResponse<>();
// objectBaseResponse.setCode(20000);
// objectBaseResponse.setData(udiwmsWarehouseDetails);
// System.out.println("dhhdhdhdhd" + objectBaseResponse);
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// }
private static final String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n" +
"<root>\n" +
" <code>0</code>\n" +
" <data>\n" +
" <lists>\n" +
" <code>10611452</code>\n" +
" <name>急诊收费</name>\n" +
" <spell>JZSF</spell>\n" +
" <valid>Y</valid>\n" +
" <sequence></sequence>\n" +
" <unitflag>1</unitflag>\n" +
" <attr>行政科室</attr>\n" +
" <insurcode></insurcode>\n" +
" <insurname></insurname>\n" +
" <locus></locus>\n" +
" <hospart></hospart>\n" +
" <checkbed></checkbed>\n" +
" <deptlevel></deptlevel>\n" +
" <parent>2009</parent>\n" +
" <ward>2009</ward>\n" +
" </lists>\n" +
" </data>\n" +
"</root>";
}

@ -1,17 +1,15 @@
package com.glxp.mipsdl.client.axxyy;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
@ -28,16 +26,25 @@ public class DataVo<T>{
private List<List> data; // 泛型 List
public List<T> getList(Class<T> clazz){
List<T> list = new ArrayList<>();
List<Object> jsonArray = data.get(0);
Gson gson = new Gson();
System.out.println(jsonArray.get(0).toString().replace("lists=",""));
String str = jsonArray.get(0).toString().replace("lists=","");
JSONArray array = JSONUtil.parseArray(str);
List<T> list = new ArrayList<>();
for (Object obj : array) {
System.out.println(obj.toString());
T dataVo = JSONUtil.toBean(obj.toString(),clazz);
if (JSONUtil.isJsonObj(str)) {
System.out.println("解析为 JSON 对象:");
JSONObject jsonObject = JSONUtil.parseObj(str);
T dataVo = JSONUtil.toBean(jsonObject, clazz);
list.add(dataVo);
}else if(JSONUtil.isJsonArray(str)){
JSONArray array = JSONUtil.parseArray(str);
// 遍历 JSON 数组并转换为指定类型
for (Object obj : array) {
System.out.println(obj.toString());
T dataVo = JSONUtil.toBean(obj.toString(), clazz);
list.add(dataVo);
}
}else {
throw new RuntimeException("未知的 JSON 格式");
}
return list;
}

@ -29,4 +29,18 @@ public class XmlBuilder {
" <hospart>" + hospart + "</hospart>\n" +
"</root>";
}
public static String buildDeptBody(String code, String name, String spell, String invalid) {
return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<root>\n" +
" <code>" + code + "</code>\n" +
" <name>" + name + "</name>\n" +
" <spell>" + spell + "</spell>\n" +
" <invalid>" + invalid + "</invalid>\n" +
" <isunit>" + 1 + "</isunit>\n" +
" <includeward>" + "" + "</includeward>\n" +
" <hospart>" + "" + "</hospart>\n" +
"</root>";
}
}

@ -0,0 +1,44 @@
package com.glxp.mipsdl.entity.axxyy;
import lombok.Data;
/**
* @author : zhuzhu
* @date : 2025/3/13 15:03
* @modyified By :
*/
@Data
public class DeptDict {
/**
*
*/
private String code;
/**
*
*/
private String name;
/**
*
*/
private String unitflag;
/**
*
*/
private String deptlevel;
/**
*
*/
private String parent;
/**
*
*/
private String ward;
}

@ -15,13 +15,31 @@ import javax.xml.bind.annotation.XmlElement;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
public class PriceDict {
/**
*
*/
private String code;
/**
*
*/
private String name;
/**
*
*/
private String unit;
/**
*
*/
private String price;
/**
*
*/
private String spell;
private String valid;

@ -55,6 +55,10 @@ public class BasicSkProjectResponse {
*/
private Integer type;
private String unit;
private String price;
private Integer status;
private Integer contrastStatus;
private List<BasicSkProjectDetailResponse> basicSkProjectDetailResponses;
}

Loading…
Cancel
Save