parent
38f66bc445
commit
d2c006cf43
@ -0,0 +1,43 @@
|
||||
package com.glxp.api.res.alihealth;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
public class AlihealthLsydListupoutResponse extends AlihealthKytCommonParametersResponse {
|
||||
private JSONArray bill_up_out_detail_do;
|
||||
private Integer total_num;
|
||||
|
||||
public AlihealthLsydListupoutResponse(String json) {
|
||||
// 初始化请求的值
|
||||
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(json);
|
||||
JSONObject jsonObjectResult = null;
|
||||
for (String s : jsonObject.keySet()) {
|
||||
jsonObjectResult = jsonObject.getJSONObject(s).getJSONObject("result");
|
||||
|
||||
}
|
||||
AlihealthKytCommonParametersResponse alihealthKytCommonParametersResponse = JSONUtil.toBean(jsonObjectResult.toString(),
|
||||
AlihealthKytCommonParametersResponse.class);
|
||||
BeanUtils.copyProperties(alihealthKytCommonParametersResponse, this);
|
||||
if (StringUtils.isNotEmpty(this.getMsg_info())
|
||||
&& this.getMsg_info().equals("调用成功")
|
||||
) {
|
||||
this.disposeResult(jsonObjectResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void disposeResult(JSONObject jsonObjectResult) {
|
||||
JSONObject jsonObjectModel = jsonObjectResult.getJSONObject("model");
|
||||
if (!Objects.isNull(jsonObjectModel)) {
|
||||
this.setTotal_num(jsonObjectModel.getInt("total_num"));
|
||||
this.setBill_up_out_detail_do(jsonObjectModel.getJSONObject("result_list").getJSONArray("bill_up_out_detail_do"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue