|  | @@ -5,6 +5,7 @@ import cn.hnthyy.thmz.entity.MzException;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.entity.his.YzActOrder;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.entity.his.mz.Employee;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
 | 
	
		
			
				|  |  | +import cn.hnthyy.thmz.entity.his.yp.YpYzSendRecord;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.entity.his.yz.*;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.entity.his.zd.ZdCommon;
 | 
	
	
		
			
				|  | @@ -15,6 +16,7 @@ import cn.hnthyy.thmz.mapper.his.mz.EmployeeMapper;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.mapper.his.mz.MzPharmacyMapper;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.mapper.his.yp.YpBaseYfMapper;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.mapper.his.yp.YpMzFytjMapper;
 | 
	
		
			
				|  |  | +import cn.hnthyy.thmz.mapper.his.yp.YpYzSendRecordMapper;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.mapper.his.yp.YpZdManufactoryMapper;
 | 
	
		
			
				|  |  |  import cn.hnthyy.thmz.mapper.his.yz.*;
 | 
	
	
		
			
				|  | @@ -125,6 +127,9 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
 | 
	
		
			
				|  |  |      @SuppressWarnings("all")
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private YzSequenceService yzSequenceService;
 | 
	
		
			
				|  |  | +    @SuppressWarnings("all")
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private YpYzSendRecordMapper ypYzSendRecordMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public List<YzYpPageNoVo> queryYzYpPageNo(YzYpPageNoVo yzYpPageNoVo) {
 | 
	
	
		
			
				|  | @@ -364,7 +369,7 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
 | 
	
		
			
				|  |  |                  .collect(Collectors.toMap(YzYpZyOrder::getChargeCode,YzYpZyOrder::getManuNo,(k1,k2)->k2));
 | 
	
		
			
				|  |  |          Date now = new Date();
 | 
	
		
			
				|  |  |          String[] pageNos = pageNo.split("/");
 | 
	
		
			
				|  |  | -        List<YzYpZyOrder> yyzos;
 | 
	
		
			
				|  |  | +        List<YzYpZyOrder> yyzos = null;
 | 
	
		
			
				|  |  |          int count = 0;
 | 
	
		
			
				|  |  |          for (int j = 0; j < pageNos.length; j++) {
 | 
	
		
			
				|  |  |              List<YpZyPatient> ypZyPatients = new ArrayList<>();
 | 
	
	
		
			
				|  | @@ -576,11 +581,50 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
 | 
	
		
			
				|  |  |                  resultMap.put("data", ypZyPatients);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 发药记录存根日志,以备查验记录
 | 
	
		
			
				|  |  | +        if(yyzos != null && yyzos.size() > 0){
 | 
	
		
			
				|  |  | +            // 目前开放长期,临时医嘱单存放日志
 | 
	
		
			
				|  |  | +            if("5".equals(yyzos.get(0).getPageClass()) || "6".equals(yyzos.get(0).getPageClass())){
 | 
	
		
			
				|  |  | +                List<YzYpZyOrder> yzYpList = new ArrayList<>(yyzos);
 | 
	
		
			
				|  |  | +                try {
 | 
	
		
			
				|  |  | +                    callSaveSendOrPrintYpYzDetail(yzYpList, "1");
 | 
	
		
			
				|  |  | +                } catch (Exception e) {
 | 
	
		
			
				|  |  | +                    log.error("发药记录存根日志出错--1");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          resultMap.put("code", 0);
 | 
	
		
			
				|  |  |          resultMap.put("message", "保存领药单发药数据成功");
 | 
	
		
			
				|  |  |          return resultMap;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * @description: 药品发药医嘱记录表: 记录发药或打印时药品明细信息
 | 
	
		
			
				|  |  | +     * @author: hsh 
 | 
	
		
			
				|  |  | +     * @date: 2023/8/2 10:15
 | 
	
		
			
				|  |  | +     * @param: [yzYpList, status] status: 1 发药  2 打印
 | 
	
		
			
				|  |  | +     * @return: void
 | 
	
		
			
				|  |  | +     **/
 | 
	
		
			
				|  |  | +    public void callSaveSendOrPrintYpYzDetail(List<YzYpZyOrder> yzYpList, String status) {
 | 
	
		
			
				|  |  | +        if(yzYpList != null && yzYpList.size() > 0){
 | 
	
		
			
				|  |  | +            List<YpYzSendRecord> list = new ArrayList<>();
 | 
	
		
			
				|  |  | +            for(YzYpZyOrder yzYpZyOrder : yzYpList){
 | 
	
		
			
				|  |  | +                String uuid = UUID.randomUUID().toString();
 | 
	
		
			
				|  |  | +                Date now = new Date();
 | 
	
		
			
				|  |  | +                YpYzSendRecord record = new YpYzSendRecord();
 | 
	
		
			
				|  |  | +                BeanUtils.copyProperties(yzYpZyOrder, record);
 | 
	
		
			
				|  |  | +                record.setNbId(uuid);
 | 
	
		
			
				|  |  | +                record.setSysDate(now);
 | 
	
		
			
				|  |  | +                record.setRecordType(status);
 | 
	
		
			
				|  |  | +                // 已发药
 | 
	
		
			
				|  |  | +                record.setStatusFlag("0");
 | 
	
		
			
				|  |  | +                list.add(record);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            ypYzSendRecordMapper.insertYpYzSendRecordList(list);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public Map<String, Object> sendZyWard(String pageNo, String userCode, Integer isTy) throws MzException {
 | 
	
	
		
			
				|  | @@ -935,6 +979,25 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
 | 
	
		
			
				|  |  |                  i--;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 保存口服药打印查询记录信息
 | 
	
		
			
				|  |  | +        if(yfWardVos.size() > 0){
 | 
	
		
			
				|  |  | +            // 目前开放长期,临时医嘱单存放日志
 | 
	
		
			
				|  |  | +            if("5".equals(yfWardVos.get(0).getPageClass()) || "6".equals(yfWardVos.get(0).getPageClass())){
 | 
	
		
			
				|  |  | +                List<YzYpZyOrder> yzYpList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                for (YfWardVo vo: yfWardVos) {
 | 
	
		
			
				|  |  | +                    YzYpZyOrder yz = new YzYpZyOrder();
 | 
	
		
			
				|  |  | +                    BeanUtils.copyProperties(vo, yz);
 | 
	
		
			
				|  |  | +                    yzYpList.add(yz);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                try {
 | 
	
		
			
				|  |  | +                    callSaveSendOrPrintYpYzDetail(yzYpList, "2");
 | 
	
		
			
				|  |  | +                } catch (Exception e) {
 | 
	
		
			
				|  |  | +                    log.error("发药打印存根日志出错--2");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          return yfWardVos;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |