阿里数据统计

dev_drug
qiuyt 2 months ago
parent a131d5a734
commit 98a9f5a1df

@ -3,10 +3,9 @@ package com.glxp.api.controller.test;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.AliCodeTestMapper;
import com.glxp.api.dao.auth.AuthCompanyMapper;
import com.glxp.api.entity.alihealth.AliYljgBillDetail;
import com.glxp.api.entity.alihealth.AliYljgSearchbill;
import com.glxp.api.entity.auth.AuthCompany;
import com.glxp.api.entity.alihealth.*;
import com.glxp.api.entity.collect.RelCodeBatch;
import com.glxp.api.entity.collect.RelCodeDetail;
import com.glxp.api.entity.thrsys.ThirdAliDrug;
@ -18,14 +17,13 @@ import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust;
import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
import com.glxp.api.req.alihealth.local.AlihealthKytThirdAliSearchbillInsertReqeust;
import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse;
import com.glxp.api.res.alihealth.AlihealthYljgListupoutDetailResponse;
import com.glxp.api.service.collect.RelCodeBatchService;
import com.glxp.api.service.collect.RelCodeDetailService;
import com.glxp.api.service.thrsys.ThirdAliDrugService;
import com.glxp.api.util.DimaUtil;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.alihealth.AlihealthUtils;
import com.glxp.api.util.alihealth.AlihealthYljgUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@ -153,28 +151,94 @@ public class TestCodeController {
return alihealthUtils.thirdAliSearchbillInsert(alihealthKytThirdAliSearchbillInsertReqeust);
}
@PostMapping("/test3")
public BaseResponse<List<AliYljgSearchbill>> test3() {
@PostMapping("/getAliBillCode")
public BaseResponse<List<AliYljgSearchbill>> getAliBillCode() {
AlihealthYljgListupoutReqeust alihealthYljgListupoutReqeust1 = new AlihealthYljgListupoutReqeust();
alihealthYljgListupoutReqeust1.setBegin_date("2024-10-01");
alihealthYljgListupoutReqeust1.setEnd_date("2025-01-16");
alihealthYljgListupoutReqeust1.setEnd_date("2025-01-15");
alihealthYljgListupoutReqeust1.setPage(1);
alihealthYljgListupoutReqeust1.setPage_size(1000);
alihealthYljgListupoutReqeust1.setPage_size(10000);
BaseResponse<List<AliYljgSearchbill>> baseResponse = alihealthYljgUtils.listupout(alihealthYljgListupoutReqeust1,null);
Map<String, List<AliYljgSearchbill>> groupedStudents = baseResponse.getData().stream()
.collect(Collectors.groupingBy(AliYljgSearchbill::getFromEntName));
Map<String, AliYljgSearchbill> collect = baseResponse.getData().stream()
.collect(Collectors.toMap(AliYljgSearchbill::getBillCode, p -> p, (p1, p2) -> p1));
List<AliYljgSearchbill> list = new ArrayList<>();
for (Map.Entry<String, AliYljgSearchbill> entry : collect.entrySet()) {
String key = entry.getKey();
AliYljgSearchbill value = entry.getValue();
list.add(value);
}
for (AliYljgSearchbill datum : list) {
AlihealthYljgListupoutDetailReqeust alihealthYljgListupoutDetailReqeust = new AlihealthYljgListupoutDetailReqeust();
alihealthYljgListupoutDetailReqeust.setBill_code(datum.getBillCode());
alihealthYljgListupoutDetailReqeust.setFrom_ref_user_id(datum.getFromRefUserId());
BaseResponse<AliYljgBillDetail> baseResponseNew = alihealthYljgUtils.listupoutDetail(alihealthYljgListupoutDetailReqeust);
List<String> codeList = new ArrayList<>();
AliYljgBillDetail aliYljgBillDetail = baseResponseNew.getData();
for (AliYljgBillDetailDrug aliYljgBillDetailDrug : aliYljgBillDetail.getAliYljgBillDetailDrugList()) {
AliCodeTest aliCodeTest = new AliCodeTest();
BeanUtils.copyProperties(aliYljgBillDetailDrug, aliCodeTest);
for (AliYljgBillDetailDrugCode aliYljgBillDetailDrugCode : aliYljgBillDetailDrug.getAliYljgBillDetailDrugCodeList()) {
aliCodeTest.setPrepnSpec(aliYljgBillDetailDrugCode.getPrepnSpec());
aliCodeTest.setCode(aliYljgBillDetailDrugCode.getCode());
aliCodeTest.setBillCode(aliYljgBillDetail.getBillCode());
aliCodeTest.setBillTime(DateUtil.parseDate(aliYljgBillDetail.getStoreOutDate()));
aliCodeTest.setEntSendName(aliYljgBillDetail.getEntSendName());
aliCodeTest.setFrom_ref_user_id(alihealthYljgListupoutDetailReqeust.getFrom_ref_user_id());
aliCodeTestMapper.insert(aliCodeTest);
}
}
}
return ResultVOUtils.success(groupedStudents.keySet());
return ResultVOUtils.success();
}
@PostMapping("/getAliBill")
public BaseResponse<List<AliYljgSearchbill>> getAliBill() {
AlihealthYljgListupoutReqeust alihealthYljgListupoutReqeust1 = new AlihealthYljgListupoutReqeust();
alihealthYljgListupoutReqeust1.setBegin_date("2024-10-01");
alihealthYljgListupoutReqeust1.setEnd_date("2025-01-15");
alihealthYljgListupoutReqeust1.setPage(1);
alihealthYljgListupoutReqeust1.setPage_size(10000);
BaseResponse<List<AliYljgSearchbill>> baseResponse = alihealthYljgUtils.listupout(alihealthYljgListupoutReqeust1,null);
Map<String, AliYljgSearchbill> collect = baseResponse.getData().stream()
.collect(Collectors.toMap(AliYljgSearchbill::getBillCode, p -> p, (p1, p2) -> p1));
List<AliYljgSearchbill> list = new ArrayList<>();
for (Map.Entry<String, AliYljgSearchbill> entry : collect.entrySet()) {
String key = entry.getKey();
AliYljgSearchbill value = entry.getValue();
list.add(value);
}
return ResultVOUtils.success();
}
@Resource
private AliCodeTestMapper aliCodeTestMapper;
@PostMapping("/test4")
public BaseResponse<AliYljgBillDetail> test4() {
AlihealthYljgListupoutDetailReqeust alihealthYljgListupoutDetailReqeust = new AlihealthYljgListupoutDetailReqeust();
alihealthYljgListupoutDetailReqeust.setBill_code("19604910");
alihealthYljgListupoutDetailReqeust.setFrom_ref_user_id("a74061d26923498785ad8489962d9de2");
return alihealthYljgUtils.listupoutDetail(alihealthYljgListupoutDetailReqeust);
BaseResponse<AliYljgBillDetail> baseResponse = alihealthYljgUtils.listupoutDetail(alihealthYljgListupoutDetailReqeust);
List<String> codeList = new ArrayList<>();
AliYljgBillDetail aliYljgBillDetail = baseResponse.getData();
for (AliYljgBillDetailDrug aliYljgBillDetailDrug : aliYljgBillDetail.getAliYljgBillDetailDrugList()) {
AliCodeTest aliCodeTest = new AliCodeTest();
BeanUtils.copyProperties(aliYljgBillDetailDrug, aliCodeTest);
for (AliYljgBillDetailDrugCode aliYljgBillDetailDrugCode : aliYljgBillDetailDrug.getAliYljgBillDetailDrugCodeList()) {
aliCodeTest.setPrepnSpec(aliYljgBillDetailDrugCode.getPrepnSpec());
aliCodeTest.setCode(aliYljgBillDetailDrugCode.getCode());
aliCodeTest.setBillCode(aliYljgBillDetail.getBillCode());
aliCodeTest.setBillTime(DateUtil.parseDate(aliYljgBillDetail.getStoreOutDate()));
aliCodeTest.setEntSendName(aliYljgBillDetail.getEntSendName());
aliCodeTest.setFrom_ref_user_id(alihealthYljgListupoutDetailReqeust.getFrom_ref_user_id());
aliCodeTestMapper.insert(aliCodeTest);
}
}
return ResultVOUtils.success();
}
}

@ -0,0 +1,6 @@
package com.glxp.api.dao;
import com.glxp.api.entity.alihealth.AliCodeTest;
public interface AliCodeTestMapper extends BaseMapperPlus<AliCodeTestMapper, AliCodeTest, AliCodeTest> {
}

@ -0,0 +1,29 @@
package com.glxp.api.entity.alihealth;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName("ali_code_test")
public class AliCodeTest {
private String billCode;
private Date billTime;
private String code;
private String prepnSpec;
/**
*
*/
private String physicName;
/**
*
*/
private String produceBatchNo;
/**
*
*/
private String prodSeqNo;
private String entSendName;
private String from_ref_user_id;
}
Loading…
Cancel
Save