| 
					
				 | 
			
			
				@ -2,6 +2,7 @@ package com.yihu.jw.base.service.saas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.dao.saas.SaasBusinessCardDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.service.doctor.BaseDoctorService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.base.service.patient.BasePatientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.saas.SaasBusinessCardDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -13,25 +14,38 @@ import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Service - SAAS名片 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by progr1mmer on 2018/9/7. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * @author progr1mmer 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * @date Created on 2018/9/7. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class SaasBusinessCardService extends BaseJpaService<SaasBusinessCardDO, SaasBusinessCardDao> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorService doctorService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientService basePatientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> generateBusinessCard(SaasBusinessCardDO.Type type, String saasId, String id) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 此接口配置的字段应和实体的字段名相同 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param saasId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param sourceId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> generateBusinessCard(SaasBusinessCardDO.Type type, String saasId, String sourceId, String orgId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SaasBusinessCardDO> saasBusinessCardDO = search("type=" + type  + ";saasId=" + saasId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> card = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (type == SaasBusinessCardDO.Type.doctor) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //模拟加载医生数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> source = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> source = doctorService.getDoctorInfo(orgId, sourceId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saasBusinessCardDO.forEach(item -> card.put(item.getField(), source.get(item.getField()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return card; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (type == SaasBusinessCardDO.Type.patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //模拟加载居民数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> source = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, Object> source = basePatientService.getPatientInfo(sourceId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            saasBusinessCardDO.forEach(item -> card.put(item.getField(), source.get(item.getField()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return card; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 |