瀏覽代碼

分诊操作保存

wangfeng 5 年之前
父節點
當前提交
dcbd69759c
共有 44 個文件被更改,包括 2187 次插入10 次删除
  1. 30 0
      tran-service/src/main/java/com/diagbot/dto/SaveInquiryTriageDTO.java
  2. 67 0
      tran-service/src/main/java/com/diagbot/entity/Client.java
  3. 47 0
      tran-service/src/main/java/com/diagbot/entity/Constants.java
  4. 7 6
      tran-service/src/main/java/com/diagbot/entity/InquiryTriage.java
  5. 53 0
      tran-service/src/main/java/com/diagbot/entity/JSONResponseBean.java
  6. 142 0
      tran-service/src/main/java/com/diagbot/entity/Request.java
  7. 120 0
      tran-service/src/main/java/com/diagbot/entity/Response.java
  8. 29 0
      tran-service/src/main/java/com/diagbot/entity/SystemHeader.java
  9. 94 0
      tran-service/src/main/java/com/diagbot/facade/InquiryTriageFacade.java
  10. 95 0
      tran-service/src/main/java/com/diagbot/util/AESUtils.java
  11. 139 0
      tran-service/src/main/java/com/diagbot/util/JSONUtils.java
  12. 118 0
      tran-service/src/main/java/com/diagbot/util/MessageDigestUtil.java
  13. 118 0
      tran-service/src/main/java/com/diagbot/util/OpenApiUtils.java
  14. 126 0
      tran-service/src/main/java/com/diagbot/util/SignUtil.java
  15. 21 0
      tran-service/src/main/java/com/diagbot/vo/SaveDisDeptVO.java
  16. 51 0
      tran-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java
  17. 36 4
      tran-service/src/main/java/com/diagbot/web/InquiryTriageController.java
  18. 10 0
      triage-service/pom.xml
  19. 38 0
      triage-service/src/main/java/com/diagbot/client/TranServiceClient.java
  20. 65 0
      triage-service/src/main/java/com/diagbot/client/hystrix/TranServiceHystrix.java
  21. 22 0
      triage-service/src/main/java/com/diagbot/dto/HospItemDTO.java
  22. 18 0
      triage-service/src/main/java/com/diagbot/dto/HospNameDTO.java
  23. 22 0
      triage-service/src/main/java/com/diagbot/dto/OptDTO.java
  24. 25 0
      triage-service/src/main/java/com/diagbot/dto/OptHospDTO.java
  25. 16 0
      triage-service/src/main/java/com/diagbot/dto/PVDTO.java
  26. 18 0
      triage-service/src/main/java/com/diagbot/dto/PVHospDTO.java
  27. 17 0
      triage-service/src/main/java/com/diagbot/dto/PVHospSumDTO.java
  28. 30 0
      triage-service/src/main/java/com/diagbot/dto/SaveInquiryTriageDTO.java
  29. 16 0
      triage-service/src/main/java/com/diagbot/dto/UVDTO.java
  30. 18 0
      triage-service/src/main/java/com/diagbot/dto/UVHospDTO.java
  31. 17 0
      triage-service/src/main/java/com/diagbot/dto/UVHospSumDTO.java
  32. 16 0
      triage-service/src/main/java/com/diagbot/dto/ZZDTO.java
  33. 18 0
      triage-service/src/main/java/com/diagbot/dto/ZZHospDTO.java
  34. 17 0
      triage-service/src/main/java/com/diagbot/dto/ZZHospSumDTO.java
  35. 30 0
      triage-service/src/main/java/com/diagbot/facade/InquiryTriageFacade.java
  36. 94 0
      triage-service/src/main/java/com/diagbot/facade/OptInfoFacade.java
  37. 23 0
      triage-service/src/main/java/com/diagbot/vo/HospitalVO.java
  38. 38 0
      triage-service/src/main/java/com/diagbot/vo/OptHospPageVO.java
  39. 37 0
      triage-service/src/main/java/com/diagbot/vo/OptHospVO.java
  40. 37 0
      triage-service/src/main/java/com/diagbot/vo/OptVO.java
  41. 21 0
      triage-service/src/main/java/com/diagbot/vo/SaveDisDeptVO.java
  42. 51 0
      triage-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java
  43. 52 0
      triage-service/src/main/java/com/diagbot/web/InquiryTriageController.java
  44. 128 0
      triage-service/src/main/java/com/diagbot/web/OptInfoController.java

+ 30 - 0
tran-service/src/main/java/com/diagbot/dto/SaveInquiryTriageDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangfeng
+ * @time: 2020/3/23 10:56
+ */
+@ApiModel(value = "分诊记录保存接口出参")
+@Getter
+@Setter
+public class SaveInquiryTriageDTO {
+
+    /**
+     * 纳里返回的url
+     */
+    @ApiModelProperty(value = "纳里返回的url")
+    private String body;
+
+    private String response;
+
+    private String request;
+
+    private String requestBodys;
+
+}

+ 67 - 0
tran-service/src/main/java/com/diagbot/entity/Client.java

@@ -0,0 +1,67 @@
+
+package com.diagbot.entity;
+
+import com.diagbot.util.AESUtils;
+import com.diagbot.util.JSONUtils;
+import com.diagbot.util.MessageDigestUtil;
+import com.diagbot.util.OpenApiUtils;
+import com.diagbot.util.SignUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.UUID;
+
+/**
+ * Client
+ */
+public class Client {
+
+    private String apiUrl;
+    private String appKey;
+    private String appSecret;
+    private String encodingAesKey;
+
+    public Client(String apiUrl, String appKey, String appSecret, String encodingAesKey) {
+        this.apiUrl = apiUrl;
+        this.appKey = appKey;
+        this.appSecret = appSecret;
+        this.encodingAesKey = encodingAesKey;
+    }
+
+    /**
+     * 发送请求
+     *
+     * @param request request对象
+     * @return Response
+     * @throws Exception
+     */
+    public Response execute(Request request) throws Exception {
+        request.setApiUrl(this.apiUrl);
+        request.setAppKey(this.appKey);
+        request.setAppSecret(this.appSecret);
+        request.setEncodingAesKey(this.encodingAesKey);
+        request.addHeader(SystemHeader.X_CA_KEY, request.getAppKey());
+        request.addHeader(SystemHeader.X_CA_NONCE, UUID.randomUUID().toString());
+        request.addHeader(SystemHeader.X_CA_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
+        String jsonStr = JSONUtils.toString(request.getBodys());
+        String encryptStr;
+        if (StringUtils.isNotEmpty(request.getEncodingAesKey())) {
+            encryptStr = AESUtils.encrypt(jsonStr, request.getEncodingAesKey());
+        } else {
+            encryptStr = jsonStr;
+        }
+        String contentMd5 = MessageDigestUtil.base64AndMD5(encryptStr);
+        request.addHeader(SystemHeader.X_CONTENT_MD5, contentMd5);
+        String signature = SignUtil.sign(request.getAppSecret(), request.getHeaders());
+        request.addHeader(SystemHeader.X_CA_SIGNATURE, signature);
+        request.setStringBody(encryptStr);
+        return OpenApiUtils.post(request);
+    }
+
+    public static void main(String[] args) throws Exception {
+        String body = "[1]";
+        String encryptStr = AESUtils.encrypt(body, "1234567890123456");
+        String contentMd5 = MessageDigestUtil.base64AndMD5(encryptStr.getBytes());
+        System.out.println(contentMd5);
+
+    }
+}

+ 47 - 0
tran-service/src/main/java/com/diagbot/entity/Constants.java

@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.diagbot.entity;
+
+/**
+ * 通用常量
+ */
+public class Constants {
+    //签名算法HmacSha256
+    public static final String HMAC_SHA256 = "HmacSHA256";
+    //编码UTF-8
+    public static final String ENCODING = "UTF-8";
+    //UserAgent
+    public static final String USER_AGENT = "demo/aliyun/java";
+    //换行符
+    public static final String LF = "\n";
+    //串联符
+    public static final String SPE1 = ",";
+    //示意符
+    public static final String SPE2 = ":";
+    //连接符
+    public static final String SPE3 = "&";
+    //赋值符
+    public static final String SPE4 = "=";
+    //问号符
+    public static final String SPE5 = "?";
+    //默认请求超时时间,单位毫秒
+    public static final int DEFAULT_TIMEOUT = 1000;
+    //参与签名的系统Header前缀,只有指定前缀的Header才会参与到签名中
+    public static final String CA_HEADER_TO_SIGN_PREFIX_SYSTEM = "X-Ca-";
+}

+ 7 - 6
tran-service/src/main/java/com/diagbot/entity/InquiryTriage.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -33,12 +34,12 @@ public class InquiryTriage implements Serializable {
     /**
      * 记录创建时间
      */
-    private LocalDateTime gmtCreate;
+    private Date gmtCreate;
 
     /**
      * 记录修改时间,如果时间是1970年则表示纪录未修改
      */
-    private LocalDateTime gmtModified;
+    private Date gmtModified;
 
     /**
      * 创建人,0表示无创建人值
@@ -119,18 +120,18 @@ public class InquiryTriage implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
-    public LocalDateTime getGmtCreate() {
+    public Date getGmtCreate() {
         return gmtCreate;
     }
 
-    public void setGmtCreate(LocalDateTime gmtCreate) {
+    public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
-    public LocalDateTime getGmtModified() {
+    public Date getGmtModified() {
         return gmtModified;
     }
 
-    public void setGmtModified(LocalDateTime gmtModified) {
+    public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
     public String getCreator() {

+ 53 - 0
tran-service/src/main/java/com/diagbot/entity/JSONResponseBean.java

@@ -0,0 +1,53 @@
+package com.diagbot.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class JSONResponseBean {
+	private int code = 200;
+	private String msg;
+	private Object body;
+	private Map<String, Object> properties;
+	
+	public int getCode() {
+		return code;
+	}
+	
+	public void setCode(int code) {
+		this.code = code;
+	}
+	
+	public String getMsg() {
+		return msg;
+	}
+	
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+	
+	public Object getBody() {
+		return body;
+	}
+	
+	public void setBody(Object body) {
+		this.body = body;
+	}
+	
+	public Map<String, Object> getProperties() {
+		return properties;
+	}
+	
+	public Object getProperty(String nm){
+		if(properties == null || properties.isEmpty()){
+			return null;
+		}
+		return properties.get(nm);
+	}
+	
+	public void setProperty(String name, Object val){
+		if(properties == null){
+			properties = new HashMap<>();
+		}
+		properties.put(name, val);
+	}
+}

+ 142 - 0
tran-service/src/main/java/com/diagbot/entity/Request.java

@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.diagbot.entity;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Request
+ */
+public class Request {
+
+    public Request() {
+    }
+
+    public Request(String serviceId, String method, List<Object> bodys) {
+        this.appKey = appKey;
+        this.appSecret = appSecret;
+        this.bodys=bodys;
+        headers = new HashMap<>();
+        headers.put(SystemHeader.X_CA_KEY, appKey);
+        headers.put(SystemHeader.X_SERVICE_ID, serviceId);
+        headers.put(SystemHeader.X_SERVICE_METHOD, method);
+    }
+    /**
+     * (必选)服务请求地址
+     */
+    private String apiUrl;
+
+
+
+    /**
+     * (必选)APP KEY
+     */
+    private String appKey;
+
+    /**
+     * (必选)APP密钥
+     */
+    private String appSecret;
+
+    private String encodingAesKey;
+
+
+    /**
+     * (必选) HTTP头
+     */
+    private Map<String, String> headers;
+    
+
+
+    /**
+     * (必选)请求参数
+     */
+    private List<Object> bodys;
+
+    /**
+     * (可选)字符串Body体
+     */
+    private String stringBody;
+
+
+    public String getAppKey() {
+        return appKey;
+    }
+
+    public void setAppKey(String appKey) {
+        this.appKey = appKey;
+    }
+
+    public String getAppSecret() {
+        return appSecret;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+
+    public Map<String, String> getHeaders() {
+        return headers;
+    }
+
+    public void setHeaders(Map<String, String> headers) {
+        this.headers = headers;
+    }
+
+    public List<Object> getBodys() {
+        return bodys;
+    }
+
+    public void setBodys(List<Object> bodys) {
+        this.bodys = bodys;
+    }
+
+    public String getStringBody() {
+        return stringBody;
+    }
+
+    public void setStringBody(String stringBody) {
+        this.stringBody = stringBody;
+    }
+
+    public String getEncodingAesKey() {
+        return encodingAesKey;
+    }
+
+    public void setEncodingAesKey(String encodingAesKey) {
+        this.encodingAesKey = encodingAesKey;
+    }
+
+    public String getApiUrl() {
+        return apiUrl;
+    }
+
+    public void setApiUrl(String apiUrl) {
+        this.apiUrl = apiUrl;
+    }
+    public void addHeader(String name, String value){
+        if(headers==null){
+            headers = new HashMap<>();
+        }
+        headers.put(name, value);
+    }
+}

+ 120 - 0
tran-service/src/main/java/com/diagbot/entity/Response.java

@@ -0,0 +1,120 @@
+package com.diagbot.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Response {
+    /**
+     * http 请求状态码
+     */
+    private int statusCode;
+    private String contentType;
+    /**
+     * 请求唯一 ID,请求一旦进入 API 网关应用后,API 网关就会生成请求 ID 并通过响应头返回给客户端,
+     * 建议客户端与后端服务都记录此请求 ID,可用于问题排查与跟踪。
+     */
+    private String requestId;
+    /**
+     * API网关会将服务端的StringToSign放到HTTP应答的Header中返回到客户端,Key为:X-Ca-Error-Message
+     * 只需要将本地计算的StringToSign与服务端返回的StringToSign进行对比即可找到问题;
+     * 如果服务端与客户端的签名串是一致的,请检查用于签名计算的密钥是否正确;
+     */
+    private String caErrorMsg;
+    /**
+     * 业务接口返回的错误信息
+     */
+    private String errorMessage;
+    private Map<String, String> headers;
+    private String body;
+    private JSONResponseBean jsonResponseBean;
+
+    public boolean isSuccess() {
+        return (200 == statusCode && jsonResponseBean != null && 200 == jsonResponseBean.getCode());
+    }
+
+    public Response() {
+
+    }
+
+    public int getStatusCode() {
+        return statusCode;
+    }
+
+    public void setStatusCode(int statusCode) {
+        this.statusCode = statusCode;
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    public String getRequestId() {
+        return requestId;
+    }
+
+    public void setRequestId(String requestId) {
+        this.requestId = requestId;
+    }
+
+    public String getErrorMessage() {
+        if (jsonResponseBean != null && !"200".equals(jsonResponseBean.getCode())) {
+            return jsonResponseBean.getMsg();
+        }
+        return null;
+    }
+
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+    public Map<String, String> getHeaders() {
+        return headers;
+    }
+
+    public String getHeader(String key) {
+        if (null != headers) {
+            return headers.get(key);
+        } else {
+            return null;
+        }
+    }
+
+    public void setHeaders(Map<String, String> headers) {
+        this.headers = headers;
+    }
+
+    public void setHeader(String key, String value) {
+        if (null == this.headers) {
+            this.headers = new HashMap<String, String>();
+        }
+        this.headers.put(key, value);
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public void setBody(String body) {
+        this.body = body;
+    }
+
+    public JSONResponseBean getJsonResponseBean() {
+        return jsonResponseBean;
+    }
+
+    public void setJsonResponseBean(JSONResponseBean jsonResponseBean) {
+        this.jsonResponseBean = jsonResponseBean;
+    }
+
+    public String getCaErrorMsg() {
+        return caErrorMsg;
+    }
+
+    public void setCaErrorMsg(String caErrorMsg) {
+        this.caErrorMsg = caErrorMsg;
+    }
+}

+ 29 - 0
tran-service/src/main/java/com/diagbot/entity/SystemHeader.java

@@ -0,0 +1,29 @@
+
+package com.diagbot.entity;
+
+/**
+ * 系统HTTP头常量
+ */
+public class SystemHeader {
+    //签名Header
+    public static final String X_CA_SIGNATURE = "X-Ca-Signature";
+    //所有参与签名的Header
+    public static final String X_CA_SIGNATURE_HEADERS = "X-Ca-Signature-Headers";
+    //请求时间戳
+    public static final String X_CA_TIMESTAMP = "X-Ca-Timestamp";
+    //请求放重放Nonce,15分钟内保持唯一,建议使用UUID
+    public static final String X_CA_NONCE = "X-Ca-Nonce";
+    //APP KEY
+    public static final String X_CA_KEY = "X-Ca-Key";
+    //服务id
+    public static final String X_SERVICE_ID = "X-Service-Id";
+    //具体method
+    public static final String X_SERVICE_METHOD = "X-Service-Method";
+    //MD5加密的请求体信息
+    public static final String X_CONTENT_MD5 = "X-Content-MD5";
+
+    //MD5加密的请求体信息
+    public static final String X_CA_REQUESTID = "X-Ca-RequestId";
+    //API网关会将服务端的StringToSign放到HTTP应答的Header中返回到客户端,Key为:X-Ca-Error-Message
+    public static final String X_CA_ERROR_MESSAGE = "X-Ca-Error-Message";
+}

+ 94 - 0
tran-service/src/main/java/com/diagbot/facade/InquiryTriageFacade.java

@@ -0,0 +1,94 @@
+package com.diagbot.facade;
+
+
+import com.diagbot.dto.SaveInquiryTriageDTO;
+import com.diagbot.entity.InquiryTriage;
+import com.diagbot.service.impl.InquiryTriageServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.GsonUtil;
+import com.diagbot.util.HttpUtils;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.HospitalVO;
+import com.diagbot.vo.SaveInquiryTriageVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangfeng
+ * @time: 2020/3/23 10:33
+ */
+@Component
+public class InquiryTriageFacade extends InquiryTriageServiceImpl {
+
+    @Autowired
+    OptInfoFacade optInfoFacade;
+
+    /**
+     * @param saveInquiryVO
+     * @return
+     */
+    public SaveInquiryTriageDTO saveInquiry(SaveInquiryTriageVO saveInquiryVO) {
+        if (StringUtil.isBlank(saveInquiryVO.getHospitalCode())) {
+            saveInquiryVO.setHospitalCode("朗通通用");
+        }
+        Date now = DateUtil.now();
+        InquiryTriage inquiryInfo = new InquiryTriage();
+        BeanUtil.copyProperties(saveInquiryVO, inquiryInfo);
+        inquiryInfo.setGmtCreate(now);
+        inquiryInfo.setGmtModified(now);
+        inquiryInfo.setDisDept(GsonUtil.toJson(saveInquiryVO.getDisDeptist()));
+        inquiryInfo.setIp(HttpUtils.getIpAddress());
+        boolean res = save(inquiryInfo);
+
+        HospitalVO hospitalVO = new HospitalVO();
+        hospitalVO.setHospitalCode(saveInquiryVO.getHospitalCode());
+        hospitalVO.setSysType(saveInquiryVO.getSysType());
+        // 保存记录表
+        optInfoFacade.saveOptOnfo(hospitalVO, "2");
+        //邵逸夫医院 心理测试 对接纳里时,返回url
+        SaveInquiryTriageDTO saveInquiryDTO = new SaveInquiryTriageDTO();
+
+/*        if (saveInquiryVO.getHospitalCode().equals("邵逸夫医院")
+                && saveInquiryVO.getIdType().equals(1)) {
+            List<String> naliRetList = getUrl(saveInquiryVO);
+            String retUrl = naliRetList.get(0);
+            saveInquiryDTO.setBody(retUrl);
+            saveInquiryDTO.setResponse(naliRetList.get(1));
+            saveInquiryDTO.setRequest(naliRetList.get(2));
+            saveInquiryDTO.setRequestBodys(naliRetList.get(3));
+        }*/
+        return saveInquiryDTO;
+    }
+
+    private List<String> getUrl(SaveInquiryTriageVO saveInquiryVO) {
+        //TODO 待定
+        /*List<String> ret = Lists.newArrayList();
+        String retUrl = null;
+        Request request = null;
+        Response response = null;
+        try {
+            String encodingAesKey = "";
+            Client client = new Client(apiUrl, appKey, appSecret, encodingAesKey);
+            request = getltcs(saveInquiryVO);
+            response = client.execute(request);
+            log.info("request:" + FastJsonUtils.getBeanToJson(request));
+            log.info("requestBodys:" + FastJsonUtils.getBeanToJson(request.getBodys()));
+            log.info("response:" + FastJsonUtils.getBeanToJson(response));
+            if (response.isSuccess()) {
+                JSONResponseBean result = response.getJsonResponseBean();
+                retUrl = result.getBody().toString();
+            }
+        } catch (Exception e) {
+        }
+        ret.add(retUrl);
+        ret.add(FastJsonUtils.getBeanToJson(response));
+        ret.add(FastJsonUtils.getBeanToJson(request));
+        ret.add(FastJsonUtils.getBeanToJson(request.getBodys()));*/
+        return null;
+    }
+}

+ 95 - 0
tran-service/src/main/java/com/diagbot/util/AESUtils.java

@@ -0,0 +1,95 @@
+package com.diagbot.util;
+
+import com.diagbot.entity.Constants;
+import org.apache.commons.codec.binary.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.Key;
+
+public class AESUtils {
+
+    private static final String KEY_ALGORITHM = "AES";
+    private static final String DEFAULT_CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";
+
+    public static byte[] initSecretKey() throws Exception {
+        KeyGenerator kg = KeyGenerator.getInstance(KEY_ALGORITHM);
+        kg.init(128);
+        SecretKey secretKey = kg.generateKey();
+
+        return secretKey.getEncoded();
+    }
+
+    public static Key toKey(byte[] key) {
+        return new SecretKeySpec(key, KEY_ALGORITHM);
+    }
+
+    public static String encrypt(String data, String key) throws Exception {
+        return Base64.encodeBase64String(encrypt(data.getBytes(Constants.ENCODING), toKey(key.getBytes()), DEFAULT_CIPHER_ALGORITHM));
+    }
+
+    public static String decrypt(String data, String key) throws Exception {
+        return new String(decrypt(Base64.decodeBase64(data.getBytes(Constants.ENCODING)), toKey(key.getBytes()), DEFAULT_CIPHER_ALGORITHM));
+    }
+
+    public static byte[] encrypt(byte[] data, Key key) throws Exception {
+        return encrypt(data, key, DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+        return encrypt(data, toKey(key), DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] encrypt(byte[] data, Key key, String cipherAlgorithm) throws Exception {
+        Cipher cipher = Cipher.getInstance(cipherAlgorithm);
+        cipher.init(Cipher.ENCRYPT_MODE, key);
+        return cipher.doFinal(data);
+    }
+
+    public static byte[] decrypt(byte[] data, byte[] key) throws Exception {
+        return decrypt(data, key, DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] decrypt(byte[] data, Key key) throws Exception {
+        return decrypt(data, key, DEFAULT_CIPHER_ALGORITHM);
+    }
+
+    public static byte[] decrypt(byte[] data, byte[] key, String cipherAlgorithm) throws Exception {
+        Key k = toKey(key);
+        return decrypt(data, k, cipherAlgorithm);
+    }
+
+    public static byte[] decrypt(byte[] data, Key key, String cipherAlgorithm) throws Exception {
+        Cipher cipher = Cipher.getInstance(cipherAlgorithm);
+        cipher.init(Cipher.DECRYPT_MODE, key);
+        return cipher.doFinal(data);
+    }
+
+    private static String showByteArray(byte[] data) {
+        if (null == data) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder("{");
+        for (byte b : data) {
+            sb.append(b).append(",");
+        }
+        sb.deleteCharAt(sb.length() - 1);
+        sb.append("}");
+        return sb.toString();
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        String original = "[1]";
+        String key = "1234567890123456";
+        System.out.println("original: " + original);
+        String encrypt = encrypt(original, key);
+        System.out.println("encrypt: " + encrypt + ", key: " + key);
+        String decrypt = decrypt(encrypt, key);
+        System.out.println("decrypt: " + decrypt);
+
+    }
+
+}

+ 139 - 0
tran-service/src/main/java/com/diagbot/util/JSONUtils.java

@@ -0,0 +1,139 @@
+package com.diagbot.util;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.text.SimpleDateFormat;
+
+public class JSONUtils {
+	private static ObjectMapper mapper =  new ObjectMapper();
+
+	static{
+		mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+		mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
+		mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
+
+		mapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING,true);
+		mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+		mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+		mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+		mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+	}
+
+	public static <T> T parse(String value, Class<T> clz){
+
+		if (StringUtils.isEmpty(value)) {
+			return null;
+		}
+		try {
+			return mapper.readValue(value, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static <T> T parse(byte[] bytes, Class<T> clz){
+		try {
+			return mapper.readValue(bytes, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+
+	public static <T> T parse(InputStream ins, Class<T> clz){
+		try {
+			return mapper.readValue(ins, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+
+	public static <T> T  parse(Reader reader, Class<T> clz){
+		try {
+			return mapper.readValue(reader, clz);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	@SuppressWarnings("unchecked")
+	public static <T> T update(String value, T object) {
+		try {
+			return (T) mapper.readerForUpdating(object).readValue(value);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static String writeValueAsString(Object o){
+		try {
+			return mapper.writeValueAsString(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static void write(OutputStream outs, Object o){
+		try {
+			mapper.writeValue(outs,o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+    }
+
+	public static void write(Writer writer, Object o){
+		try {
+			mapper.writeValue(writer,o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static String toString(Object o){
+		try {
+			return mapper.writeValueAsString(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static String toString(Object o, Class<?> clz){
+		try {
+			return mapper.writerFor(clz).writeValueAsString(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	public static byte[] toBytes(Object o){
+		try {
+			return mapper.writeValueAsBytes(o);
+		}
+		catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+}

+ 118 - 0
tran-service/src/main/java/com/diagbot/util/MessageDigestUtil.java

@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.diagbot.util;
+
+import com.diagbot.entity.Constants;
+import org.apache.commons.codec.binary.Base64;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 消息摘要工具
+ */
+public class MessageDigestUtil {
+    /**
+     * 先进行MD5摘要再进行Base64编码获取摘要字符串
+     *
+     * @param str
+     * @return
+     */
+    public static String base64AndMD5(String str) {
+        if (str == null) {
+            throw new IllegalArgumentException("inStr can not be null");
+        }
+        return base64AndMD5(toBytes(str));
+    }
+
+    /**
+     * 先进行MD5摘要再进行Base64编码获取摘要字符串
+     *
+     * @return
+     */
+    public static String base64AndMD5(byte[] bytes) {
+        if (bytes == null) {
+            throw new IllegalArgumentException("bytes can not be null");
+        }
+        try {
+            final MessageDigest md = MessageDigest.getInstance("MD5");
+            md.reset();
+            md.update(bytes);
+            final Base64 base64 = new Base64();
+            final byte[] enbytes = base64.encode(md.digest());
+            return new String(enbytes);
+        } catch (final NoSuchAlgorithmException e) {
+            throw new IllegalArgumentException("unknown algorithm MD5");
+        }
+    }
+
+    /**
+     * UTF-8编码转换为ISO-9959-1
+     *
+     * @param str
+     * @return
+     */
+    public static String utf8ToIso88591(String str) {
+        if (str == null) {
+            return str;
+        }
+
+        try {
+            return new String(str.getBytes("UTF-8"), "ISO-8859-1");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * ISO-9959-1编码转换为UTF-8
+     *
+     * @param str
+     * @return
+     */
+    public static String iso88591ToUtf8(String str) {
+        if (str == null) {
+            return str;
+        }
+
+        try {
+            return new String(str.getBytes("ISO-8859-1"), "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * String转换为字节数组
+     *
+     * @param str
+     * @return
+     */
+    private static byte[] toBytes(final String str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            return str.getBytes(Constants.ENCODING);
+        } catch (final UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+}

+ 118 - 0
tran-service/src/main/java/com/diagbot/util/OpenApiUtils.java

@@ -0,0 +1,118 @@
+package com.diagbot.util;
+
+import com.diagbot.entity.JSONResponseBean;
+import com.diagbot.entity.Request;
+import com.diagbot.entity.Response;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.Map;
+
+public class OpenApiUtils {
+    public static Response post(Request request) throws Exception {
+        return convert(doPost(request));
+    }
+
+    /**
+     * post form
+     *
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    private static HttpResponse doPost(Request request)
+            throws Exception {
+        HttpClient httpClient = wrapClient(request.getApiUrl());
+
+        HttpPost httpPost = new HttpPost(request.getApiUrl());
+        for (Map.Entry<String, String> e : request.getHeaders().entrySet()) {
+            httpPost.addHeader(e.getKey(), e.getValue());
+        }
+        if (request.getBodys() != null || StringUtils.isNotEmpty(request.getStringBody())) {
+            if (StringUtils.isNotEmpty(request.getStringBody())) {
+                httpPost.setEntity(new StringEntity(request.getStringBody(), ContentType.APPLICATION_JSON));
+            } else {
+                httpPost.setEntity(new StringEntity(JSONUtils.toString(request.getBodys()), ContentType.APPLICATION_JSON));
+            }
+        }
+        return httpClient.execute(httpPost);
+    }
+
+    private static HttpClient wrapClient(String host) {
+        HttpClient httpClient = new DefaultHttpClient();
+        if (host.startsWith("https://")) {
+            sslClient(httpClient);
+        }
+        return httpClient;
+    }
+
+    private static void sslClient(HttpClient httpClient) {
+        try {
+            SSLContext ctx = SSLContext.getInstance("TLS");
+            X509TrustManager tm = new X509TrustManager() {
+                public X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+
+                public void checkClientTrusted(X509Certificate[] xcs, String str) {
+
+                }
+
+                public void checkServerTrusted(X509Certificate[] xcs, String str) {
+
+                }
+            };
+            ctx.init(null, new TrustManager[] { tm }, null);
+            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+            ClientConnectionManager ccm = httpClient.getConnectionManager();
+            SchemeRegistry registry = ccm.getSchemeRegistry();
+            registry.register(new Scheme("https", 443, ssf));
+        } catch (KeyManagementException ex) {
+            throw new RuntimeException(ex);
+        } catch (NoSuchAlgorithmException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static Response convert(HttpResponse response) throws IOException {
+        Response res = new Response();
+
+        if (null != response) {
+            res.setStatusCode(response.getStatusLine().getStatusCode());
+            for (Header header : response.getAllHeaders()) {
+                res.setHeader(header.getName(), MessageDigestUtil.iso88591ToUtf8(header.getValue()));
+            }
+            res.setContentType(res.getHeader("Content-Type"));
+            res.setRequestId(res.getHeader("X-Ca-Request-Id"));
+            res.setBody(EntityUtils.toString(response.getEntity()));
+            res.setJsonResponseBean(JSONUtils.parse(res.getBody(), JSONResponseBean.class));
+            res.setCaErrorMsg(res.getHeader("X-Ca-Error-Message"));
+
+        } else {
+            //服务器无回应
+            res.setStatusCode(500);
+            res.setErrorMessage("No Response");
+        }
+
+        return res;
+    }
+}

+ 126 - 0
tran-service/src/main/java/com/diagbot/util/SignUtil.java

@@ -0,0 +1,126 @@
+
+package com.diagbot.util;
+
+
+import com.diagbot.entity.Constants;
+import com.diagbot.entity.SystemHeader;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
+
+/**
+ * 签名工具
+ */
+public class SignUtil {
+    /**
+     * 需要参与签名的请求头
+     */
+    private static final List<String> SIGN_HEADER_LIST = Arrays.asList("X-Service-Id","X-Service-Method","X-Ca-Key",
+            "X-Ca-Nonce","X-Ca-Timestamp","X-Content-MD5");
+    /**
+     * 计算签名
+     *
+     * @param secret APP密钥
+     * @param headers 请求头参数
+     * @return 签名后的字符串
+     */
+    public static String sign(String secret,
+                              Map<String, String> headers) {
+        try {
+            Mac hmacSha256 = Mac.getInstance(Constants.HMAC_SHA256);
+            byte[] keyBytes = secret.getBytes(Constants.ENCODING);
+            hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, Constants.HMAC_SHA256));
+//            String contentMd5 = MessageDigestUtil.base64AndMD5(bodyContent);
+
+            return new String(Base64.encodeBase64(
+                    hmacSha256.doFinal((buildHeaders(headers, SIGN_HEADER_LIST))
+                            .getBytes(Constants.ENCODING))),
+                    Constants.ENCODING);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 构建待签名Http头
+     *
+     * @param headers 请求中所有的Http头
+     * @param signHeaderList 自定义参与签名Header前缀
+     * @return 待签名Http头
+     */
+    public static String buildHeaders(Map<String, String> headers, List<String> signHeaderList) {
+
+    	List<String> sbList=new ArrayList<>();
+    	if (null != signHeaderList) {
+    		Collections.sort(signHeaderList);
+    		if (null != headers) {
+    			Map<String, String> sortMap = new TreeMap<String, String>();
+    			sortMap.putAll(headers);
+    			StringBuilder signHeadersStringBuilder = new StringBuilder();
+    			for (Map.Entry<String, String> header : sortMap.entrySet()) {
+                    if (isHeaderToSign(header.getKey(), signHeaderList)) {
+                        StringBuilder sb = new StringBuilder();
+                    	sb.append(header.getKey().toLowerCase());
+                    	sb.append(Constants.SPE2);
+                        if (!StringUtils.isBlank(header.getValue())) {
+                        	sb.append(header.getValue());
+                        }
+                        sbList.add(sb.toString());
+                        if (0 < signHeadersStringBuilder.length()) {
+                        	signHeadersStringBuilder.append(Constants.SPE1);
+                        }
+                        signHeadersStringBuilder.append(header.getKey().toLowerCase());
+                    }
+                }
+    			headers.put(SystemHeader.X_CA_SIGNATURE_HEADERS, signHeadersStringBuilder.toString());
+    		}
+    	}
+        return StringUtils.join(sbList,Constants.SPE3);
+    }
+
+    /**
+     * Http头是否参与签名 return
+     */
+    private static boolean isHeaderToSign(String headerName, List<String> signHeaderList) {
+        if (StringUtils.isBlank(headerName)) {
+            return false;
+        }
+
+        if (headerName.startsWith(Constants.CA_HEADER_TO_SIGN_PREFIX_SYSTEM)) {
+            return true;
+        }
+
+        if (null != signHeaderList) {
+            for (String signHeaderPrefix : signHeaderList) {
+                if (headerName.equalsIgnoreCase(signHeaderPrefix)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    public static void main(String[] args) {
+        String secret = "1234567890123456";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("X-Service-Id", "eh.organ");
+        headers.put("X-Service-Method", "");
+        headers.put("X-Ca-Key", "hello");
+        headers.put("X-Ca-Timestamp", String.valueOf(System.currentTimeMillis()));
+        headers.put("X-Ca-Nonce", UUID.randomUUID().toString());
+        headers.put(SystemHeader.X_CONTENT_MD5, UUID.randomUUID().toString());
+        System.out.println(sign(secret, headers));
+
+    }
+}

+ 21 - 0
tran-service/src/main/java/com/diagbot/vo/SaveDisDeptVO.java

@@ -0,0 +1,21 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020/3/23 11:24
+ */
+@Setter
+@Getter
+public class SaveDisDeptVO {
+    @ApiModelProperty(value = "医院名称")
+    private String diagnose;
+    @ApiModelProperty(value = "大科室")
+    private String deptBig;
+    @ApiModelProperty(value = "小科室")
+    private String deptSmall;
+}

+ 51 - 0
tran-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java

@@ -0,0 +1,51 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import java.util.List;
+
+@ApiModel(value = "分诊记录保存接口传参")
+@Getter
+@Setter
+public class SaveInquiryTriageVO {
+    @ApiModelProperty(value = "医院名称")
+    private String hospitalCode;
+
+    @ApiModelProperty(value = "访问者的IP", hidden = true)
+    private String ip;
+
+    @Valid
+    @ApiModelProperty(value = "诊断结果和疾病科室", required = true)
+    private List<SaveDisDeptVO> disDeptist;
+
+    @ApiModelProperty(value = "姓名")
+    private String patName;
+
+    @ApiModelProperty(value = "年龄")
+    private Integer patAge;
+
+    @ApiModelProperty(value = "性别(1:男 2:女)")
+    private Integer patSex;
+
+   @ApiModelProperty(value = "对接类型(1:咨询,2:挂号)")
+    private Integer idType;
+
+/*    @ApiModelProperty(value = "证件号")
+    private String idNum;*/
+
+    @ApiModelProperty(value = "症状")
+    private String symptom;
+
+    @ApiModelProperty(value = "补充说明")
+    private String supplement;
+    /**
+     * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
+     */
+    @ApiModelProperty(value = "访问的系统类型")
+    private Integer sysType;
+}

+ 36 - 4
tran-service/src/main/java/com/diagbot/web/InquiryTriageController.java

@@ -1,9 +1,19 @@
 package com.diagbot.web;
 
 
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SaveInquiryTriageDTO;
+import com.diagbot.facade.InquiryTriageFacade;
+import com.diagbot.vo.SaveInquiryTriageVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
@@ -13,8 +23,30 @@ import org.springframework.stereotype.Controller;
  * @author wangfeng
  * @since 2020-03-20
  */
-@Controller
+@RestController
 @RequestMapping("/inquiryTriage")
+@Api(value = "分诊记录API", tags = { "分诊-分诊记录API" })
+@SuppressWarnings("unchecked")
 public class InquiryTriageController {
 
-}
+    @Autowired
+    private InquiryTriageFacade inquiryTriageFacade;
+
+    @ApiOperation(value = "分诊记录保存[by:gaodm]")
+    @PostMapping("/saveInquiry")
+    @SysLogger("saveInquiry")
+    @Transactional
+    public RespDTO<SaveInquiryTriageDTO> saveInquiry(@RequestBody SaveInquiryTriageVO saveInquiryVO) {
+        SaveInquiryTriageDTO data = inquiryTriageFacade.saveInquiry(saveInquiryVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /*@ApiOperation(value = "获取机构下病人病历[by:gaodm]",
+            notes = "hospitalCode:医院名称<br>")
+    @PostMapping("/getInquirysByMech")
+    @SysLogger("getInquirysByMech")
+    public RespDTO<List<InquiryDTO>> getInquirysByMech(@RequestBody @Validated InquiryMechVO inquiryMechVO) {
+        return RespDTO.onSuc(inquiryInfoFacade.getInquirysByMech(inquiryMechVO));
+    }*/
+
+}

+ 10 - 0
triage-service/pom.xml

@@ -122,7 +122,17 @@
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
         </dependency>
+        <!-- mybatis-plus begin -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+        </dependency>
 
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+        </dependency>
+        <!-- mybatis-plus end -->
     </dependencies>
 
     <build>

+ 38 - 0
triage-service/src/main/java/com/diagbot/client/TranServiceClient.java

@@ -1,11 +1,22 @@
 package com.diagbot.client;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.hystrix.TranServiceHystrix;
+import com.diagbot.dto.HospItemDTO;
+import com.diagbot.dto.HospNameDTO;
 import com.diagbot.dto.HospitalDeptDTO;
+import com.diagbot.dto.OptDTO;
+import com.diagbot.dto.OptHospDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SaveInquiryTriageDTO;
 import com.diagbot.dto.SysSetInfoDTO;
 import com.diagbot.vo.HospitalDeptVO;
 import com.diagbot.vo.HospitalSetVO;
+import com.diagbot.vo.HospitalVO;
+import com.diagbot.vo.OptHospPageVO;
+import com.diagbot.vo.OptHospVO;
+import com.diagbot.vo.OptVO;
+import com.diagbot.vo.SaveInquiryTriageVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -26,4 +37,31 @@ public interface TranServiceClient {
 
     @PostMapping("/sysSet/getSysSetInfoDatas")
     RespDTO<List<SysSetInfoDTO>> getSysSetInfoDatas(@Valid @RequestBody HospitalSetVO hospitalSetVO);
+
+    @PostMapping("/inquiryTriage/saveInquiry")
+    public RespDTO<SaveInquiryTriageDTO> saveInquiry(@RequestBody SaveInquiryTriageVO saveInquiryVO);
+
+    @PostMapping("/optInfo/saveOptInfo")
+    public RespDTO<Boolean> saveOptOnfo(@RequestBody HospitalVO hospitalVO);
+
+    @PostMapping("/optInfo/getOptSum")
+    public RespDTO<OptDTO> getOptSum(@RequestBody OptVO optVO);
+
+    @PostMapping("/optInfo/getOptSumHosp")
+    public RespDTO<OptHospDTO> getOptSumHosp(@RequestBody OptVO optVO);
+
+    @PostMapping("/optInfo/getAllHospitalName")
+    public RespDTO<HospNameDTO> getAllHospitalName();
+
+    @PostMapping("/optInfo/getAllHospitalNameWithLtFrist")
+    public RespDTO<HospNameDTO> getAllHospitalNameWithLtFrist();
+
+    @PostMapping("/optInfo/getOptSumNoDays")
+    public RespDTO<OptDTO> getOptSumNoDays(@RequestBody OptVO optVO);
+
+    @PostMapping("/optInfo/getOptSumHospNoDays")
+    public RespDTO<List<HospItemDTO>> getOptSumHospNoDays(@RequestBody OptHospVO optHospVO);
+
+    @PostMapping("/optInfo/getOptSumHospNoDaysPage")
+    public RespDTO<IPage<HospItemDTO>> getOptSumHospNoDaysPage(@RequestBody OptHospPageVO optHospPageVO);
 }

+ 65 - 0
triage-service/src/main/java/com/diagbot/client/hystrix/TranServiceHystrix.java

@@ -1,11 +1,22 @@
 package com.diagbot.client.hystrix;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.TranServiceClient;
+import com.diagbot.dto.HospItemDTO;
+import com.diagbot.dto.HospNameDTO;
 import com.diagbot.dto.HospitalDeptDTO;
+import com.diagbot.dto.OptDTO;
+import com.diagbot.dto.OptHospDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SaveInquiryTriageDTO;
 import com.diagbot.dto.SysSetInfoDTO;
 import com.diagbot.vo.HospitalDeptVO;
 import com.diagbot.vo.HospitalSetVO;
+import com.diagbot.vo.HospitalVO;
+import com.diagbot.vo.OptHospPageVO;
+import com.diagbot.vo.OptHospVO;
+import com.diagbot.vo.OptVO;
+import com.diagbot.vo.SaveInquiryTriageVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -33,4 +44,58 @@ public class TranServiceHystrix implements TranServiceClient {
         log.error("【hystrix】调用{}异常", "getSysSetInfoDatas");
         return null;
     }
+
+    @Override
+    public RespDTO<SaveInquiryTriageDTO> saveInquiry(SaveInquiryTriageVO saveInquiryVO) {
+        log.error("【hystrix】调用{}异常", "saveInquiry");
+        return null;
+    }
+
+    @Override
+    public RespDTO<Boolean> saveOptOnfo(HospitalVO hospitalVO) {
+        log.error("【hystrix】调用{}异常", "saveOptOnfo");
+        return null;
+    }
+
+    @Override
+    public RespDTO<OptDTO> getOptSum(OptVO optVO) {
+        log.error("【hystrix】调用{}异常", "getOptSum");
+        return null;
+    }
+
+    @Override
+    public RespDTO<OptHospDTO> getOptSumHosp(OptVO optVO) {
+        log.error("【hystrix】调用{}异常", "getOptSumHosp");
+        return null;
+    }
+
+    @Override
+    public RespDTO<HospNameDTO> getAllHospitalName() {
+        log.error("【hystrix】调用{}异常", "getAllHospitalName");
+        return null;
+    }
+
+    @Override
+    public RespDTO<HospNameDTO> getAllHospitalNameWithLtFrist() {
+        log.error("【hystrix】调用{}异常", "getAllHospitalNameWithLtFrist");
+        return null;
+    }
+
+    @Override
+    public RespDTO<OptDTO> getOptSumNoDays(OptVO optVO) {
+        log.error("【hystrix】调用{}异常", "getOptSumNoDays");
+        return null;
+    }
+
+    @Override
+    public RespDTO<List<HospItemDTO>> getOptSumHospNoDays(OptHospVO optHospVO) {
+        log.error("【hystrix】调用{}异常", "getOptSumHospNoDays");
+        return null;
+    }
+
+    @Override
+    public RespDTO<IPage<HospItemDTO>> getOptSumHospNoDaysPage(OptHospPageVO optHospPageVO) {
+        log.error("【hystrix】调用{}异常", "getOptSumHospNoDaysPage");
+        return null;
+    }
 }

+ 22 - 0
triage-service/src/main/java/com/diagbot/dto/HospItemDTO.java

@@ -0,0 +1,22 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class HospItemDTO {
+    //医院名称
+    private String hospitalCode;
+    // pvSum
+    private Long pvSum = 0L;
+    //uvSum
+    private Long uvSum = 0L;
+    //zzSum
+    private Long zzSum = 0L;
+}

+ 18 - 0
triage-service/src/main/java/com/diagbot/dto/HospNameDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class HospNameDTO {
+    //医院名称
+    private List<String> hospitalCode;
+}

+ 22 - 0
triage-service/src/main/java/com/diagbot/dto/OptDTO.java

@@ -0,0 +1,22 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:50
+ */
+@Getter
+@Setter
+public class OptDTO {
+    private List<PVDTO> pvdto;
+    private Long pvSum;
+    private List<UVDTO> uvdto;
+    private Long uvSum;
+    private List<ZZDTO> zzdto;
+    private Long zzSum;
+}

+ 25 - 0
triage-service/src/main/java/com/diagbot/dto/OptHospDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:50
+ */
+@Getter
+@Setter
+public class OptHospDTO {
+    private List<PVHospDTO> pvHospDto;
+    private List<PVHospSumDTO> pvHospSumDto;
+    private Long pvSum;
+    private List<UVHospDTO> uvHospDto;
+    private List<UVHospSumDTO> uvHospSumDto;
+    private Long uvSum;
+    private List<ZZHospDTO> zzHospDto;
+    private List<ZZHospSumDTO> zzHospSumDto;
+    private Long zzSum;
+}

+ 16 - 0
triage-service/src/main/java/com/diagbot/dto/PVDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class PVDTO {
+    private String days;
+    private Long pvCnt;
+}

+ 18 - 0
triage-service/src/main/java/com/diagbot/dto/PVHospDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class PVHospDTO {
+    //医院名称
+    private String hospitalCode;
+    private String days;
+    private Long pvCnt;
+}

+ 17 - 0
triage-service/src/main/java/com/diagbot/dto/PVHospSumDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class PVHospSumDTO {
+    //医院名称
+    private String hospitalCode;
+    private Long pvSum;
+}

+ 30 - 0
triage-service/src/main/java/com/diagbot/dto/SaveInquiryTriageDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: wangfeng
+ * @time: 2020/3/23 10:56
+ */
+@ApiModel(value = "分诊记录保存接口出参")
+@Getter
+@Setter
+public class SaveInquiryTriageDTO {
+
+    /**
+     * 纳里返回的url
+     */
+    @ApiModelProperty(value = "纳里返回的url")
+    private String body;
+
+    private String response;
+
+    private String request;
+
+    private String requestBodys;
+
+}

+ 16 - 0
triage-service/src/main/java/com/diagbot/dto/UVDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class UVDTO {
+    private String days;
+    private Long uvCnt;
+}

+ 18 - 0
triage-service/src/main/java/com/diagbot/dto/UVHospDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class UVHospDTO {
+    //医院名称
+    private String hospitalCode;
+    private String days;
+    private Long uvCnt;
+}

+ 17 - 0
triage-service/src/main/java/com/diagbot/dto/UVHospSumDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class UVHospSumDTO {
+    //医院名称
+    private String hospitalCode;
+    private Long uvSum;
+}

+ 16 - 0
triage-service/src/main/java/com/diagbot/dto/ZZDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class ZZDTO {
+    private String days;
+    private Long zzCnt;
+}

+ 18 - 0
triage-service/src/main/java/com/diagbot/dto/ZZHospDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class ZZHospDTO {
+    //医院名称
+    private String hospitalCode;
+    private String days;
+    private Long zzCnt;
+}

+ 17 - 0
triage-service/src/main/java/com/diagbot/dto/ZZHospSumDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class ZZHospSumDTO {
+    //医院名称
+    private String hospitalCode;
+    private Long zzSum;
+}

+ 30 - 0
triage-service/src/main/java/com/diagbot/facade/InquiryTriageFacade.java

@@ -0,0 +1,30 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.TranServiceClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SaveInquiryTriageDTO;
+import com.diagbot.vo.SaveInquiryTriageVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020/3/23 15:02
+ */
+@Component
+public class InquiryTriageFacade  {
+
+    @Autowired
+    TranServiceClient tranServiceClient;
+
+    /**
+     * @param saveInquiryVO
+     * @return
+     */
+    public SaveInquiryTriageDTO saveInquiry(SaveInquiryTriageVO saveInquiryVO) {
+        RespDTO<SaveInquiryTriageDTO> data = tranServiceClient.saveInquiry(saveInquiryVO);
+        SaveInquiryTriageDTO dataNew =data.data;
+        return dataNew;
+    }
+}

+ 94 - 0
triage-service/src/main/java/com/diagbot/facade/OptInfoFacade.java

@@ -0,0 +1,94 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.client.TranServiceClient;
+import com.diagbot.client.hystrix.TranServiceHystrix;
+import com.diagbot.dto.HospItemDTO;
+import com.diagbot.dto.HospNameDTO;
+import com.diagbot.dto.OptDTO;
+import com.diagbot.dto.OptHospDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.HttpUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.HospitalVO;
+import com.diagbot.vo.OptHospPageVO;
+import com.diagbot.vo.OptHospVO;
+import com.diagbot.vo.OptVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020/3/23 15:01
+ */
+@Component
+public class OptInfoFacade {
+    @Autowired
+    TranServiceClient tranServiceClient;
+
+    public Boolean saveOptOnfo(HospitalVO hospitalVO) {
+        RespDTO<Boolean> data = tranServiceClient.saveOptOnfo(hospitalVO);
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+
+    public OptDTO getOptSum(OptVO optVO) {
+        RespDTO<OptDTO> data = tranServiceClient.getOptSum(optVO);
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+
+
+    public OptDTO getOptSumNoDays(OptVO optVO) {
+        RespDTO<OptDTO> data = tranServiceClient.getOptSumNoDays(optVO);
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+
+
+    public OptHospDTO getOptSumHosp(OptVO optVO) {
+        RespDTO<OptHospDTO> data = tranServiceClient.getOptSumHosp(optVO);
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+
+
+    public List<HospItemDTO> getOptSumHospNoDays(OptHospVO optHospVO) {
+        RespDTO<List<HospItemDTO>> data = tranServiceClient.getOptSumHospNoDays(optHospVO);
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+
+
+    public IPage<HospItemDTO> getOptSumHospNoDaysPageFac(OptHospPageVO optHospPageVO) {
+        RespDTO<IPage<HospItemDTO>> data = tranServiceClient.getOptSumHospNoDaysPage(optHospPageVO);
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+
+    public HospNameDTO getAllHospitalName(){
+        RespDTO<HospNameDTO> data = tranServiceClient.getAllHospitalName();
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+
+
+    public HospNameDTO getAllHospitalNameWithLtFrist(){
+        RespDTO<HospNameDTO> data = tranServiceClient.getAllHospitalNameWithLtFrist();
+        RespDTOUtil.respNGDeal(data, data.msg);
+        return data.data;
+    }
+}

+ 23 - 0
triage-service/src/main/java/com/diagbot/vo/HospitalVO.java

@@ -0,0 +1,23 @@
+package com.diagbot.vo;
+
+import com.diagbot.enums.SysTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ *
+ */
+@Getter
+@Setter
+public class HospitalVO {
+    //医院编码
+    //    @NotBlank(message = "请输入医院信息")
+    private String hospitalCode = "朗通通用";
+
+    /**
+     * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
+     */
+    @ApiModelProperty(hidden = true)
+    private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
+}

+ 38 - 0
triage-service/src/main/java/com/diagbot/vo/OptHospPageVO.java

@@ -0,0 +1,38 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/2/3 9:21
+ */
+@Getter
+@Setter
+public class OptHospPageVO extends Page {
+
+    //开始时间
+    @ApiModelProperty(value="开始时间,格式为:2018-11-28 17:25:30")
+    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
+    private Date startDate;
+    //结束时间
+    @ApiModelProperty(value="结束时间,格式为:2018-11-28 17:25:30")
+    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
+    private Date endDate;
+
+    //医院名称列表
+    private List<String> hospitalCodeList;
+
+    // 类型数组,默认都会返回访问量,有uvSum:再返回用户量,有zzSum:再返回提交量
+    private List<String> typeList;
+    /**
+     * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
+     */
+    private Integer sysType;
+}

+ 37 - 0
triage-service/src/main/java/com/diagbot/vo/OptHospVO.java

@@ -0,0 +1,37 @@
+package com.diagbot.vo;
+
+import com.diagbot.enums.SysTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/2/3 9:21
+ */
+@Getter
+@Setter
+public class OptHospVO {
+
+    //开始时间
+    @ApiModelProperty(value="开始时间,格式为:2018-11-28 17:25:30")
+    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
+    private Date startDate;
+    //结束时间
+    @ApiModelProperty(value="结束时间,格式为:2018-11-28 17:25:30")
+    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
+    private Date endDate;
+
+    //医院名称列表
+    private List<String> hospitalCodeList;
+    /**
+     * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
+     */
+    @ApiModelProperty(hidden = true)
+    private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
+}

+ 37 - 0
triage-service/src/main/java/com/diagbot/vo/OptVO.java

@@ -0,0 +1,37 @@
+package com.diagbot.vo;
+
+import com.diagbot.enums.SysTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:21
+ */
+@Getter
+@Setter
+public class OptVO {
+    //医院名称
+    private String hospitalCode;
+    //开始时间
+    @ApiModelProperty(value="开始时间,格式为:2018-11-28 17:25:30")
+    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
+    private Date startDate;
+    //结束时间
+    @ApiModelProperty(value="结束时间,格式为:2018-11-28 17:25:30")
+    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss")
+    private Date endDate;
+    /**
+     * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
+     */
+    @ApiModelProperty(hidden = true)
+    private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
+    //医院名称列表
+    private List<String> hospitalCodeList;
+}

+ 21 - 0
triage-service/src/main/java/com/diagbot/vo/SaveDisDeptVO.java

@@ -0,0 +1,21 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020/3/23 11:24
+ */
+@Setter
+@Getter
+public class SaveDisDeptVO {
+    @ApiModelProperty(value = "医院名称")
+    private String diagnose;
+    @ApiModelProperty(value = "大科室")
+    private String deptBig;
+    @ApiModelProperty(value = "小科室")
+    private String deptSmall;
+}

+ 51 - 0
triage-service/src/main/java/com/diagbot/vo/SaveInquiryTriageVO.java

@@ -0,0 +1,51 @@
+package com.diagbot.vo;
+
+import com.diagbot.enums.SysTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@ApiModel(value = "分诊记录保存接口传参")
+@Getter
+@Setter
+public class SaveInquiryTriageVO {
+    @ApiModelProperty(value = "医院名称")
+    private String hospitalCode;
+
+    @ApiModelProperty(value = "访问者的IP", hidden = true)
+    private String ip;
+
+    @Valid
+    @ApiModelProperty(value = "诊断结果和疾病科室", required = true)
+    private List<SaveDisDeptVO> disDeptist;
+
+    @ApiModelProperty(value = "姓名")
+    private String patName;
+
+    @ApiModelProperty(value = "年龄")
+    private Integer patAge;
+
+    @ApiModelProperty(value = "性别(1:男 2:女)")
+    private Integer patSex;
+
+   @ApiModelProperty(value = "对接类型(1:咨询,2:挂号)")
+    private Integer idType;
+
+/*    @ApiModelProperty(value = "证件号")
+    private String idNum;*/
+
+    @ApiModelProperty(value = "症状")
+    private String symptom;
+
+    @ApiModelProperty(value = "补充说明")
+    private String supplement;
+    /**
+     * 访问的系统类型 1:user-service,2:diagbotman-service,3:uaa-service,4:log-service,5:bi-service,6:knowledge-service,7:feedback-service,8:icss-web
+     */
+    @ApiModelProperty(hidden = true)
+    private Integer sysType = SysTypeEnum.TRIAGE_SERVICE.getKey();
+}

+ 52 - 0
triage-service/src/main/java/com/diagbot/web/InquiryTriageController.java

@@ -0,0 +1,52 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.SaveInquiryTriageDTO;
+import com.diagbot.facade.InquiryTriageFacade;
+import com.diagbot.vo.SaveInquiryTriageVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 智能分诊记录主表 前端控制器
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2020-03-20
+ */
+@RestController
+@RequestMapping("/inquiryTriage")
+@Api(value = "分诊记录API", tags = { "分诊-分诊记录API" })
+@SuppressWarnings("unchecked")
+public class InquiryTriageController {
+
+    @Autowired
+    private InquiryTriageFacade inquiryTriageFacade;
+
+    @ApiOperation(value = "分诊记录保存[by:gaodm]")
+    @PostMapping("/saveInquiry")
+    @SysLogger("saveInquiry")
+    @Transactional
+    public RespDTO<SaveInquiryTriageDTO> saveInquiry(@RequestBody SaveInquiryTriageVO saveInquiryVO) {
+        SaveInquiryTriageDTO data = inquiryTriageFacade.saveInquiry(saveInquiryVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /*@ApiOperation(value = "获取机构下病人病历[by:gaodm]",
+            notes = "hospitalCode:医院名称<br>")
+    @PostMapping("/getInquirysByMech")
+    @SysLogger("getInquirysByMech")
+    public RespDTO<List<InquiryDTO>> getInquirysByMech(@RequestBody @Validated InquiryMechVO inquiryMechVO) {
+        return RespDTO.onSuc(inquiryInfoFacade.getInquirysByMech(inquiryMechVO));
+    }*/
+
+}

+ 128 - 0
triage-service/src/main/java/com/diagbot/web/OptInfoController.java

@@ -0,0 +1,128 @@
+package com.diagbot.web;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.HospItemDTO;
+import com.diagbot.dto.HospNameDTO;
+import com.diagbot.dto.OptDTO;
+import com.diagbot.dto.OptHospDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.OptInfoFacade;
+import com.diagbot.vo.HospitalVO;
+import com.diagbot.vo.OptHospPageVO;
+import com.diagbot.vo.OptHospVO;
+import com.diagbot.vo.OptVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 操作信息 前端控制器
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2020-03-20
+ */
+@RestController
+@Api(value = "操作记录", tags = { "操作记录API" })
+@SuppressWarnings("unchecked")
+@RequestMapping("/optInfo")
+public class OptInfoController {
+    @Autowired
+    private OptInfoFacade optInfoFacade;
+
+    @ApiOperation(value = "操作记录保存[by:gaodm]")
+    @PostMapping("/saveOptInfo")
+    @SysLogger("saveOptInfo")
+    @Transactional
+    public RespDTO<Boolean> saveOptOnfo(@RequestBody HospitalVO hospitalVO) {
+        return RespDTO.onSuc(optInfoFacade.saveOptOnfo(hospitalVO));
+    }
+
+    @ApiOperation(value = "获取合计数据不带医院名称[by:gaodm]",
+            notes = "hospitalCode: 医院名称,String<br>" +
+                    "startDate: 开始时间,Date<br>" +
+                    "endDate: 结束时间,Date<br>")
+    @PostMapping("/getOptSum")
+    @SysLogger("getOptSum")
+    public RespDTO<OptDTO> getOptSum(@RequestBody OptVO optVO) {
+        return RespDTO.onSuc(optInfoFacade.getOptSum(optVO));
+    }
+
+
+    @ApiOperation(value = "获取合计数据带医院名称[by:gaodm]",
+            notes = "hospitalCode: 医院名称,String<br>" +
+                    "startDate: 开始时间,Date<br>" +
+                    "endDate: 结束时间,Date<br>")
+    @PostMapping("/getOptSumHosp")
+    @SysLogger("getOptSumHosp")
+    public RespDTO<OptHospDTO> getOptSumHosp(@RequestBody OptVO optVO) {
+        return RespDTO.onSuc(optInfoFacade.getOptSumHosp(optVO));
+    }
+
+    @ApiOperation(value = "获取所有医院名称[by:gaodm]",
+            notes = "")
+    @PostMapping("/getAllHospitalName")
+    @SysLogger("getAllHospitalName")
+    public RespDTO<HospNameDTO> getAllHospitalName() {
+        return RespDTO.onSuc(optInfoFacade.getAllHospitalName());
+    }
+
+    @ApiOperation(value = "获取所有医院名称,朗通通用排第一[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getAllHospitalNameWithLtFrist")
+    @SysLogger("getAllHospitalNameWithLtFrist")
+    public RespDTO<HospNameDTO> getAllHospitalNameWithLtFrist() {
+        return RespDTO.onSuc(optInfoFacade.getAllHospitalNameWithLtFrist());
+    }
+
+
+    @ApiOperation(value = "获取合计数据不带医院名称,只统计总数据,不统计每天数据[by:zhoutg]",
+            notes = "hospitalCode: 医院名称,String<br>" +
+                    "startDate: 开始时间,Date<br>" +
+                    "endDate: 结束时间,Date<br>" +
+                    "出参:<br>" +
+                    "pvSum:访问总量<br>" +
+                    "uvSum:用户总量<br>" +
+                    "zzSum:完成问诊总量<br>")
+    @PostMapping("/getOptSumNoDays")
+    @SysLogger("getOptSumNoDays")
+    public RespDTO<OptDTO> getOptSumNoDays(@RequestBody OptVO optVO) {
+        return RespDTO.onSuc(optInfoFacade.getOptSumNoDays(optVO));
+    }
+
+
+    @ApiOperation(value = "获取合计数据带医院名称,只统计总数,不统计每天数据[by:zhoutg]",
+            notes = "hospitalCodeList: 医院名称列表,List<br>" +
+                    "startDate: 开始时间,Date<br>" +
+                    "endDate: 结束时间,Date<br>")
+    @PostMapping("/getOptSumHospNoDays")
+    @SysLogger("getOptSumHospNoDays")
+    public RespDTO<List<HospItemDTO>> getOptSumHospNoDays(@RequestBody OptHospVO optHospVO) {
+        return RespDTO.onSuc(optInfoFacade.getOptSumHospNoDays(optHospVO));
+    }
+
+    @ApiOperation(value = "获取合计数据带医院名称,只统计总数,不统计每天数据,分页[by:zhoutg]",
+            notes = "hospitalCodeList: 医院名称列表,List<br>" +
+                    "startDate: 开始时间,Date<br>" +
+                    "endDate: 结束时间,Date<br>" +
+                    "desc:排序指标,[pvSum|uvSum|zzSum]<br>" +
+                    "page;第几页<br>" +
+                    "size:条数<br>" +
+                    "typeList:类型数组,默认都会返回访问量,有uvSum:再返回用户量,有zzSum:再返回提交量")
+    @PostMapping("/getOptSumHospNoDaysPage")
+    @SysLogger("getOptSumHospNoDaysPage")
+    public RespDTO<IPage<HospItemDTO>> getOptSumHospNoDaysPage(@RequestBody OptHospPageVO optHospPageVO) {
+        IPage<HospItemDTO> data = optInfoFacade.getOptSumHospNoDaysPageFac(optHospPageVO);
+        return RespDTO.onSuc(data);
+    }
+}