package com.ltkj.web.controller.his;
|
|
|
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONUtil;
|
import com.ltkj.common.core.domain.AjaxResult;
|
import com.ltkj.hosp.domain.TjCustomer;
|
import com.ltkj.hosp.service.ITjCustomerService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Date;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.stream.Collectors;
|
|
/* @Authot:zjh
|
* @Date: 2024-05-30
|
* */
|
|
@Component
|
public class HisApiMethod {
|
@Autowired
|
private HisApiMethodService controller;
|
|
@Autowired
|
private ITjCustomerService customerService;
|
|
|
//将方法返回值解析成json格式
|
public JSONObject getJSONObject (String builder) {
|
return JSONUtil.parseObj (builder);
|
}
|
|
//获取方法返回值信息
|
public String getAjaxResult (AjaxResult result) {
|
return result.get ("data").toString ();
|
}
|
|
//对接his总接口
|
public AjaxResult HisApiMethods (TjCustomer customer) {
|
|
// Date date = new Date ();
|
AjaxResult result = controller.Outpincreateapply (customer);
|
String result1 = getAjaxResult (result);
|
JSONObject object = getJSONObject (result1);
|
String code = object.getStr ("ResultCode");
|
if (code.equals ("0")) {
|
Map<String, Object> resultData = (Map<String, Object>) object.get ("ResultData");
|
if (null != resultData && resultData.size () > 0) {
|
String cardId = resultData.get ("pationid").toString ();
|
if(null !=cardId){
|
customer.setCardId (cardId);
|
customerService.updateById (customer);
|
}
|
}
|
|
}
|
return AjaxResult.success ();
|
}
|
|
}
|