From 98a9f5a1df86f8691fc96c628f73cbf69d6ee790 Mon Sep 17 00:00:00 2001 From: qiuyt Date: Fri, 14 Feb 2025 16:07:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=BF=E9=87=8C=E6=95=B0=E6=8D=AE=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/test/TestCodeController.java | 94 ++++++++++++++++--- .../com/glxp/api/dao/AliCodeTestMapper.java | 6 ++ .../api/entity/alihealth/AliCodeTest.java | 29 ++++++ 3 files changed, 114 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/glxp/api/dao/AliCodeTestMapper.java create mode 100644 src/main/java/com/glxp/api/entity/alihealth/AliCodeTest.java diff --git a/src/main/java/com/glxp/api/controller/test/TestCodeController.java b/src/main/java/com/glxp/api/controller/test/TestCodeController.java index a63e1624..994b7ffa 100644 --- a/src/main/java/com/glxp/api/controller/test/TestCodeController.java +++ b/src/main/java/com/glxp/api/controller/test/TestCodeController.java @@ -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> test3() { + @PostMapping("/getAliBillCode") + public BaseResponse> 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> baseResponse = alihealthYljgUtils.listupout(alihealthYljgListupoutReqeust1,null); - Map> groupedStudents = baseResponse.getData().stream() - .collect(Collectors.groupingBy(AliYljgSearchbill::getFromEntName)); + Map collect = baseResponse.getData().stream() + .collect(Collectors.toMap(AliYljgSearchbill::getBillCode, p -> p, (p1, p2) -> p1)); + List list = new ArrayList<>(); + for (Map.Entry entry : collect.entrySet()) { + String key = entry.getKey(); + AliYljgSearchbill value = entry.getValue(); + list.add(value); + } + - return ResultVOUtils.success(groupedStudents.keySet()); + for (AliYljgSearchbill datum : list) { + AlihealthYljgListupoutDetailReqeust alihealthYljgListupoutDetailReqeust = new AlihealthYljgListupoutDetailReqeust(); + alihealthYljgListupoutDetailReqeust.setBill_code(datum.getBillCode()); + alihealthYljgListupoutDetailReqeust.setFrom_ref_user_id(datum.getFromRefUserId()); + BaseResponse baseResponseNew = alihealthYljgUtils.listupoutDetail(alihealthYljgListupoutDetailReqeust); + List 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(); } + @PostMapping("/getAliBill") + public BaseResponse> 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> baseResponse = alihealthYljgUtils.listupout(alihealthYljgListupoutReqeust1,null); + Map collect = baseResponse.getData().stream() + .collect(Collectors.toMap(AliYljgSearchbill::getBillCode, p -> p, (p1, p2) -> p1)); + List list = new ArrayList<>(); + for (Map.Entry 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 test4() { AlihealthYljgListupoutDetailReqeust alihealthYljgListupoutDetailReqeust = new AlihealthYljgListupoutDetailReqeust(); alihealthYljgListupoutDetailReqeust.setBill_code("19604910"); alihealthYljgListupoutDetailReqeust.setFrom_ref_user_id("a74061d26923498785ad8489962d9de2"); - - return alihealthYljgUtils.listupoutDetail(alihealthYljgListupoutDetailReqeust); + BaseResponse baseResponse = alihealthYljgUtils.listupoutDetail(alihealthYljgListupoutDetailReqeust); + List 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(); } } diff --git a/src/main/java/com/glxp/api/dao/AliCodeTestMapper.java b/src/main/java/com/glxp/api/dao/AliCodeTestMapper.java new file mode 100644 index 00000000..2f89fb2a --- /dev/null +++ b/src/main/java/com/glxp/api/dao/AliCodeTestMapper.java @@ -0,0 +1,6 @@ +package com.glxp.api.dao; + +import com.glxp.api.entity.alihealth.AliCodeTest; + +public interface AliCodeTestMapper extends BaseMapperPlus { +} diff --git a/src/main/java/com/glxp/api/entity/alihealth/AliCodeTest.java b/src/main/java/com/glxp/api/entity/alihealth/AliCodeTest.java new file mode 100644 index 00000000..64a745c6 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/alihealth/AliCodeTest.java @@ -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; + +}