Browse Source

EHR质控报告页面集成

huangzhiyong 7 years ago
parent
commit
66564b9a11

+ 2 - 1
src/main/java/com/yihu/hos/common/CommonPageController.java

@ -292,6 +292,7 @@ public class CommonPageController extends BaseController {
                             @ApiParam(name = "token")
                             @RequestParam String token) throws Exception {
        try {
            HttpSession session = request.getSession();
            Map<String, String> params = new HashMap<>();
            params.put("clientId", clientId);
            params.put("accessToken", token);
@ -306,7 +307,7 @@ public class CommonPageController extends BaseController {
            if ((Boolean) map.get("successFlg")) {
                AccessToken accessToken = objectMapper.readValue(objectMapper.writeValueAsString(map.get("data")), AccessToken.class);
                String loginName = accessToken.getUser();
                session.setAttribute("ehrUser",loginName);
                //验证通过。赋值session中的用户信息
                HTTPResponse userResponse = HttpClientKit.get(adminUrl + "/users/" + loginName, params);
                Envelop result =  this.objectMapper.readValue(userResponse.getBody(), Envelop.class);

+ 23 - 339
src/main/java/com/yihu/hos/qc/controller/ReportController.java

@ -1,49 +1,47 @@
package com.yihu.hos.qc.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.core.http.HTTPResponse;
import com.yihu.hos.core.http.HttpClientKit;
import com.yihu.hos.qc.model.MQcDailyReportResultDetailModel;
import com.yihu.hos.web.framework.constant.ErrorCode;
import com.yihu.hos.web.framework.constant.SessionAttributeKeys;
import com.yihu.hos.web.framework.model.Envelop;
import com.yihu.hos.web.framework.util.controller.BaseController;
import jxl.Workbook;
import jxl.format.CellFormat;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by llh on 2017/5/9.
 */
@Controller
@RequestMapping("/report")
@SessionAttributes(SessionAttributeKeys.CurrentUser)
//@SessionAttributes(SessionAttributeKeys.CurrentUser)
public class ReportController extends BaseController {
    @Value("${service-gateway.adminUrl}")
    private String comUrl;
    @Value("${service-gateway.oauth2authorize}")
    private String oauth2authUrl;
    @Value("${service-gateway.oauth2RedictUrl}")
    private String oauth2RedictUrl;
    @Value("${service-gateway.oauth2ReportClientId}")
    private String oauth2ReportClientId;
    /**
     * iframe 嵌入 趋势分析页
     * @param model
     * @return
     * 单点登录-质控报告获取
     * @param request
     * @param response
     * @param user      门户登录用户
     * @throws Exception
     */
    @RequestMapping("iframeInitial")
    public String iframeInitial(Model model) {
        model.addAttribute("contentPage", "/qc/report");
        return "pageView";
    @RequestMapping(value = "signin",method = RequestMethod.GET)
    public void signin(HttpServletRequest request,HttpServletResponse response, String user) throws Exception
    {
//        response.sendRedirect("http://localhost:10260/oauth/authorize?response_type=token&client_id=111111&redirect_uri=http://localhost:8011/login/test&user=me");
       String redict = oauth2authUrl + "oauth/authorize?response_type=token&client_id="+oauth2ReportClientId+"&redirect_uri="+oauth2RedictUrl+"&scope=read&user="+user;
        response.sendRedirect(redict);
    }
    /**
@ -57,318 +55,4 @@ public class ReportController extends BaseController {
        return "pageView";
    }
    /**
     * 趋势分析详情页
     * @param model
     * @return
     */
    @RequestMapping("trendAnalysisDetail")
    public String trendAnalysisDetail(Model model,String location,String orgCode,String orgName,String quotaId,String startTime,String endTime) {
        model.addAttribute("location",location);
        model.addAttribute("orgCode",orgCode);
        model.addAttribute("orgName",orgName);
        model.addAttribute("quotaId",quotaId);
        model.addAttribute("startTime",startTime);
        model.addAttribute("endTime",endTime);
        model.addAttribute("contentPage", "/qc/report/trendAnalysisDetail");
        return "pageView";
    }
    /**
     * 分析列表页面
     * @param model
     * @return
     */
    @RequestMapping("analysisList")
    public String addResources(Model model,String location,String orgName,String startTime,String endTime) {
        model.addAttribute("location",location);
        model.addAttribute("orgName",orgName);
        model.addAttribute("startTime",startTime);
        model.addAttribute("endTime",endTime);
        model.addAttribute("contentPage", "/qc/report/analysisList");
        return "pageView";
    }
    //所有指标统计结果查询,初始化查询
    @RequestMapping("/getQcOverAllIntegrity")
    @ResponseBody
    public Object searchQcOverAllIntegrity(String location,String startTime,String endTime){
        String url = "/report/getQcOverAllIntegrity";
        HTTPResponse resultStr = null;
        Envelop envelop = new Envelop();
        Map<String, String> params = new HashMap<>();
        params.put("location", location);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        try {
            resultStr = HttpClientKit.get(comUrl + url, params);
            return resultStr;
        } catch (Exception ex) {
            ex.printStackTrace();
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    //根据机构查询所有指标统计结果,初始化查询
    @RequestMapping("/getQcOverAllOrgIntegrity")
    @ResponseBody
    public Object searchQcOverAllOrgIntegrity(String location,String orgCode,String startTime,String endTime){
        String url = "/report/getQcOverAllOrgIntegrity";
        HTTPResponse resultStr = null;
        Envelop envelop = new Envelop();
        Map<String, String> params = new HashMap<>();
        params.put("location", location);
        params.put("orgCode", orgCode);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        try {
            resultStr = HttpClientKit.get(comUrl + url, params);
            return resultStr;
        } catch (Exception ex) {
            ex.printStackTrace();
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    //趋势分析 - 按区域列表查询,初始化查询
    @RequestMapping("/getQcQuotaIntegrity")
    @ResponseBody
    public Object searchQcQuotaIntegrity(String location,String quotaId,String startTime,String endTime){
        String url = "/report/getQcQuotaIntegrity";
        HTTPResponse resultStr = null;
        Envelop envelop = new Envelop();
        Map<String, String> params = new HashMap<>();
        params.put("location", location);
        params.put("quotaId", quotaId);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        try {
            resultStr = HttpClientKit.get(comUrl + url, params);
            return resultStr;
        } catch (Exception ex) {
            ex.printStackTrace();
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    //趋势分析 -按机构列表查询,初始化查询
    @RequestMapping("/getQcQuotaOrgIntegrity")
    @ResponseBody
    public Object searchQcQuotaOrgIntegrity(String orgCode,String quotaId,String startTime,String endTime){
        String url = "/report/getQcQuotaOrgIntegrity";
        HTTPResponse resultStr = null;
        Envelop envelop = new Envelop();
        Map<String, String> params = new HashMap<>();
        params.put("orgCode", orgCode);
        params.put("quotaId", quotaId);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        try {
            resultStr = HttpClientKit.get(comUrl + url, params);
            return resultStr;
        } catch (Exception ex) {
            ex.printStackTrace();
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    //分析明细列表
    @RequestMapping("/getQcQuotaDailyIntegrity")
    @ResponseBody
    public Object searchQcQuotaDailyIntegrity(String location,String startTime,String endTime){
        String url = "/report/getQcQuotaDailyIntegrity";
        HTTPResponse resultStr = null;
        Envelop envelop = new Envelop();
        Map<String, String> params = new HashMap<>();
        params.put("location", location);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        try {
            resultStr = HttpClientKit.get(comUrl + url, params);
            return resultStr;
        } catch (Exception ex) {
            ex.printStackTrace();
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    //根据地区、期间查询各机构某项指标的值
    @RequestMapping("/getQcQuotaByLocation")
    @ResponseBody
    public Object searchQcQuotaByLocation(String location,String quotaId,String startTime,String endTime){
        String url = "/report/getQcQuotaByLocation";
        HTTPResponse resultStr = null;
        Envelop envelop = new Envelop();
        Map<String, String> params = new HashMap<>();
        params.put("location", location);
        params.put("quotaId", quotaId);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        try {
            resultStr = HttpClientKit.get(comUrl + url, params);
            return resultStr;
        } catch (Exception ex) {
            ex.printStackTrace();
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    //根据地区、期间查询分析明细列表,并导出
    @RequestMapping("/exportToExcel")
    //@ResponseBody
    public void exportToExcel(HttpServletResponse response,String location,String startTime,String endTime){
        Envelop envelop = new Envelop();
        try {
            String fileName = "分析列表明细";
            String url="";
            HTTPResponse envelopStr = null;
            //设置下载
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="
                    + new String( fileName.getBytes("gb2312"), "ISO8859-1" )+".xls");
            OutputStream os = response.getOutputStream();
            //获取导出字典
            Map<String,String> params = new HashMap<>();
            url = "/report/getQcQuotaDailyIntegrity";
            params.put("location",location);
            params.put("startTime",startTime);
            params.put("endTime",endTime);
            envelopStr = HttpClientKit.get(comUrl + url, params);
            Envelop qcEnvelop = getEnvelop(envelopStr.getBody());
            List<MQcDailyReportResultDetailModel> qcModelList = (List<MQcDailyReportResultDetailModel>)getEnvelopList(qcEnvelop.getDetailModelList(),new ArrayList<MQcDailyReportResultDetailModel>(),MQcDailyReportResultDetailModel.class) ;
            //写excel
            WritableWorkbook wwb = Workbook.createWorkbook(os);
            //创建Excel工作表 指定名称和位置
            WritableSheet ws = wwb.createSheet("质控分析明细",0);
            addStaticCell(ws);//添加固定信息,题头等
            //添加字典项信息
            WritableCellFormat wc = new WritableCellFormat();
            wc.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN, Colour.SKY_BLUE);//边框
            MQcDailyReportResultDetailModel qc=null;
            for(int i=0;i<qcModelList.size();i++) {
                int j=i+1;
                qc = (MQcDailyReportResultDetailModel)qcModelList.get(i);
                //添加列表明细
                addCell(ws,0,j,qc.getEventTime(),wc);//时间
                addCell(ws,1,j,qc.getOrgName(),wc);//机构名称
                addCell(ws,2,j,qc.getScaleType(),wc);//比例名称
                addCell(ws,3,j,qc.getArIntegrity(),wc);//整体数量完整性
                addCell(ws,4,j,qc.getDsIntegrity(),wc);//数据集完整性
                addCell(ws,5,j,qc.getMdIntegrity(),wc);//数据元完整性
                addCell(ws,6,j,qc.getMdAccuracy(),wc);//准确性
                addCell(ws,7,j,qc.getArTimely(),wc);//全部及时性
                addCell(ws,8,j,qc.getHpTimely(),wc);//住院病人及时性
                addCell(ws,9,j,qc.getOpTimely(),wc);//门诊病人及时性
            }
            //写入工作表
            wwb.write();
            wwb.close();
            os.flush();
            os.close();
        } catch (Exception e) {
            envelop.setSuccessFlg(false);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
        }
    }
    //excel中添加固定内容
    private void addStaticCell(WritableSheet ws){
        try {
            addCell(ws,0,0,"时间");
            addCell(ws,1,0,"对象");
            addCell(ws,2,0," ");
            addCell(ws,3,0,"整体数量完整性");
            addCell(ws,4,0,"数据集完整性");
            addCell(ws,5,0,"数据元完整性");
            addCell(ws,6,0,"准确性");
            addCell(ws,7,0,"全部及时性");
            addCell(ws,8,0,"住院病人及时性");
            addCell(ws,9,0,"门诊病人及时性");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    //添加单元格内容
    private void addCell(WritableSheet ws,int column,int row,String data){
        try {
            Label label = new Label(column,row,data);
            ws.addCell(label);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    //添加单元格内容带样式
    private void addCell(WritableSheet ws,int column,int row,String data,CellFormat cellFormat){
        try {
            Label label = new Label(column,row,data,cellFormat);
            ws.addCell(label);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 临时页
     * @param model
     * @return
     */
    @RequestMapping("initialLs")
    public String initialLs(Model model) {
        model.addAttribute("contentPage", "/qc/report/ls/orgAnalysisList");
        return "simpleView";
    }
    /**
     * 档案入库状况数据
     * @param model
     * @return
     */
    @RequestMapping("rukuData")
    @ResponseBody
    public Object rukuData(Model model,String orgCode,String startDate,String endDate) {
        String url = "/report/qcDailyStatisticsStorageByDate";
        HTTPResponse resultStr = null;
        Map<String, String> params = new HashMap<>();
        Envelop result = new Envelop();
        try {
            params.put("orgCode",orgCode);
            params.put("startDate",startDate);
            params.put("endDate",endDate);
            resultStr = HttpClientKit.get(comUrl + url, params);
            ObjectMapper mapper = new ObjectMapper();
            Envelop envelop = mapper.readValue(resultStr.getBody(), Envelop.class);
            if (!envelop.isSuccessFlg()) {
                result.setSuccessFlg(true);
                result.setDetailModelList(envelop.getDetailModelList());
                result.setObj(envelop.getObj());
                return result;
            } else {
                result.setSuccessFlg(false);
                return result;
            }
        } catch (Exception e) {
            result.setSuccessFlg(false);
            result.setErrorMsg(ErrorCode.SystemError.toString());
            return result;
        }
    }
}

+ 6 - 0
src/main/resources/application.yml

@ -62,6 +62,9 @@ hos:
service-gateway:
  portalUrl: http://192.168.1.221:10280/api/v1.0/portal
  adminUrl: http://192.168.1.221:10000/api/v1.0/admin
  oauth2authorize: http://192.168.131.106:10260/
  oauth2RedictUrl: http://192.168.131.106:8083/ehr/login/signinReport
  oauth2ReportClientId: 2YTOSRI0tw
  url: http://172.19.103.37:9999/api
---
spring:
@ -108,4 +111,7 @@ hos:
service-gateway:
  portalUrl: http://192.168.1.221:10280/api/v1.0/portal
  adminUrl: http://192.168.1.221:10000/api/v1.0/admin
  oauth2authorize: http://192.168.1.221:10260/
  oauth2RedictUrl: http://192.168.1.221:8080/ehr/login/signinReport
  oauth2ReportClientId: 2YTOSRI0tw
  url: http://172.19.103.37:9999/api

+ 1 - 1
src/main/webapp/WEB-INF/ehr/jsp/common/index.jsp

@ -54,7 +54,7 @@
    <div position="center" class="m-index-center" id="divIndexContent">
    </div>
<input type="hidden" id="ehrUser" value="${ehrUser}">
</div>

+ 10 - 6
src/main/webapp/WEB-INF/ehr/jsp/common/indexJs.jsp

@ -4,7 +4,7 @@
    // 设置jQuery Ajax全局的参数
    $.ajaxSetup({
        type: "POST",
        type: "GET",
        error: function (jqXHR, textStatus, errorThrown) {
            isLogin();
            switch (jqXHR.status) {
@ -66,7 +66,7 @@
            });
            $(".l-layout-left").css({background: "#dce6f0"})
            var ehrUser = $("#ehrUser").val();
            var tenantManager = {} ;
            var userRole = localStorage.getItem("userRole");
            //菜单列表
@ -116,7 +116,7 @@
                {id: 8, text: '质控管理', icon: '${staticRoot}/images/index/menu05.png'},
                {id: 81, pid: 8, text: '规则管理', url: '${contextRoot}/rule/initial', icon: '${staticRoot}/images/index/Ins_icon.png'},
                <%--{id: 82, pid: 8, text: '质控报告', url: '${contextRoot}/oauth2/report', icon: '${staticRoot}/images/index/Ins_icon.png'},--%>
                {id: 82, pid: 8, text: '质控报告', url: '${contextRoot}/report/initial', icon: '${staticRoot}/images/index/Ins_icon.png'},
                {id: 82, pid: 8, text: '质控报告', url: 'http://192.168.131.106:8080/esb/report/signin?user='+ehrUser, icon: '${staticRoot}/images/index/Ins_icon.png'},
                <%--{id: 83, pid: 8, text: '档案入库情况', url: '${contextRoot}/report/initialLs', icon: '${staticRoot}/images/index/Ins_icon.png'},--%>
                //系统配置
@ -161,7 +161,12 @@
                nodeWidth: 176,
                onSelect: function (obj) {
                	if (obj.data.url != undefined) {
                        me.openMenu(obj);
                        debugger
                        if(obj.data.url.indexOf("report/signin") >= 0){
                            me.loadIframePage(obj.data.url);//质控页面
                        }else{
                            me.openMenu(obj);
                        }
                    }
                	//选中子菜单时默认选中父菜单
                	if(obj.data.children == undefined){
@ -193,8 +198,7 @@
					});
                },
                onClick:function(obj){
                	
					
                },
                //一级节点不可选中
                onAfterAppend: function () {

+ 2 - 0
src/main/webapp/WEB-INF/ehr/jsp/common/signinJs.jsp

@ -24,6 +24,8 @@
                    success: function (data) {
                        if(data.successFlg){
                            debugger
                            window.localStorage.setItem("ehrUser", token);
                            location.href = '${contextRoot}/'+tenantName + '/oauth2/index?loginName='+data.obj.user;
                        }else{
                            location.href = '${contextRoot}/common/tokenValidFail';