Browse Source

SAAS名片完善

suxiaoyang 6 năm trước cách đây
mục cha
commit
980d8031a1

+ 4 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/saas/SaasBusinessCardDO.java

@ -8,6 +8,10 @@ import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * <p>
 *     field - 必须和对应实体的字段名相同
 * </p>
 *
 * Entity - SAAS名片
 * Created by progr1mmer on 2018/9/7.
 */

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/activemq/ConsumerRunner.java

@ -15,6 +15,7 @@ import java.util.Set;
/**
 * Runner - 消息执行者
 * Created by progr1mmer on 2018/8/2.
 * @author progr1mmer
 */
public class ConsumerRunner implements Runnable, ExceptionListener {

+ 4 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasBusinessCardEndpoint.java

@ -103,8 +103,10 @@ public class SaasBusinessCardEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "saasId", value = "SAAS ID", required = true)
            @RequestParam(value = "saasId") String saasId,
            @ApiParam(name = "sourceId", value = "实体对象ID,如医生、居民", required = true)
            @RequestParam(value = "sourceId") String sourceId) throws Exception {
        Map<String, Object> card = saasBusinessCardService.generateBusinessCard(type, saasId, sourceId);
            @RequestParam(value = "sourceId") String sourceId,
            @ApiParam(name = "orgId", value = "机构编码")
            @RequestParam(value = "orgId", required = false) String orgId) throws Exception {
        Map<String, Object> card = saasBusinessCardService.generateBusinessCard(type, saasId, sourceId, orgId);
        return success(card);
    }

+ 18 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasBusinessCardService.java

@ -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;
        }