|  |  | @ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.collection.CollUtil; |  |  |  | import cn.hutool.core.collection.CollUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.util.StrUtil; |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.res.BaseResponse; |  |  |  | import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.util.ResultVOUtils; |  |  |  | import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.BusTypeConstant; |  |  |  | import com.glxp.api.constant.BusTypeConstant; | 
			
		
	
	
		
		
			
				
					|  |  | @ -13,11 +14,13 @@ import com.glxp.api.entity.basic.BasicProductsEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.basic.UdiRelevanceEntity; |  |  |  | import com.glxp.api.entity.basic.UdiRelevanceEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.collect.IoCollectOrder; |  |  |  | import com.glxp.api.entity.collect.IoCollectOrder; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.collect.IoCollectOrderBiz; |  |  |  | import com.glxp.api.entity.collect.IoCollectOrderBiz; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.http.ErpBasicClient; |  |  |  | import com.glxp.api.http.ErpBasicClient; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.basic.GetSickPrescribeRequest; |  |  |  | import com.glxp.api.req.basic.GetSickPrescribeRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.collect.CollectOrderRequest; |  |  |  | import com.glxp.api.req.collect.CollectOrderRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.thrsys.FilterThrOrderRequest; |  |  |  | import com.glxp.api.req.thrsys.FilterThrOrderRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.PageSimpleResponse; |  |  |  | import com.glxp.api.res.PageSimpleResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.thrsys.impl.ThrBusTypeOriginServiceImpl; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.IntUtil; |  |  |  | import com.glxp.api.util.IntUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import lombok.extern.slf4j.Slf4j; |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.apache.commons.lang3.exception.ExceptionUtils; |  |  |  | import org.apache.commons.lang3.exception.ExceptionUtils; | 
			
		
	
	
		
		
			
				
					|  |  | @ -65,6 +68,8 @@ public class DownloadFactory { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     private ErpBasicClient erpBasicClient; |  |  |  |     private ErpBasicClient erpBasicClient; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private ThrBusTypeOriginServiceImpl thrBusTypeOriginService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public BaseResponse downloadErpOrder(CollectOrderRequest collectOrderRequest, String busType) { |  |  |  |     public BaseResponse downloadErpOrder(CollectOrderRequest collectOrderRequest, String busType) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -80,6 +85,20 @@ public class DownloadFactory { | 
			
		
	
		
		
			
				
					
					|  |  |  |         getSickPrescribeRequest.setEndTime(collectOrderRequest.getEndTime()); |  |  |  |         getSickPrescribeRequest.setEndTime(collectOrderRequest.getEndTime()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         getSickPrescribeRequest.setKey(collectOrderRequest.getKeyWords()); |  |  |  |         getSickPrescribeRequest.setKey(collectOrderRequest.getKeyWords()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         getSickPrescribeRequest.setBusType(collectOrderRequest.getBusType()); |  |  |  |         getSickPrescribeRequest.setBusType(collectOrderRequest.getBusType()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ThrBusTypeOriginEntity thrBusTypeOriginEntity = thrBusTypeOriginService.getOne( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 new QueryWrapper<ThrBusTypeOriginEntity>().eq("action",collectOrderRequest.getBusType()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         .last("limit 1") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(thrBusTypeOriginEntity!=null){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //todo 因为这边之前单据据都是设置1 第三方那边判断是0 所有为了不影响其他医院流0和1 都设置为0好让第三方使用
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // 判断是不是处方退费
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             Integer inOutType =  IntUtil.value(thrBusTypeOriginEntity.getInoutType()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if(inOutType == 0 || inOutType ==1){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 getSickPrescribeRequest.setInOutType(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             }else{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 getSickPrescribeRequest.setInOutType(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         while (true) { |  |  |  |         while (true) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoCollectOrder> list; |  |  |  |             List<IoCollectOrder> list; | 
			
		
	
		
		
			
				
					
					|  |  |  |             try { |  |  |  |             try { | 
			
		
	
	
		
		
			
				
					|  |  | @ -166,6 +185,9 @@ public class DownloadFactory { | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @param collectOrderRequest |  |  |  |      * @param collectOrderRequest | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     public BaseResponse importThrOrder(List<IoCollectOrder> thrOrderEntities, CollectOrderRequest collectOrderRequest) { |  |  |  |     public BaseResponse importThrOrder(List<IoCollectOrder> thrOrderEntities, CollectOrderRequest collectOrderRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<IoCollectOrder> ioCollectOrderList = new ArrayList<>(); |  |  |  |         List<IoCollectOrder> ioCollectOrderList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (CollUtil.isNotEmpty(thrOrderEntities)) { |  |  |  |         if (CollUtil.isNotEmpty(thrOrderEntities)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (IoCollectOrder thrOrder : thrOrderEntities) { |  |  |  |             for (IoCollectOrder thrOrder : thrOrderEntities) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -180,7 +202,6 @@ public class DownloadFactory { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ioCollectOrder.setUpdateTime(new Date()); |  |  |  |                 ioCollectOrder.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ioCollectOrder.setSplitStatus(0); |  |  |  |                 ioCollectOrder.setSplitStatus(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ioCollectOrder.setTagStatus(0); |  |  |  |                 ioCollectOrder.setTagStatus(0); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<IoCollectOrderBiz> bizList = new ArrayList<>(); |  |  |  |                 List<IoCollectOrderBiz> bizList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (IoCollectOrderBiz entity : thrOrder.getBizList()) { |  |  |  |                 for (IoCollectOrderBiz entity : thrOrder.getBizList()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     IoCollectOrderBiz collectOrderBiz = new IoCollectOrderBiz(); |  |  |  |                     IoCollectOrderBiz collectOrderBiz = new IoCollectOrderBiz(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -242,6 +263,10 @@ public class DownloadFactory { | 
			
		
	
		
		
			
				
					
					|  |  |  |             collectOrderService.importPrescribe(ioCollectOrderList, collectOrderRequest); |  |  |  |             collectOrderService.importPrescribe(ioCollectOrderList, collectOrderRequest); | 
			
		
	
		
		
			
				
					
					|  |  |  |             return ResultVOUtils.success("下载成功"); |  |  |  |             return ResultVOUtils.success("下载成功"); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         }catch (Exception e){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             log.error("12312"+e.getMessage()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.error("下载失败"); |  |  |  |         return ResultVOUtils.error("下载失败"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |