Jelajahi Sumber

fix 新增文件

DYH2020 1 tahun lalu
induk
melakukan
f8f9dc6431

+ 5 - 0
ywt-platform-outpatient-common/src/main/java/com/ywt/outpatient/core/Constant.java

@@ -14,4 +14,9 @@ public class Constant {
 
     public static final String PARAM_LIST = "PARAM_LIST";
 
+    /**
+     * 系统异常统一提示语
+     */
+    public static final String ERROR_PROMPT = "网络错误";
+
 }

+ 11 - 2
ywt-platform-outpatient-common/src/main/java/com/ywt/outpatient/core/utils/BizUtil.java

@@ -2,9 +2,12 @@ package com.ywt.outpatient.core.utils;
 
 
 import com.google.gson.JsonObject;
+import com.ywt.biz.common.enums.OrderTypeEnum;
+import com.ywt.biz.common.enums.TerminalEnum;
+import com.ywt.biz.common.util.Checker;
+import com.ywt.biz.common.util.StringHelper;
 import com.ywt.outpatient.domain.models.config.Constants;
-import com.ywt.outpatient.domain.models.enums.OrderTypeEnum;
-import com.ywt.outpatient.domain.models.enums.TerminalEnum;
+import com.ywt.outpatient.service.web.interceptors.WebAppContext;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
@@ -325,4 +328,10 @@ public final class BizUtil {
         }
         return "";
     }
+
+    public static int getCurrentTerminalWrapped() {
+//        return TerminalEnum.NFYYBYFY_WXAPP.getValue();
+//        return TerminalEnum.TaiheWxOfficial.getValue();
+        return WebAppContext.current().getTerminal();
+    }
 }

+ 24 - 0
ywt-platform-outpatient-sdk/src/main/java/com/ywt/outpatient/domain/models/enums/OfflineConsultationSourceEnum.java

@@ -0,0 +1,24 @@
+package com.ywt.outpatient.domain.models.enums;
+
+public enum OfflineConsultationSourceEnum {
+    TAIHE_WX_OFFICIAL("太和医院公众号", 8),
+    SCENE_SCAN("现场扫码", 0),
+    NFYYBYFY_WXAPP("南方医院白云分院小程序", 20),
+    ;
+
+    private final String displayName;
+    private final int value;
+
+    OfflineConsultationSourceEnum(String displayName, int value) {
+        this.displayName = displayName;
+        this.value = value;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public int getValue() {
+        return value;
+    }
+}

+ 694 - 0
ywt-platform-outpatient-sdk/src/main/java/com/ywt/outpatient/service/web/SystemSrv.java

@@ -0,0 +1,694 @@
+package com.ywt.outpatient.service.web;
+
+import com.ywt.gapi.Result;
+import com.ywt.gapi.ResultCode;
+import com.ywt.gapi.base.sms.SmsServiceGrpc;
+import com.ywt.gapi.message.MessageServiceGrpc;
+import com.ywt.gapi.system.*;
+import com.ywt.wapapi.core.structs.TrieTree;
+import com.ywt.wapapi.core.utils.*;
+import com.ywt.wapapi.models.BaseResponse;
+import com.ywt.wapapi.models.ConstantDef;
+import com.ywt.wapapi.models.enums.SmsCodeTypeEnum;
+import com.ywt.wapapi.models.union_reg.HospitalCustomInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import redis.clients.jedis.JedisCommands;
+
+import java.util.*;
+import java.util.concurrent.Callable;
+import java.util.stream.Collectors;
+
+@Service
+public class SystemSrv {
+    private static Logger logger = LoggerFactory.getLogger(SystemSrv.class);
+
+    // 疾病分类列表缓存键
+    private final String ICD_CODE_LIST = "ICD_CODE_LIST";
+    // 医院列表缓存键
+    private final String HOSPITAL_LIST = "HOSPITAL_LIST";
+    // 疾病分类字典树缓存键
+    private final String ICD_CODE_TRIE_TREE = "ICD_CODE_TRIE_TREE";
+
+    @Autowired
+    private JedisCommands jedisCommands;
+
+    @Autowired
+    private SystemServiceGrpc.SystemServiceBlockingStub systemServiceBlockingStub;
+
+    @Autowired
+    private MessageServiceGrpc.MessageServiceBlockingStub messageServiceBlockingStub;
+
+    @Autowired
+    private SmsServiceGrpc.SmsServiceBlockingStub smsServiceBlockingStub;
+
+    /**
+     * 根据名称关键词搜索诊断结果
+     *
+     * @param name 名称
+     * @return
+     */
+    public List<IcdCode> getIcdCodeByName(String name) {
+        List<IcdCode> list = getIcdCodeListFromCache();
+        return list.stream().filter(p -> p.getName().contains(name)).collect(Collectors.toList());
+    }
+
+    /**
+     * 根据名称拼音搜索诊断结果
+     *
+     * @param pinyin 名称拼音
+     * @return
+     */
+    public List<IcdCode> getIcdCodeByPinYin(String pinyin) {
+        if (StringHelper.isNullOrWhiteSpace(pinyin)) {
+            return null;
+        }
+
+        TrieTree<IcdCode> trieTree = getIcdCodeTrieTree();
+        return trieTree.searchByPrefix(pinyin.toUpperCase());
+    }
+
+    /**
+     * @return
+     */
+    public TrieTree<IcdCode> getIcdCodeTrieTree() {
+        try {
+            return (TrieTree<IcdCode>) CacheUtil.getInstance().get(ICD_CODE_TRIE_TREE, new Callable<Object>() {
+                @Override
+                public Object call() throws Exception {
+                    TrieTree<IcdCode> trieTree = new TrieTree<>();
+                    List<IcdCode> lst = getIcdCodeListFromCache();
+                    if (lst == null || lst.size() == 0) {
+                        return trieTree;
+                    }
+                    for (IcdCode code : lst) {
+                        trieTree.insert(code.getPyCode().toUpperCase(), code);
+                    }
+                    return trieTree;
+                }
+            });
+        } catch (Exception e) {
+
+        }
+
+        return new TrieTree<>();
+    }
+
+    public List<IcdCode> getIcdCodeListFromCache() {
+        try {
+            return (List<IcdCode>) CacheUtil.getInstance().get(ICD_CODE_LIST, () -> getIcdCodeList());
+        } catch (Exception e) {
+            logger.error("SystemSrv#getIcdCodeListFromCache():\n {}", e.getMessage(), e);
+        }
+        return new LinkedList<>();
+    }
+
+    public List<IcdCode> getIcdCodeList() {
+        try {
+            GetIcdCodeListRequest req = GetIcdCodeListRequest.newBuilder().build();
+            GetIcdCodeListResponse res = systemServiceBlockingStub.getIcdCodeList(req);
+            Result result = res.getResult();
+
+            if (result.getCode() == ResultCode.SUCCEED) {
+                return res.getCodeList();
+            }
+        } catch (Exception e) {
+            logger.error("getIcdCodeList(): {}", e.getMessage(), e);
+        }
+
+        return new LinkedList<>();
+    }
+
+    /**
+     * 医生团队(展示的)领衔医生所在的一级科室
+     *
+     * @return
+     */
+    public List<Dept> getTeamDeptList() {
+        GetTeamDeptListRequest req = GetTeamDeptListRequest.newBuilder().build();
+        GetTeamDeptListResponse res = systemServiceBlockingStub.getTeamDeptList(req);
+
+        if (res.getCode() == ResultCode.SUCCEED_VALUE) {
+            return res.getDeptList();
+        }
+
+        return new LinkedList<>();
+    }
+
+    /**
+     * 医生团队(展示的)领衔医生所在的一级科室
+     *
+     * @return
+     */
+    public BaseResponse getTeamDeptListRes() {
+        BaseResponse response = new BaseResponse();
+        Map<String, Object> map;
+        List<Map<String, Object>> lst = new LinkedList<>();
+
+        try {
+            GetTeamDeptListRequest req = GetTeamDeptListRequest.newBuilder().build();
+            GetTeamDeptListResponse res = systemServiceBlockingStub.getTeamDeptList(req);
+
+            if (res.getCode() == ResultCode.SUCCEED_VALUE) {
+                for (Dept dept : res.getDeptList()) {
+                    map = new HashMap<>();
+                    map.put("deptId", dept.getDeptId());
+                    map.put("deptName", dept.getDeptName());
+
+                    lst.add(map);
+                }
+
+                Map<String, Object> data = new HashMap<>();
+                data.put("list", lst);
+                return response.succeed(data);
+            }
+
+            return response.failed(BaseResponse.APP_ERROR, res.getMsg());
+        } catch (Exception e) {
+            logger.error("getTeamDeptListRes(): {}", e.getMessage(), e);
+            return response.error();
+        }
+    }
+
+    /**
+     * 获取地区列表(树状结构)
+     *
+     * @return
+     */
+    public BaseResponse getAreaTreeNodeList() {
+        BaseResponse response = new BaseResponse();
+        GetAreaTreeNodeListRequest req = GetAreaTreeNodeListRequest.newBuilder().build();
+        GetAreaTreeNodeListResponse res = systemServiceBlockingStub.getAreaTreeNodeList(req);
+        Result result = res.getResult();
+
+        if (result.getCode() == ResultCode.SUCCEED) {
+            List<Map<String, Object>> lst = getAreaMap(res.getAreaList());
+            Map<String, Object> data = new HashMap<>();
+            data.put("list", lst);
+
+            return response.succeed(data);
+        }
+
+        return response.failed(BaseResponse.APP_ERROR, result.getInfo());
+    }
+
+    private List<Map<String, Object>> getAreaMap(List<TreeNode> nodeList) {
+        List<Map<String, Object>> lst = new LinkedList<>();
+        Map<String, Object> map = null;
+
+        if (nodeList != null && nodeList.size() > 0) {
+            for (TreeNode node : nodeList) {
+                map = new HashMap<>();
+                map.put("parentId", node.getParentId());
+                map.put("id", node.getId());
+                map.put("label", node.getLabel());
+                map.put("children", getAreaMap(node.getChildrenList()));
+
+                lst.add(map);
+            }
+        }
+
+        return lst;
+    }
+
+    /**
+     * 获取科室列表
+     *
+     * @param hospitalId    医院ID
+     * @param subHospitalId 下级医院ID
+     * @return
+     */
+    public BaseResponse getDeptList(int hospitalId, int subHospitalId, String name) {
+        BaseResponse response = new BaseResponse();
+        logger.error("getDeptList():hospitalId:{}, subHospitalId:{}", hospitalId, subHospitalId);
+        try {
+            List<HospitalDept> deptList = null;
+            HospitalDeptListRequest req = HospitalDeptListRequest.newBuilder()
+                    .setHospitalId(hospitalId)
+                    .setSubHospitalId(subHospitalId)
+                    .build();
+            HospitalDeptListResponse res = systemServiceBlockingStub.getHospitalDeptList(req);
+            Result result = res.getResult();
+
+            if (result.getCode() == ResultCode.SUCCEED) {
+                deptList = res.getHospitalDeptListList();
+            }
+
+            if (deptList == null) {
+                return response.failed(BaseResponse.PARAMETER_ERROR, "科室不存在");
+            }
+
+            List<Map<String, Object>> lst = new LinkedList<>();
+
+            if (!Checker.isNone(name)) {
+                for (HospitalDept d : deptList) {
+                   if(d.getDeptName().contains(name)){
+                       Map<String, Object> map = new HashMap<>();
+                       map.put("deptId", d.getDeptId());
+                       map.put("deptCode", d.getDeptCode());
+                       map.put("deptName", d.getDeptName());
+
+                       List<Map<String, Object>> secondList = new LinkedList<>();
+                       for (Dept secDept : d.getDeptListList()) {
+                           Map<String, Object> sec = new HashMap<>();
+                           sec.put("deptId", secDept.getDeptId());
+                           sec.put("deptCode", secDept.getDeptCode());
+                           sec.put("deptName", secDept.getDeptName());
+
+                           secondList.add(sec);
+                       }
+
+                       map.put("secondList", secondList);
+                       lst.add(map);
+                   } else {
+                       List<Dept> filteredSecondDeptList = d.getDeptListList().stream().filter(cd -> Checker.getStringValue(cd.getDeptName()).contains(name)).collect(Collectors.toList());
+                       if (filteredSecondDeptList.size() > 0) {
+                           Map<String, Object> map = new HashMap<>();
+                           map.put("deptId", d.getDeptId());
+                           map.put("deptCode", d.getDeptCode());
+                           map.put("deptName", d.getDeptName());
+
+                           List<Map<String, Object>> secondList = new LinkedList<>();
+                           for (Dept secDept : filteredSecondDeptList) {
+                               Map<String, Object> sec = new HashMap<>();
+                               sec.put("deptId", secDept.getDeptId());
+                               sec.put("deptCode", secDept.getDeptCode());
+                               sec.put("deptName", secDept.getDeptName());
+
+                               secondList.add(sec);
+                           }
+                           map.put("secondList", secondList);
+                           lst.add(map);
+                       }
+                   }
+                }
+            } else {
+                for (HospitalDept d : deptList) {
+                    Map<String, Object> map = new HashMap<>();
+                    map.put("deptId", d.getDeptId());
+                    map.put("deptCode", d.getDeptCode());
+                    map.put("deptName", d.getDeptName());
+
+                    List<Map<String, Object>> secondList = new LinkedList<>();
+                    for (Dept secDept : d.getDeptListList()) {
+                        Map<String, Object> sec = new HashMap<>();
+                        sec.put("deptId", secDept.getDeptId());
+                        sec.put("deptCode", secDept.getDeptCode());
+                        sec.put("deptName", secDept.getDeptName());
+
+                        secondList.add(sec);
+                    }
+
+                    map.put("secondList", secondList);
+                    lst.add(map);
+                }
+            }
+
+            Map<String, Object> data = new HashMap<>();
+            data.put("list", lst);
+
+            return response.succeed("处理成功", data);
+        } catch (Exception e) {
+            logger.error("getDeptList(): {}", e.getMessage());
+            return response.failed(BaseResponse.APP_EXCEPTION, ConstantDef.ERROR_PROMPT);
+        }
+    }
+
+    /**
+     * 获取科室列表(不分级)
+     *
+     * @param hospitalId
+     * @return
+     */
+    public List<Dept> getDeptListByHospitalId(int hospitalId) {
+        DeptListRequest req = DeptListRequest.newBuilder()
+                .setHospitalId(hospitalId)
+                .build();
+        DeptListResponse res = systemServiceBlockingStub.getDeptList(req);
+        Result result = res.getResult();
+
+        if (result.getCode() == ResultCode.SUCCEED) {
+            return res.getDeptListList();
+        }
+
+        return null;
+    }
+
+    /**
+     * 获取科室列表
+     *
+     * @param hospitalId 医院ID
+     * @return
+     */
+    public List<Dept> getDeptList2(int hospitalId) {
+        DeptListRequest request = DeptListRequest.newBuilder().setHospitalId(hospitalId).build();
+        DeptListResponse response = systemServiceBlockingStub.getDeptList(request);
+        Result result = response.getResult();
+
+        if (result.getCode() == ResultCode.SUCCEED) {
+            return response.getDeptListList();
+        }
+
+        return null;
+    }
+
+    /**
+     * 获取科室Map
+     *
+     * @param hospitalId 医院ID
+     * @return
+     */
+    public Map<String, String> getDeptMap(int hospitalId) {
+        Map<String, String> map;
+
+        try {
+            List<Dept> deptList = getDeptList2(hospitalId);
+            map = deptList.stream().collect(
+                    Collectors.toMap(Dept::getDeptCode, Dept::getDeptName, (key1, key2) -> key2));
+        } catch (Exception e) {
+            logger.error("getDeptMap():{}", e.getMessage());
+            map = new HashMap<>();
+        }
+
+        return map;
+    }
+
+    /**
+     * 根据名称关键词搜索诊断结果
+     *
+     * @param name 名称
+     * @return
+     */
+    public List<Hospital> getHospitalListByName(String name) {
+        List<Hospital> list = getHospitalListFromCache();
+        return list.stream().filter(p -> p.getHospitalName().contains(name)).collect(Collectors.toList());
+    }
+
+    public String getHospitalNameById(int hospitalId) {
+        List<Hospital> list = getHospitalListFromCache();
+        Hospital hospital = list.stream().filter(h -> hospitalId == h.getHospitalId()).findFirst().orElse(null);
+        return hospital == null ? "" : Checker.getStringValue(hospital.getHospitalName());
+    }
+
+    public com.ywt.gapi.system.Hospital getHospitalById(int hospitalId) {
+        List<Hospital> list = getHospitalListFromCache();
+       return list.stream().filter(h -> hospitalId == h.getHospitalId()).findFirst().orElse(null);
+    }
+
+    private List<Hospital> getHospitalListFromCache() {
+        try {
+            return (List<Hospital>) CacheUtil.getInstance().get(HOSPITAL_LIST, () -> getHospitalList(1, 1000));
+        } catch (Exception e) {
+            logger.error("getHospitalListFromCache:{}", e.getMessage());
+        }
+        return new LinkedList<>();
+    }
+
+    /**
+     * 找医院
+     *
+     * @param keyWord 关键字,匹配医院名称
+     * @param areaIds 地区id
+     * @return 医院列表
+     */
+    public List<Hospital> findHospitals(String keyWord, String areaIds) {
+        List<Hospital> list = getHospitalListFromCache();
+        if (!StringHelper.isNullOrEmpty(keyWord)) {
+            list = list.stream().filter(hospital -> hospital.getHospitalName().contains(keyWord)).collect(Collectors.toList());
+        }
+        if (!StringHelper.isNullOrEmpty(areaIds)) {
+            String filterOpt = "," + areaIds + ",";
+            list = list.stream().filter(hospital -> hospital.getAreaIds().contains(filterOpt)).collect(Collectors.toList());
+        }
+        return list;
+    }
+
+
+    /**
+     * 根据名称关键词搜索诊断结果
+     * <p>
+     * create by daiyihua
+     *
+     * @param name 名称
+     * @return
+     */
+    public List<Dept> getDeptListByName(String name) {
+        List<Dept> deptList = getDeptList2(0);
+        return deptList.stream().filter(p -> p.getDeptName().contains(name)).collect(Collectors.toList());
+    }
+
+
+    public List<Hospital> getHospitalList(int pageIndex, int pageSize) {
+        HospitalListRequest request = HospitalListRequest.newBuilder()
+                .setPageIndex(pageIndex)
+                .setPageSize(pageSize)
+                .build();
+        HospitalListResponse response = systemServiceBlockingStub.getHospitalList(request);
+        Result result = response.getResult();
+
+        if (result.getCode() == ResultCode.SUCCEED) {
+            return response.getHospitalListList();
+        }
+
+        return null;
+    }
+
+    /**
+     * 获取医院科室列表(按上下级关系返回)
+     *
+     * @param hospitalId 医院Id
+     * @return
+     */
+    public List<HospitalDept> getHospitalDeptList(int hospitalId) {
+        HospitalDeptListRequest request = HospitalDeptListRequest.newBuilder()
+                .setHospitalId(hospitalId)
+                .build();
+        HospitalDeptListResponse response = systemServiceBlockingStub.getHospitalDeptList(request);
+        Result result = response.getResult();
+
+        if (result.getCode() == ResultCode.SUCCEED) {
+            return response.getHospitalDeptListList();
+        }
+
+        return null;
+    }
+
+    /**
+     * 获取微信配置信息
+     *
+     * @return
+     */
+    public WeChatConfig getWeChatConfig() {
+        GetWeChatConfigRequest req = GetWeChatConfigRequest.newBuilder().build();
+        GetWeChatConfigResponse res = systemServiceBlockingStub.getWeChatConfig(req);
+        Result result = res.getResult();
+
+        if (result.getCode() == ResultCode.SUCCEED) {
+            return res.getConfig();
+        }
+
+        return null;
+    }
+
+    private BaseResponse verify(String mobile, int type) {
+        BaseResponse response = new BaseResponse();
+
+        if (!PhoneNumChecker.isPhoneNum(mobile)) {
+            return response.failed(BaseResponse.PARAMETER_ERROR, "手机号码不正确");
+        }
+
+        SmsCodeTypeEnum typeEnum = SmsCodeTypeEnum.valueOf(type);
+
+        if (typeEnum == null) {
+            return response.failed(BaseResponse.PARAMETER_ERROR, "未定义业务类型");
+        }
+
+        return response.succeed();
+    }
+
+
+    /**
+     * 发送自由风格的短信
+     *
+     * @param mobile  手机号
+     * @param type    类型
+     * @param content 短信内容
+     * @return {@link BaseResponse}
+     */
+    public BaseResponse sendSmsFree(String mobile, int type, String content) {
+        BaseResponse response = verify(mobile, type);
+        if (response.getCode() != BaseResponse.SUCCEED) {
+            return response;
+        }
+        try {
+            String smsSign;
+            //根据type指定短信抬头
+            switch (type) {
+                case 1:
+                    smsSign = "南方医务通";
+                    break;
+                default:
+                    smsSign = "南方医务通";
+                    break;
+            }
+            com.ywt.gapi.base.sms.sendSMSFreeRequest req = com.ywt.gapi.base.sms.sendSMSFreeRequest.newBuilder()
+                    .setContent(content.trim())
+                    .setPhoneNumbers(mobile)//手机号,多个手机号为用半角 , 分开,如13899999999,13688888888
+                    .setSmsSign(smsSign)//短信抬头
+                    .build();
+            com.ywt.gapi.base.sms.sendSMSFreeResponse res = smsServiceBlockingStub.sendSMSFree(req);
+            if (res.getCode() == ResultCode.SUCCEED.getNumber()) {
+                return response.succeed(res.getReturnContent());
+            }
+            return response.failed(BaseResponse.OTHER_ERROR, res.getReturnContent());
+        } catch (Exception e) {
+            logger.error(String.format("sendSmsFree(\"%s\", %s)", mobile, type), e);
+            return response.failed(BaseResponse.APP_EXCEPTION, e.getMessage());
+        }
+    }
+
+    /**
+     * 判断该科室是否属于名医诊区(包括一级二级)
+     *
+     * @param deptCode 待判断科室
+     * @return true or false
+     */
+    public boolean checkIsNetDept(String deptCode, int hospitalId) {
+        HospitalDeptListRequest req = HospitalDeptListRequest.newBuilder()
+                .setHospitalId(hospitalId)
+                .build();
+        HospitalDeptListResponse res = systemServiceBlockingStub.getHospitalDeptList(req);
+        if (res.getResult().getCode() == ResultCode.SUCCEED) {
+            List<HospitalDept> hospitalDepts = res.getHospitalDeptListList();
+            List<String> netDeptIds = new LinkedList<>();
+            if (!Checker.isNone(hospitalDepts)) {
+                List<HospitalDept> hdList = hospitalDepts.stream()
+                        .filter(hospitalDept -> BizUtil.getNetDeptCodeListByHospitalId(hospitalId).contains(hospitalDept.getDeptCode())).collect(Collectors.toList());
+                for (HospitalDept hd : hdList) {
+                    netDeptIds.add(hd.getDeptCode());
+                    for (Dept sd : hd.getDeptListList()) {
+                        netDeptIds.add(sd.getDeptCode());
+                    }
+                }
+                return netDeptIds.stream().anyMatch(id -> id.equals(deptCode));
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 只返回需要显示的医院(不带下级医院的医院,和分院)
+     *
+     * @param hospitalIds 一级医院IDs,eg:[12, 41]
+     * @return {@link BaseResponse}
+     */
+    public BaseResponse getHospitalListByHospitalIds(List<Integer> hospitalIds) {
+        BaseResponse response = new BaseResponse();
+        if (Checker.isNone(hospitalIds)) {
+            return response.failedWithParameterError("参数不能为空");
+        }
+        GetHospitalByHospitalIdsRequest req = GetHospitalByHospitalIdsRequest.newBuilder()
+                .addAllHospitalId(hospitalIds)
+                .build();
+        GetHospitalByHospitalIdsResponse res = systemServiceBlockingStub.getHospitalByHospitalIds(req);
+        if (res.getCode() != ResultCode.SUCCEED.getNumber()) {
+            return response.failedWithParameterError(res.getMessage());
+        }
+        List<Map<String, Object>> list = new LinkedList<>();
+        List<Hospital> hospitalList = res.getHospitalList();
+        for (Hospital h : hospitalList) {
+            // 这里只返回不带下级医院的医院(parentId = 0,且没有下级医院),和分院(parentId > 0)
+            long count = 0;
+            // 这里采用排除法,带有下级医院的就一级医院就排除在外
+            if (h.getParentId() == 0) {
+                count = hospitalList.stream().filter(p -> h.getParentId() == p.getParentId()).count();
+            }
+            if (count == 0) {
+                Map<String, Object> map = new HashMap<>();
+                map.put("hospitalId", h.getHospitalId());
+                map.put("hospitalName", h.getHospitalName());
+                map.put("hospitalLogo", h.getLogo());
+                map.put("address", h.getAddress());
+                list.add(map);
+            }
+        }
+        return response.succeed("处理成功", list);
+    }
+
+    /**
+     * 根据 hospitalIds 获取医院或其分医院。如果医院有分院,则返回分院;如果无分院,返回该医院。
+     */
+    public BaseResponse getHospitalListByHospitalIdsNew(List<Integer> hospitalIds) {
+        BaseResponse response = new BaseResponse();
+        if (Checker.isNone(hospitalIds)) {
+            return response.failedWithParameterError("参数不能为空");
+        }
+        GetHospitalByHospitalIdsRequest req = GetHospitalByHospitalIdsRequest.newBuilder()
+                .addAllHospitalId(hospitalIds)
+                .build();
+        GetHospitalByHospitalIdsResponse res = systemServiceBlockingStub.getHospitalByHospitalIds(req);
+        if (res.getCode() != ResultCode.SUCCEED.getNumber()) {
+            return response.failedWithParameterError(res.getMessage());
+        }
+        List<Map<String, Object>> list = new LinkedList<>();
+        List<Hospital> hospitalList = res.getHospitalList();
+        List<Hospital> subHospList = hospitalList.stream().filter(h -> Checker.getIntegerValue(h.getParentId()) > 0).collect(Collectors.toList());
+        Set<Integer> parentHospitalIds = subHospList.stream().map(h -> Checker.getIntegerValue(h.getParentId())).collect(Collectors.toSet());
+        List<Hospital> filteredParentHospitalList = hospitalList.stream().filter(h -> Checker.getIntegerValue(h.getParentId()) == 0 && !parentHospitalIds.contains(h.getHospitalId())).collect(Collectors.toList());
+        for (Hospital h : subHospList) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("hospitalId", h.getParentId());
+            map.put("subHospitalId", h.getHospitalId());
+            map.put("hospitalName", h.getHospitalName());
+            map.put("hospitalLogo", h.getLogo());
+            map.put("address", h.getAddress());
+            HospitalCustomInfo p  = BizUtil.getHospitalCustomInfo(h.getHospitalId());
+            if (p != null) {
+                map.put("alias", p.getAlias());
+                map.put("areaName", p.getAreaName());
+            }
+            list.add(map);
+        }
+        for (Hospital h : filteredParentHospitalList) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("hospitalId", h.getHospitalId());
+            map.put("subHospitalId", 0);
+            map.put("hospitalName", h.getHospitalName());
+            map.put("hospitalLogo", h.getLogo());
+            map.put("address", h.getAddress());
+            HospitalCustomInfo p  = BizUtil.getHospitalCustomInfo(h.getHospitalId());
+            if (p != null) {
+                map.put("alias", p.getAlias());
+                map.put("areaName", p.getAreaName());
+            }
+            list.add(map);
+        }
+        return response.succeed("处理成功", list);
+    }
+
+    public SearchDeptListByNameResponse searchDeptListByName(String key, int hospitalId) {
+        SearchDeptListByNameRequest req = SearchDeptListByNameRequest.newBuilder()
+                .setDeptName(key.trim())
+                .setHospitalId(hospitalId)
+                .build();
+        return systemServiceBlockingStub.searchDeptListByName(req);
+    }
+
+    public SearchDoctorListByNameResponse searchDoctorListByName(String key, int hospitalId) {
+        SearchDoctorListByNameRequest req = SearchDoctorListByNameRequest.newBuilder()
+                .setDoctorName(key.trim())
+                .setHospitalId(hospitalId)
+                .build();
+        return systemServiceBlockingStub.searchDoctorListByName(req);
+    }
+
+    public SearchDoctorListByNameResponse searchDoctorByNameFromMultiHosp(String key, List<Integer> hospitalIds) {
+        SearchDoctorByNameFromMultiHospRequest req = SearchDoctorByNameFromMultiHospRequest.newBuilder()
+                .setDoctorName(key.trim())
+                .addAllHospitalId(hospitalIds)
+                .build();
+        return systemServiceBlockingStub.searchDoctorByNameFromMultiHosp(req);
+    }
+}

+ 284 - 0
ywt-platform-outpatient-sdk/src/main/java/com/ywt/outpatient/service/web/UserSrv.java

@@ -0,0 +1,284 @@
+package com.ywt.outpatient.service.web;
+
+import com.ywt.gapi.Result;
+import com.ywt.gapi.ResultCode;
+import com.ywt.gapi.user.*;
+import com.ywt.wapapi.core.utils.StringHelper;
+import com.ywt.wapapi.models.BaseResponse;
+import com.ywt.wapapi.models.doctor.DoctorInfo;
+import com.ywt.wapapi.models.enums.TerminalEnum;
+import com.ywt.wapapi.web.interceptors.WebAppContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+@Service
+public class UserSrv {
+    private static Logger logger = LoggerFactory.getLogger(UserSrv.class);
+
+    @Autowired
+    private UserServiceGrpc.UserServiceBlockingStub userServiceBlockingStub;
+
+    @Autowired
+    private DoctorServiceGrpc.DoctorServiceBlockingStub doctorServiceBlockingStub;
+
+    /**
+     * 获取当前登录用户Id
+     * <p>
+     * 当前登录终端为互联网医院医生端小程序与公众号(终端值分别为 16、13)时,
+     * 登录用户Id根据当前的 unionid、openid 和 terminal 获取。
+     * 因为前期导入系统的医生手机号大多是已经不用的,部分医生需要
+     * 通过修改 sns_user_info 表的 user_id 字段来实现与旧手机号的账户关联,
+     * 为了使修改后的值能立马生效,故不从网关读取当前用户ID。
+     *
+     * @return 当前登录用户Id
+     */
+    public int getCurrentUserId() {
+        int terminal = getCurrentTerminal();
+        if (terminal == TerminalEnum.TAI_HE_INTERNET_HOSPITAL_DOCTOR_WX_OFFICIAL.getValue() ||
+                terminal == TerminalEnum.DOCTOR_MINI_PROGRAM.getValue()) {
+            try {
+                GetOfficialUserInfoRequest req = GetOfficialUserInfoRequest.newBuilder()
+                        .setUnionId(WebAppContext.current().getUnionId())
+                        .setTerminal(terminal)
+                        .setOpenId(WebAppContext.current().getOpenId())
+                        .build();
+                GetOfficialUserInfoResponse response = userServiceBlockingStub.getOfficialUserInfo(req);
+                if (response.getResult().getCode() == ResultCode.SUCCEED) {
+                    return response.getUserId();
+                }
+            } catch (Exception e) {
+                logger.error("getCurrentUserId(terminal-{}): {}", terminal, e.getMessage(), e);
+            }
+        }
+        return WebAppContext.current().getUserId();
+    }
+
+    /**
+     * 互联网患者端的请求,根据 unionId 获取对应的太和公众号 userId
+     * @return 太和公众号 userId
+     */
+    public int getTaiheUserId() {
+        int currentTerminal = getCurrentTerminal();
+        String openId = getCurrentOpenId();
+        String unionId = getCurrentUnionId();
+        if (currentTerminal == TerminalEnum.TAI_HE_INTERNET_HOSPITAL_PATIENT_MINI_PROGRAM.getValue()) {
+            try {
+                // 根据 unionId & terminal 获取 snsUserInfo
+                GetOfficialUserInfoRequest req = GetOfficialUserInfoRequest.newBuilder()
+                        .setUnionId(unionId)
+                        .setTerminal(TerminalEnum.TaiheWxOfficial.getValue())
+                        .build();
+                GetOfficialUserInfoResponse response = userServiceBlockingStub.getOfficialUserInfo(req);
+                if (response.getResult().getCode() == ResultCode.SUCCEED) {
+                    return response.getUserId();
+                } else {
+                    logger.info("UserSrv#getTaiheUserId(currentTerminal={} , unionId={} , openId={} ):\n获取 OfficialUserInfo 失败:{}",
+                            currentTerminal, unionId, openId, response.getResult().getInfo());
+                }
+            } catch (Exception e) {
+                logger.error("UserSrv#getTaiheUserId(currentTerminal={} , unionId={} , openId={} ):\n {}",
+                        currentTerminal, unionId, openId, e.getMessage(), e);
+            }
+        }
+        // 直接返回当前网关记录的 userId
+        return WebAppContext.current().getUserId();
+    }
+
+    /**
+     * A wrapped method to get cuid, useful for test especially.
+     * @return cuid
+     */
+    public int getCurrentUserIdWrapped() {
+//        return 5;
+         return getCurrentUserId();
+    }
+
+    /**
+     * 当前登录终端
+     *
+     * @return
+     */
+    public int getCurrentTerminal() {
+        return WebAppContext.current().getTerminal();
+//        return TerminalEnum.TAI_HE_INTERNET_HOSPITAL_DOCTOR_WX_OFFICIAL.getValue();
+//        return TerminalEnum.TAI_HE_INTERNET_HOSPITAL_PATIENT_WX_OFFICIAL.getValue();
+//        return TerminalEnum.TAI_HE_INTERNET_HOSPITAL_PATIENT_MINI_PROGRAM.getValue();
+    }
+
+    public String getCurrentOpenId() {
+//        return "odOOe4qFM9V1z_vdoEhGD6c8-l4Y";
+        return WebAppContext.current().getOpenId();
+    }
+
+    public String getCurrentUnionId() {
+//        return "omLSUweHiKFZgoEs-0E0KHk3JOlY";
+        return WebAppContext.current().getUnionId();
+    }
+
+
+    public Result bindWx(String mobile, String unionId, String openId, String ip, TerminalEnum terminalEnum) {
+        BindWxRequest req = BindWxRequest.newBuilder()
+                .setMobile(mobile)
+                .setUnionId(unionId)
+                .setOpenId(openId)
+                .setIp(ip)
+                .setTerminal(terminalEnum.getValue())
+                .build();
+        return userServiceBlockingStub.bindWx(req);
+    }
+
+    public BaseResponse getUserInfoByCode(String code, TerminalEnum terminalEnum) {
+        BaseResponse response = new BaseResponse();
+
+        if (StringHelper.isNullOrWhiteSpace(code)) {
+            return response.failed(BaseResponse.PARAMETER_ERROR, "invalid code");
+        }
+
+        GetUserInfoByCodeRequest req = GetUserInfoByCodeRequest.newBuilder()
+                .setCode(code)
+                .setType(terminalEnum.getValue())
+                .build();
+        GetUserInfoByCodeResponse res = userServiceBlockingStub.getUserInfoByCode(req);
+        Result result = res.getResult();
+
+        if (result.getCode() == ResultCode.SUCCEED) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("unionId", res.getUnionId());
+            map.put("userId", res.getUserId());
+            map.put("openId", res.getOpenId());
+            return response.succeed(map);
+        }
+
+        return response.failed(BaseResponse.PARAMETER_ERROR, result.getInfo());
+    }
+
+    public LoginResponse loginByMobile(String mobile, String ip, int loginType) {
+        LoginByMobileRequest req = LoginByMobileRequest.newBuilder()
+                .setMobile(mobile)
+                .setIp(ip)
+                .setUserType(loginType)
+                .build();
+        return userServiceBlockingStub.loginByMobile(req);
+    }
+
+    public DoctorInfo getDoctorInfo(int doctorId) {
+        DoctorInfo doctorInfo = null;
+
+        try {
+            GetDoctorRequest req = GetDoctorRequest.newBuilder().setDoctorId(doctorId).build();
+            GetDoctorResponse resp = doctorServiceBlockingStub.getDoctor(req);
+            Result result = resp.getResult();
+
+            if (result.getCode() == ResultCode.SUCCEED) {
+                com.ywt.gapi.user.DoctorInfo info = resp.getDoctorInfo();
+                doctorInfo = new com.ywt.wapapi.models.doctor.DoctorInfo();
+                doctorInfo.setDoctorId(info.getDoctorid());
+                doctorInfo.setAvatar(info.getAvatar());
+                doctorInfo.setName(info.getName());
+                doctorInfo.setQrCodeUrl(info.getQrCodeUrl());
+                doctorInfo.setHospitalName(info.getHospital());
+                doctorInfo.setDeptName(info.getDept());
+                doctorInfo.setTitle(info.getTitle());
+                doctorInfo.setSpecialty(info.getSpecialty());
+                doctorInfo.setScheduleStatus(info.getScheduleStatus());
+                doctorInfo.setAuthType(info.getAuthType());
+            }
+        } catch (Exception e) {
+            logger.error("getDoctorInfo({}): {}", doctorId, e.getMessage(), e);
+        }
+        return doctorInfo;
+    }
+
+    public String getCurrentNickName() {
+        String nickName = "";
+        try {
+            GetOfficialUserInfoRequest req = GetOfficialUserInfoRequest.newBuilder()
+                    .setHospitalId(0)
+                    .setUnionId(getCurrentUnionId())
+                    .setTerminal(getCurrentTerminal())
+                    .setOpenId(getCurrentOpenId())
+                    .build();
+            GetOfficialUserInfoResponse response = userServiceBlockingStub.getOfficialUserInfo(req);
+            Result result = response.getResult();
+            if (result.getCode() == ResultCode.SUCCEED) {
+                nickName = response.getNickname();
+            }
+        } catch (Exception e) {
+            logger.error("getCurrentNickName(): {}", e.getMessage(), e);
+        }
+        return nickName;
+    }
+
+//    /**
+//     * 获取当前登录用户信息
+//     *
+//     * @return
+//     */
+//    public LoginInfo getCurrentLoginInfo() {
+//        LoginInfo loginInfo = null;
+//        int currentDoctorId = getCurrentUserId();
+//
+//        if (currentDoctorId > 0) {
+//            try {
+//                if (TerminalEnum.checkDoctorTerminal(getCurrentTerminal())) {
+//                    //医生终端
+//                    GetDoctorRequest req = GetDoctorRequest.newBuilder().setDoctorId(currentDoctorId).build();
+//                    GetDoctorResponse resp = doctorServiceBlockingStub.getDoctor(req);
+//                    Result result = resp.getResult();
+//
+//                    if (result.getCode() == ResultCode.SUCCEED) {
+//                        DoctorInfo info = resp.getDoctorInfo();
+//                        loginInfo = new LoginInfo();
+//                        loginInfo.setUserId(info.getDoctorid());
+//                        loginInfo.setAvatar(info.getAvatar());
+//                        loginInfo.setRealName(info.getName());
+//                        loginInfo.setQrCodeUrl(info.getQrCodeUrl());
+//                        loginInfo.setHospitalName(info.getHospital());
+//                        loginInfo.setDeptName(info.getDept());
+//                        loginInfo.setTitle(info.getTitle());
+//                        loginInfo.setSpecialty(info.getSpecialty());
+//                        loginInfo.setScheduleStatus(info.getScheduleStatus());
+//                        loginInfo.setAuthType(info.getAuthType());
+//                    }
+//                } else {
+//
+//                }
+//            } catch (Exception e) {
+//                logger.error("getCurrentLoginInfo(): {}", e.getMessage(), e);
+//            }
+//        }
+//        return doctorInfo;
+//    }
+
+
+    /**
+     * 根据userId得到当前用户信息
+     *
+     * @return
+     */
+    public User findByUserId() {
+        int userId = getCurrentUserIdWrapped();
+        try {
+            UserRequest req = UserRequest.newBuilder()
+                    .setUserid(userId)
+                    .build();
+            UserResponse resp = userServiceBlockingStub.findByUserId(req);
+            Result result = resp.getResult();
+
+            if (result.getCode() == ResultCode.SUCCEED) {
+                User user = resp.getUser();
+                return user;
+            }
+        } catch (Exception e) {
+            logger.error("findByUserId({}): {}", userId, e.getMessage(), e);
+        }
+        return null;
+    }
+
+}

+ 148 - 0
ywt-platform-outpatient-sdk/src/main/java/com/ywt/outpatient/service/web/interceptors/WebAppContext.java

@@ -0,0 +1,148 @@
+package com.ywt.outpatient.service.web.interceptors;
+
+/**
+ * 保存当前请求与业务相关的信息上下文
+ * 由拦截器层提供信息初始化
+ * Created by huangguoping.
+ */
+public class WebAppContext {
+    private static WebAppContext _webAppContext = null;
+    private static Object _lockObj = new Object();
+
+    private ThreadLocal<Long> _requestStartTime = new ThreadLocal<>();
+    private ThreadLocal<String> _requestID = new ThreadLocal<>();
+    private ThreadLocal<String> _ip = new ThreadLocal<>();
+    private ThreadLocal<String> _tokenid = new ThreadLocal<>();
+    private ThreadLocal<String> _unionId = new ThreadLocal<>();
+    private ThreadLocal<String> _openId = new ThreadLocal<>();
+    private ThreadLocal<Integer> _userId = new ThreadLocal<>();
+    private ThreadLocal<Integer> _doctorId = new ThreadLocal<>();
+    private ThreadLocal<String> _doctorName = new ThreadLocal<>();
+    private ThreadLocal<Integer> _terminal = new ThreadLocal<>();
+    private ThreadLocal<String> _gwProtocol = new ThreadLocal<>();
+    private ThreadLocal<String> _gwAuthAppid = new ThreadLocal<>();
+
+    private WebAppContext(){
+    }
+
+    public long getRequestStartTime(){
+        return _requestStartTime.get() == null ? 0L : _requestStartTime.get();
+    }
+
+    protected void setRequestStartTime(long time){
+        _requestStartTime.set(time);
+    }
+
+    public String getRequestID(){
+        return _requestID.get() == null ? "" : _requestID.get();
+    }
+
+    protected void setRequestID(String id){
+        _requestID.set(id);
+    }
+
+    public String getIP(){
+        return  _ip.get() == null ? "" : _ip.get();
+    }
+    protected void setIP(String ip){
+        _ip.set(ip);
+    }
+
+    public String getUnionId() {
+        return _unionId.get() == null ? "" : _unionId.get();
+    }
+
+    protected void setUnionId(String unionId){
+        _unionId.set(unionId);
+    }
+
+    public String getOpenId() {
+        return _openId.get() == null ? "" : _openId.get();
+    }
+
+    protected void setOpenId(String openId){
+        _openId.set(openId);
+    }
+
+    public Integer getUserId() {
+        return _userId.get() == null ? 0 : _userId.get();
+    }
+
+    protected void setUserId(Integer userId){
+        _userId.set(userId);
+    }
+
+    public Integer getDoctorId(){
+        return _doctorId.get() == null ? 0 : _doctorId.get();
+    }
+
+    public void setDoctorId(Integer doctorId){
+        _doctorId.set(doctorId);
+    }
+
+    public String getTokenID() {
+        return _tokenid.get() == null ? "" : _tokenid.get();
+    }
+
+    protected void setTokenID(String tokenID){
+        _tokenid.set(tokenID);
+    }
+
+    public String getDoctorName(){
+        return _doctorName.get() == null ? "" : _doctorName.get();
+    }
+
+    protected void setDoctorName(String doctorName){
+        _doctorName.set(doctorName);
+    }
+
+    public Integer getTerminal() {
+        return _terminal.get() == null ? 0 : _terminal.get();
+    }
+
+    protected void setTerminal(Integer terminal) {
+        this._terminal.set(terminal);
+    }
+
+    public String getGWProtocol() {
+        return _gwProtocol.get() == null ? "" : _gwProtocol.get();
+    }
+
+    protected void setGWProtocol(String protocol){
+        _gwProtocol.set(protocol);
+    }
+
+    protected void setGWAuthAppid(String appid){
+        this._gwAuthAppid.set(appid);
+    }
+
+    public String getGWAuthAppid(){
+        return this._gwAuthAppid.get();
+    }
+
+    protected void init(){
+        _requestStartTime.set(0L);
+        _requestID.set("");
+        _ip.set("");
+        _tokenid.set("");
+        _unionId.set("");
+        _openId.set("");
+        _userId.set(0);
+        _doctorId.set(0);
+        _doctorName.set("");
+        _terminal.set(0);
+        _gwProtocol.set("");
+        _gwAuthAppid.set("");
+    }
+
+    public static WebAppContext current(){
+        if (_webAppContext == null){
+            synchronized (_lockObj){
+                if (_webAppContext == null){
+                    _webAppContext = new WebAppContext();
+                }
+            }
+        }
+        return _webAppContext;
+    }
+}

+ 87 - 0
ywt-platform-outpatient-sdk/src/main/java/com/ywt/outpatient/service/web/patient/UserService.java

@@ -0,0 +1,87 @@
+package com.ywt.outpatient.service.web.patient;
+
+import com.ywt.gapi.Result;
+import com.ywt.gapi.ResultCode;
+import com.ywt.gapi.user.GetOfficialUserInfoRequest;
+import com.ywt.gapi.user.GetOfficialUserInfoResponse;
+import com.ywt.wapapi.core.utils.StringHelper;
+import com.ywt.wapapi.models.PatientLoginInfo;
+import com.ywt.wapapi.models.enums.TerminalEnum;
+import com.ywt.wapapi.web.interceptors.WebAppContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import redis.clients.jedis.JedisCommands;
+
+@Service
+public class UserService {
+    private static Logger logger = LoggerFactory.getLogger(UserService.class);
+
+    @Autowired
+    private UserServiceGrpc.UserServiceBlockingStub userServiceBlockingStub;
+
+    @Autowired
+    private JedisCommands jedisCommands;
+
+    /**
+     * 获取当前登录用户的UserId
+     *
+     * @return
+     */
+    public int getCurrentUserId() {
+        PatientLoginInfo loginInfo = getPatientLoginInfo();
+        return loginInfo != null ? loginInfo.getUserId() : 0;
+    }
+
+    /**
+     * 获取当前登录用户的OpenId
+     *
+     * @return
+     */
+    public String getCurrentOpenId() {
+        return WebAppContext.current().getOpenId();
+    }
+
+    public PatientLoginInfo getPatientLoginInfo() {
+        PatientLoginInfo loginInfo = null;
+//        String unionId = WebAppContext.current().getUnionId();
+        String openId = WebAppContext.current().getOpenId();
+
+        if (!StringHelper.isNullOrWhiteSpace(openId)) {
+            GetOfficialUserInfoRequest req = GetOfficialUserInfoRequest.newBuilder()
+                    .setHospitalId(0)
+                    .setOpenId(openId)
+//                    .setUnionId(unionId)
+                    .setTerminal(TerminalEnum.PatientWxOfficial.getValue())
+                    .build();
+            GetOfficialUserInfoResponse res = userServiceBlockingStub.getOfficialUserInfo(req);
+            Result result = res.getResult();
+
+            if (result.getCode() == ResultCode.SUCCEED) {
+                loginInfo = new PatientLoginInfo();
+                loginInfo.setUserId(res.getUserId());
+                loginInfo.setMobile(res.getMobile());
+                loginInfo.setUnionId(res.getUnionId());
+            }
+        }
+
+//        loginInfo  = new PatientLoginInfo();
+//        loginInfo.setUserId(8);
+//        loginInfo.setMobile("15817163240");
+//        loginInfo.setUnionId("");
+
+        return loginInfo;
+    }
+
+    /**
+     * 获取当前登录用户的UserId
+     *
+     * @return
+     */
+    public int getCurrentTerminal() {
+        return WebAppContext.current().getTerminal();
+    }
+
+
+}

+ 7 - 2
ywt-platform-outpatient-web/pom.xml

@@ -20,11 +20,17 @@
         <dependency>
             <groupId>com.ywt</groupId>
             <artifactId>ywt-biz-common</artifactId>
+            <!--   <version>${service.version}</version>-->
+        </dependency>
+        <dependency>
+            <groupId>com.ywt</groupId>
+            <artifactId>ywt-platform-outpatient-common</artifactId>
+            <!--  <version>${service.version}</version>-->
         </dependency>
         <dependency>
             <groupId>com.ywt</groupId>
             <artifactId>ywt-platform-internethospital-base</artifactId>
-            <version>${service.version}</version>
+            <!--  <version>${service.version}</version>-->
         </dependency>
         <dependency>
             <groupId>org.apache.dubbo</groupId>
@@ -39,7 +45,6 @@
         <dependency>
             <groupId>com.ywt</groupId>
             <artifactId>ywt-platform-outpatient-base</artifactId>
-            <version>${service.version}</version>
         </dependency>
 
         <dependency>

+ 17 - 2
ywt-platform-outpatient-web/src/main/java/com/ywt/outpatient/controllers/TaiheRegisterController.java

@@ -1,15 +1,30 @@
 package com.ywt.outpatient.controllers;
 
+import com.ywt.biz.common.enums.PaymentChannelEnum;
+import com.ywt.biz.common.enums.SexEnum;
+import com.ywt.biz.common.enums.TerminalEnum;
+import com.ywt.biz.common.util.Checker;
+import com.ywt.biz.common.util.DateUtil;
 import com.ywt.biz.common.util.StringHelper;
 import com.ywt.gapi.Result;
 import com.ywt.gapi.ResultCode;
 import com.ywt.gapi.offline.CreateOfflineConsultationRequest;
 import com.ywt.gapi.offline.CreateOfflineConsultationResponse;
+import com.ywt.gapi.offline.OfflineConsultingService;
 import com.ywt.gapi.offline.OfflineConsultingServiceGrpc;
 import com.ywt.gapi.taihe.register.*;
 import com.ywt.gapi.user.GetOfficialUserInfoRequest;
 import com.ywt.gapi.user.GetOfficialUserInfoResponse;
+import com.ywt.gapi.user.UserService;
 import com.ywt.gapi.user.UserServiceGrpc;
+import com.ywt.outpatient.core.BaseResponse;
+import com.ywt.outpatient.core.utils.BizUtil;
+import com.ywt.outpatient.core.utils.CheckUtil;
+import com.ywt.outpatient.domain.models.enums.DatePeriodEnum;
+import com.ywt.outpatient.domain.models.enums.OfflineConsultationSourceEnum;
+import com.ywt.outpatient.service.web.SystemSrv;
+import com.ywt.outpatient.service.web.UserSrv;
+import com.ywt.outpatient.service.web.interceptors.WebAppContext;
 import com.ywt.wapapi.core.utils.*;
 import com.ywt.wapapi.models.BaseResponse;
 import com.ywt.wapapi.models.enums.*;
@@ -59,7 +74,7 @@ public class TaiheRegisterController {
     private SystemSrv systemSrv;
 
     @Autowired
-    private UserService userService;
+    private com.ywt.outpatient.service.web.patient.UserService userService;
 
     @Autowired
     private JedisCommands jedisCommands;
@@ -149,7 +164,7 @@ public class TaiheRegisterController {
         try {
             int total = registeredFee + medicalFee;
             int paymentChannel = total > 0
-                    ? PaymentChannelEnum.WX_PAY.getValue()
+                    ? PaymentChannelEnum.WeChat.getValue()
                     : PaymentChannelEnum.FREE.getValue();
             int source;
             int terminal = WebAppContext.current().getTerminal();

+ 4 - 1
ywt-platform-outpatient-web/src/main/java/com/ywt/outpatient/controllers/YiDaController.java

@@ -7,6 +7,9 @@ import com.ywt.gapi.ResultCode;
 import com.ywt.gapi.nfyy.*;
 import com.ywt.gapi.nfyy.Doctor;
 import com.ywt.gapi.system.*;
+import com.ywt.outpatient.core.BaseResponse;
+import com.ywt.outpatient.core.Constant;
+import com.ywt.outpatient.domain.models.ConstantDef;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -173,7 +176,7 @@ public class YiDaController {
             return response.failed(BaseResponse.APP_ERROR, "数据暂时无法处理数据,请稍后重试");
         } catch (Exception e) {
             logger.error("recommend():{}", e.getMessage(), e);
-            return response.failed(BaseResponse.APP_EXCEPTION, ConstantDef.ERROR_PROMPT);
+            return response.failed(BaseResponse.APP_EXCEPTION, Constant.ERROR_PROMPT);
         }
     }