|
@@ -0,0 +1,208 @@
|
|
|
+if(!Promise){
|
|
|
+ var Promise = require("bluebird");
|
|
|
+// Configure
|
|
|
+ Promise.config({
|
|
|
+ longStackTraces: true,
|
|
|
+ warnings: true // note, run node with --trace-warnings to see full stack traces for warnings
|
|
|
+ })
|
|
|
+}
|
|
|
+require('../css/informationOut.less')
|
|
|
+const {
|
|
|
+ post,
|
|
|
+ throttle,
|
|
|
+ imageUrlPrefix,
|
|
|
+ config,
|
|
|
+ getUrlArgObject
|
|
|
+} = require('./promise.js');
|
|
|
+const $ = require("jquery");
|
|
|
+let showName,noticeName,clinicalPathwayName,showLis=[]
|
|
|
+
|
|
|
+let icond = require('./../images/d.png').replace(/^undefined/g, '')
|
|
|
+function getInfomation() {
|
|
|
+ // var param = {
|
|
|
+ // "type": getUrlArgObject('type'),
|
|
|
+ // "name": getUrlArgObject('name'),
|
|
|
+ // "position": getUrlArgObject('position'),
|
|
|
+ // "contentTypes":[1,2,3]
|
|
|
+ // };
|
|
|
+ var param = {
|
|
|
+ "type": getUrlArgObject('type'),
|
|
|
+ "hospitalId": getUrlArgObject('hospitalId'),
|
|
|
+ "hisName": getUrlArgObject('hisName'),
|
|
|
+ "hisDetailName": getUrlArgObject('hisDetailName'),
|
|
|
+ "contentTypes":[1,2,3]
|
|
|
+ };
|
|
|
+ const uname = getUrlArgObject('uname')
|
|
|
+ // showName = param.name
|
|
|
+ // if (param.type == 5 || param.type == 51) {
|
|
|
+ // param.type = 12;
|
|
|
+ // param.name = uname;
|
|
|
+ // }
|
|
|
+
|
|
|
+ post(config.getStaticKnowledgeForHIS, param).then((res) => {
|
|
|
+ const data = res.data.data
|
|
|
+ var str = '';
|
|
|
+ var anchors = '';
|
|
|
+ if (!data||data.length==0) {
|
|
|
+ $("h1").html("暂时没有数据");
|
|
|
+ $(".anchors").css("display", "none");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ showLis=data
|
|
|
+ for(let i = 0;i < showLis.length;i++){
|
|
|
+ let tmp = showLis[i]
|
|
|
+ str+=`<li data-idx="${i}" title="${tmp.name}">${tmp.name}</li>`
|
|
|
+ }
|
|
|
+ $(".showWhich ul").html(str)
|
|
|
+ $(".showWhichSelect").html(showLis[0].name).attr("title",showLis[0].name)
|
|
|
+ showName = data[0].name
|
|
|
+ document.title = showName
|
|
|
+ showInfoSelect()
|
|
|
+ showInfo(data[0])
|
|
|
+ $('.content img').bind('contextmenu', function(){
|
|
|
+ return false
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+}
|
|
|
+getInfomation();
|
|
|
+
|
|
|
+function showInfo(data){
|
|
|
+ var detailList = data.details
|
|
|
+ var staticKnowList = detailList['静态知识']
|
|
|
+ var noticeInfo = detailList['注意事项']
|
|
|
+ var clinicalPathwayInfo = detailList['临床路径']
|
|
|
+ noticeName = data.noticeName || "注意事项"
|
|
|
+ clinicalPathwayName = data.clinicalPathwayName || "临床路径"
|
|
|
+ // $("h1").css({
|
|
|
+ // "color": "#267FD7",
|
|
|
+ // "borderBottom": "4px solid #E9E9E9",
|
|
|
+ // "padding": "0px 60px 50px 0px"
|
|
|
+ // });
|
|
|
+ renderTab(detailList)
|
|
|
+ staticKnowList&&renderContent(staticKnowList,'staticKnowledge')
|
|
|
+ noticeInfo&&renderContent(noticeInfo,'notice')
|
|
|
+ clinicalPathwayInfo&&renderContent(clinicalPathwayInfo,'clinicalPathway')
|
|
|
+}
|
|
|
+function showInfoSelect(){
|
|
|
+ $('.showWhich li').click(function(){
|
|
|
+ let idx = $(this).attr('data-idx')
|
|
|
+ let name = $(this).html(),str=''
|
|
|
+ showName = showLis[idx].name
|
|
|
+ document.title = showName
|
|
|
+ showInfo(showLis[idx])
|
|
|
+ $('.content .infos').scrollTop(0)
|
|
|
+ $(".showWhich ul").css("display","none")
|
|
|
+ $(".showWhichSelect").html(name).attr("title",name)
|
|
|
+ })
|
|
|
+ $(".showWhichSelect").click(function(e){
|
|
|
+ e.stopPropagation()
|
|
|
+ $(".showWhich ul").slideToggle()
|
|
|
+ })
|
|
|
+ $(document).click(function(){
|
|
|
+ $(".showWhich ul").css("display","none")
|
|
|
+ })
|
|
|
+}
|
|
|
+function renderContent(list, contentWrapClassName){
|
|
|
+ $(`.${contentWrapClassName} .infos`).html('');
|
|
|
+ $(`.${contentWrapClassName} .anchors ul`).html('');
|
|
|
+ for (var i = 0; i < list.length; i++) {
|
|
|
+ var item = list[i];
|
|
|
+ item.content = item.content&&item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
|
|
|
+ anchors = '<li><i></i><a href="#' + contentWrapClassName+i +
|
|
|
+ '">' + item.title + '</a></li><li class="anchor-line"></li>';
|
|
|
+ str = '<div class="infoBox"><div class="title"> <div class= "circleBox"><span class="circle"> </span></div> <h2 class="titleH2" id="' + contentWrapClassName+i +
|
|
|
+ '">'
|
|
|
+ if (getUrlArgObject('type') == 8) {
|
|
|
+ str += '【' + item.title + '】'
|
|
|
+ } else {
|
|
|
+ str += item.title
|
|
|
+ }
|
|
|
+ str += '</h2></div>' +
|
|
|
+ '<div class="contentWrapper"><pre>' + item.content + '</pre><div></div>';
|
|
|
+ str = `<div class="infoWrapper">${str}</div>`
|
|
|
+ $(`.${contentWrapClassName} .infos`).append(str);
|
|
|
+ $(`.${contentWrapClassName} .anchors ul`).append(anchors);
|
|
|
+ }
|
|
|
+
|
|
|
+ function addScrollEvent() {
|
|
|
+ var scrollTop = $(`.${contentWrapClassName} .infos`).scrollTop()
|
|
|
+
|
|
|
+ var divHeight = 0;
|
|
|
+ for (var i = 0; i < list.length; i++) {
|
|
|
+ divHeight = divHeight + parseInt($('#'+contentWrapClassName+i).css('height')) + parseInt($('#'+contentWrapClassName+i).parent().next().css('height')) + 20
|
|
|
+ if (divHeight > scrollTop) {
|
|
|
+ var anchor = 2 * i;
|
|
|
+ $(`.${contentWrapClassName} .anchors ul`).children().eq(anchor).addClass('active').siblings().removeClass('active');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(`.${contentWrapClassName} .infos`).scroll(throttle(addScrollEvent, 200));
|
|
|
+ addLinkClickEvent(contentWrapClassName);
|
|
|
+ adjustHeight();
|
|
|
+ adjustWidth()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function addLinkClickEvent(contentWrapClassName) {
|
|
|
+ $(`.${contentWrapClassName} .anchors li:first`).addClass("active");
|
|
|
+ $(`.${contentWrapClassName} .anchors li>a`).on("click", function () {
|
|
|
+
|
|
|
+ const that = this
|
|
|
+ setTimeout(function(){
|
|
|
+ $(`.${contentWrapClassName} .anchors .active`).removeClass('active');
|
|
|
+ $(that).parent().addClass("active");
|
|
|
+ },20)
|
|
|
+
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function renderTab(detailList){
|
|
|
+ $(".tabList").html('')
|
|
|
+ if(detailList['静态知识']){
|
|
|
+ $(".tabList").append(`<span class="tab" data-module="staticKnowledge">静态知识</span>`)
|
|
|
+ $(".staticKnowledge h1").html(showName);
|
|
|
+ }
|
|
|
+ if(detailList['临床路径']){
|
|
|
+ $(".tabList").append(`<span class="tab" data-module="clinicalPathway">临床路径</span>`)
|
|
|
+ $(".clinicalPathway h1").html(clinicalPathwayName);
|
|
|
+ }
|
|
|
+ if(detailList['注意事项']){
|
|
|
+ $(".tabList").append(`<span class="tab" data-module="notice">注意事项</span>`)
|
|
|
+ $(".notice h1").html(noticeName);
|
|
|
+ }
|
|
|
+ $(".tabList .tab").eq(0).addClass("activeTab")
|
|
|
+ let defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
|
|
|
+ $(`.${defaultModuleName}`).css("display","block")
|
|
|
+ bindTabClick()
|
|
|
+}
|
|
|
+function bindTabClick(){
|
|
|
+ $(".tabList .tab").on("click", function(){
|
|
|
+ const moduleName = $(this).attr("data-module")
|
|
|
+ const display = $(`.${moduleName}`).css("display")
|
|
|
+ if(display == "none"){
|
|
|
+ $(".activeTab").removeClass("activeTab")
|
|
|
+ $(this).addClass("activeTab")
|
|
|
+ $(".container").css("display","none")
|
|
|
+
|
|
|
+ $(`.${moduleName}`).css("display","block")
|
|
|
+ $(`.${moduleName} .infos`).scrollTop(0)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+function adjustHeight() {
|
|
|
+ var ht = window.innerHeight || document.documentElement.clientHeight;
|
|
|
+ $(".content").height(ht - 145 - 30 + "px");
|
|
|
+}
|
|
|
+function adjustWidth() {
|
|
|
+ var wt = window.innerWidth || document.documentElement.clientWidth;
|
|
|
+ $(".titleH2").width(wt- 0.2*wt -33 - 200 - 17 - 40 -15 + 'px')
|
|
|
+ $("pre").width(wt- 0.2*wt - 200 + 'px')
|
|
|
+}
|
|
|
+$(window).on('resize', function(){
|
|
|
+ adjustHeight()
|
|
|
+ adjustWidth()
|
|
|
+})
|
|
|
+
|