|
|
|
@ -1,23 +1,47 @@
|
|
|
|
|
package com.glxp.api.service.basic;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.dao.basic.BasicSkProjectMapper;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicSkSickerEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.ThrProductsEntity;
|
|
|
|
|
import com.glxp.api.http.ErpBasicClient;
|
|
|
|
|
import com.glxp.api.req.basic.BasicSkPrescribeRequest;
|
|
|
|
|
import com.glxp.api.req.basic.BasicSkProjectRequest;
|
|
|
|
|
import com.glxp.api.req.basic.GetSickPrescribeRequest;
|
|
|
|
|
import com.glxp.api.req.basic.GetSickRequest;
|
|
|
|
|
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.basic.BasicSkPrescribeResponse;
|
|
|
|
|
import com.glxp.api.res.basic.BasicSkProjectResponse;
|
|
|
|
|
import com.glxp.api.res.basic.BasicSkSickerResponse;
|
|
|
|
|
import com.glxp.api.res.thrsys.ThrProductsResponse;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicSkPrescribeEntity;
|
|
|
|
|
import com.glxp.api.dao.basic.BasicSkPrescribeMapper;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class BasicSkPrescribeService extends ServiceImpl<BasicSkPrescribeMapper, BasicSkPrescribeEntity> {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
ErpBasicClient erpBasicClient;
|
|
|
|
|
|
|
|
|
|
public List<BasicSkPrescribeResponse> filterList(BasicSkPrescribeRequest basicSkPrescribeRequest) {
|
|
|
|
|
if (basicSkPrescribeRequest == null) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
@ -29,4 +53,38 @@ public class BasicSkPrescribeService extends ServiceImpl<BasicSkPrescribeMapper,
|
|
|
|
|
List<BasicSkPrescribeResponse> data = super.baseMapper.filterList(basicSkPrescribeRequest);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse downloadSickerPrescribe(GetSickPrescribeRequest request) {
|
|
|
|
|
int page = 1;
|
|
|
|
|
int limit = 200;
|
|
|
|
|
request.setThirdSys("thirdId");
|
|
|
|
|
request.setLimit(limit);
|
|
|
|
|
while (true) {
|
|
|
|
|
request.setPage(page);
|
|
|
|
|
BaseResponse<PageSimpleResponse<BasicSkPrescribeResponse>> baseResponse = erpBasicClient.getSickPrescribe(request);
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
List<BasicSkPrescribeResponse> list = baseResponse.getData().getList();
|
|
|
|
|
|
|
|
|
|
List<BasicSkPrescribeEntity> basicSkPrescribeEntities = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
list.forEach(item -> {
|
|
|
|
|
BasicSkPrescribeEntity basicSkSickerEntity = new BasicSkPrescribeEntity();
|
|
|
|
|
BeanUtil.copyProperties(item, basicSkSickerEntity);
|
|
|
|
|
//todo 数据转换
|
|
|
|
|
basicSkPrescribeEntities.add(basicSkSickerEntity);
|
|
|
|
|
});
|
|
|
|
|
if (list.size() >= limit && !baseResponse.getData().getTotal().equals(-666)) {
|
|
|
|
|
super.baseMapper.replaceBatchs(basicSkPrescribeEntities);
|
|
|
|
|
page++;
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "下载异常中断");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("下载成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|