diff --git a/src/main/java/com/alihealth/d2d/provtest/VO/DrugInvoiceAndDeliveryInfoVO.java b/src/main/java/com/alihealth/d2d/provtest/VO/DrugInvoiceAndDeliveryInfoVO.java new file mode 100644 index 0000000..0b1cc00 --- /dev/null +++ b/src/main/java/com/alihealth/d2d/provtest/VO/DrugInvoiceAndDeliveryInfoVO.java @@ -0,0 +1,43 @@ +package com.alihealth.d2d.provtest.VO; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 药品发货单与收货单信息的中间层,按照时间进行排序 + */ +@Data +public class DrugInvoiceAndDeliveryInfoVO implements Serializable { + + private static final long serialVersionUID = -9217183676850562960L; + + /** + * 时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date sj; + + /** + * 公司信用代码 + */ + private String tyshxydm; + + /** + * 公司名称 + */ + private String gsmc; + + /** + * 订单号 + */ + private String ddh; + + /** + * 单据类型 : delivery : 收货单,invoice : 发货单 + */ + private String djlx; + +} diff --git a/src/main/java/com/alihealth/d2d/provtest/VO/DrugRetraceVO.java b/src/main/java/com/alihealth/d2d/provtest/VO/DrugRetraceVO.java index f1c7913..7bd0a70 100644 --- a/src/main/java/com/alihealth/d2d/provtest/VO/DrugRetraceVO.java +++ b/src/main/java/com/alihealth/d2d/provtest/VO/DrugRetraceVO.java @@ -16,14 +16,9 @@ public class DrugRetraceVO implements Serializable { private DrugProductionInfoVO drugProductionInfoVO; /** - * 药品发货信息, 发货信息可能会有多条 + * 药品发货单与收货单信息 */ - private List drugInvoiceInfoVOList; - - /** - * 药品收货信息, 收货信息可能会有多条 - */ - private List drugDeliveryNoteInfoVOList; + private List drugInvoiceAndDeliveryInfoVOList; /** * 药品零售与药品使用信息 diff --git a/src/main/java/com/alihealth/d2d/provtest/service/impl/DrugRetraceServiceImpl.java b/src/main/java/com/alihealth/d2d/provtest/service/impl/DrugRetraceServiceImpl.java index 79c2631..32a9c57 100644 --- a/src/main/java/com/alihealth/d2d/provtest/service/impl/DrugRetraceServiceImpl.java +++ b/src/main/java/com/alihealth/d2d/provtest/service/impl/DrugRetraceServiceImpl.java @@ -7,7 +7,9 @@ import com.alihealth.d2d.provtest.searcher.DrugRetraceSearcher; import com.alihealth.d2d.provtest.service.DrugRetraceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -42,12 +44,40 @@ public class DrugRetraceServiceImpl implements DrugRetraceService { throw new ServiceException("未查询到该药品!"); } drugRetraceVO.setDrugProductionInfoVO(drugProductionInfoVO); + //统一发货单与收货单,并行排序 + List drugInvoiceAndDeliveryInfoVOList = new ArrayList<>(); // 查询发货单 List drugInvoiceInfoVOList = drugInvoiceApplyInfoMapper.selectByYpzsm(searcher.getYpzsm()); - drugRetraceVO.setDrugInvoiceInfoVOList(drugInvoiceInfoVOList); + if (!CollectionUtils.isEmpty(drugInvoiceInfoVOList)) { + for (DrugInvoiceInfoVO drugInvoiceInfoVO : drugInvoiceInfoVOList) { + DrugInvoiceAndDeliveryInfoVO drugInvoiceAndDeliveryInfoVO = new DrugInvoiceAndDeliveryInfoVO(); + drugInvoiceAndDeliveryInfoVO.setSj(drugInvoiceInfoVO.getFhsj()); + drugInvoiceAndDeliveryInfoVO.setTyshxydm(drugInvoiceInfoVO.getTyshxydmfhjg()); + drugInvoiceAndDeliveryInfoVO.setGsmc(drugInvoiceInfoVO.getFhjgmc()); + drugInvoiceAndDeliveryInfoVO.setDdh(drugInvoiceInfoVO.getFhdbh()); + drugInvoiceAndDeliveryInfoVO.setDjlx("invoice"); + drugInvoiceAndDeliveryInfoVOList.add(drugInvoiceAndDeliveryInfoVO); + } + } + // 查询收货单 List drugDeliveryNoteInfoVOList = drugDeliveryNoteApplyInfoMapper.selectByYpzsm(searcher.getYpzsm()); - drugRetraceVO.setDrugDeliveryNoteInfoVOList(drugDeliveryNoteInfoVOList); + if (!CollectionUtils.isEmpty(drugDeliveryNoteInfoVOList)) { + for (DrugDeliveryNoteInfoVO drugDeliveryNoteInfoVO : drugDeliveryNoteInfoVOList) { + DrugInvoiceAndDeliveryInfoVO drugInvoiceAndDeliveryInfoVO = new DrugInvoiceAndDeliveryInfoVO(); + drugInvoiceAndDeliveryInfoVO.setSj(drugDeliveryNoteInfoVO.getShsj()); + drugInvoiceAndDeliveryInfoVO.setTyshxydm(drugDeliveryNoteInfoVO.getTyshxydmshjg()); + drugInvoiceAndDeliveryInfoVO.setGsmc(drugDeliveryNoteInfoVO.getShjgmc()); + drugInvoiceAndDeliveryInfoVO.setDdh(drugDeliveryNoteInfoVO.getShdbh()); + drugInvoiceAndDeliveryInfoVO.setDjlx("delivery"); + drugInvoiceAndDeliveryInfoVOList.add(drugInvoiceAndDeliveryInfoVO); + } + } + if (!CollectionUtils.isEmpty(drugInvoiceAndDeliveryInfoVOList)) { + drugInvoiceAndDeliveryInfoVOList.sort((o1, o2) -> o1.getSj().compareTo(o2.getSj())); + } + drugRetraceVO.setDrugInvoiceAndDeliveryInfoVOList(drugInvoiceAndDeliveryInfoVOList); + // 查询零售及使用信息 DrugRetailAndUseInfoVO drugRetailAndUseInfoVO = drugRetailAndUseApplyInfoMapper.selectByYpzsm(searcher.getYpzsm()); drugRetraceVO.setDrugRetailAndUseInfoVO(drugRetailAndUseInfoVO);