staticInfo.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. if (!Promise) {
  2. var Promise = require("bluebird");
  3. // Configure
  4. Promise.config({
  5. longStackTraces: true,
  6. warnings: true // note, run node with --trace-warnings to see full stack traces for warnings
  7. })
  8. }
  9. require('../css/staticInfo.less')
  10. require('../css/print.css')
  11. const {
  12. post,
  13. throttle,
  14. imageUrlPrefix,
  15. config,
  16. getUrlArgObject,
  17. openNewWin,
  18. Toast
  19. } = require('./promise.js');
  20. const $ = require("jquery");
  21. const print = require("../js/jQuery.print")
  22. let printing = require('./../images/printing.png');
  23. let printing2 = require('./../images/printing2.png');
  24. let recommend = require('./../images/recommend.png');
  25. let hel = require('./../images/icon-hel.png');
  26. let showName, noticeName, clinicalPathwayName, isclick,top = 0
  27. function myBrowser() {
  28. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  29. var isOpera = userAgent.indexOf("Opera") > -1;
  30. if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
  31. return "IE";
  32. }; //判断是否IE浏览器
  33. }
  34. function getInfomation() {
  35. var param = {
  36. "type": getUrlArgObject('type'),
  37. "name": getUrlArgObject('name'),
  38. "position": getUrlArgObject('position'),
  39. "contentTypes": [1, 2, 3],
  40. "mrId": getUrlArgObject('mrId')
  41. };
  42. showName = param.name
  43. $(".tabBox .title").html(showName);
  44. post(config.information, param).then((res) => {
  45. const data = res.data.data
  46. // const data = dataaaa.data
  47. document.title = showName
  48. var str = '';
  49. var anchors = '';
  50. if (!data) {
  51. $(".title").html("暂时没有数据");
  52. $(".anchors").css("display", "none");
  53. return;
  54. }
  55. var detailList = data.details
  56. var isCalculate = data.id===179208; //是否是写死的计算公式
  57. var scale = data.scale||isCalculate;
  58. var staticKnowList = detailList['静态知识']
  59. var noticeInfo = detailList['注意事项']
  60. var clinicalPathwayInfo = detailList['临床路径']
  61. var scaleInfo = data.scale ? data.scale.scaleDetails : ''
  62. var name = data.name
  63. noticeName = data.noticeName || "注意事项"
  64. clinicalPathwayName = data.clinicalPathwayName || "临床路径"
  65. renderTab(detailList, scale)
  66. staticKnowList && renderContent(staticKnowList, 'staticKnowledge')
  67. noticeInfo && renderContent(noticeInfo, 'notice')
  68. clinicalPathwayInfo && renderContent(clinicalPathwayInfo, 'clinicalPathway')
  69. scaleInfo && renderContentscale(scaleInfo, 'scale', name)
  70. isCalculate && renderCalculate();
  71. $('.content img').bind('contextmenu', function () {
  72. return false
  73. })
  74. })
  75. }
  76. getInfomation();
  77. function renderContent(list, contentWrapClassName) {
  78. for (var i = 0; i < list.length; i++) {
  79. var item = list[i];
  80. item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  81. anchors = '<li><i></i><a href="#' + contentWrapClassName + i +
  82. '">' + item.title + '</a></li><li class="anchor-line"></li>';
  83. str = '<div class="infoBox"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
  84. '">'
  85. /*if (getUrlArgObject('type') == 8) {
  86. str += '【' + item.title + '】'
  87. } else {*/
  88. str += item.title
  89. /*}*/
  90. str += '</h2></div>' +
  91. '<div class="contentWrapper"><pre>' + item.content + '</pre><div></div>';
  92. str = `<div class="infoWrapper">${str}</div>`
  93. $(`.${contentWrapClassName} .infos`).append(str);
  94. $(`.${contentWrapClassName} .anchors ul`).append(anchors);
  95. }
  96. function addScrollEvent() {
  97. var scrollTop = $(`.${contentWrapClassName} .infos`).scrollTop()
  98. var divHeight = 0;
  99. for (var i = 0; i < list.length; i++) {
  100. divHeight = divHeight + parseInt($('#' + contentWrapClassName + i).css('height')) + parseInt($('#' + contentWrapClassName + i).parent().next().css('height')) + 20
  101. if (divHeight > scrollTop) {
  102. var anchor = 2 * i;
  103. $(`.${contentWrapClassName} .anchors ul`).children().eq(anchor).addClass('active').siblings().removeClass('active');
  104. return;
  105. }
  106. }
  107. }
  108. $(`.${contentWrapClassName} .infos`).scroll(throttle(addScrollEvent, 200));
  109. addLinkClickEvent(contentWrapClassName);
  110. adjustHeight();
  111. adjustWidth()
  112. }
  113. //计算公式写死
  114. function renderCalculate(){
  115. let str;
  116. str=`<div class='computedgs'>
  117. <div class='cgs_top'>
  118. <div class='l_content'>
  119. <label class='gs_x'>*</label><label class="gs_wz gs_wzs">宫高</label>
  120. <div class='d_inpt'>
  121. <input type="text" name="username" placeholder="请输入" class="gs_ipt" autocomplete="off" id='ipt1' maxlength='5'>
  122. <label class='yz l_yz' style="color:red;display:none;">格式错误,请输入数字</label>
  123. </div>
  124. <label class="gs_wz gs_wzl">cm</label>
  125. </div>
  126. <div class='r_content'>
  127. <label class='gs_x'>*</label><label class="gs_wz gs_wzs">孕月</label>
  128. <div class='d_inpt'>
  129. <input type="text" name="username" placeholder="请输入" class="gs_ipt" id='ipt2' autocomplete="off" maxlength='3'>
  130. <label class='yz r_yz' style="color:red;display:none;">格式错误,请输入数字</label>
  131. </div>
  132. <label class="gs_wz gs_wzl">月</label>
  133. </div>
  134. <div class='c_end clearfix'>
  135. <span class="c_btn">结果</span>
  136. </div>
  137. <div class='b_content'>
  138. <div class="m_w300">
  139. <p class='b_end m_auto'>结果:<p>
  140. <p class='m_auto'>胎儿发育指数=宫高(cm)-3*(孕月+1) <p>
  141. <p class='m_auto'>正常值范围:指数在-3与+3之间为正常儿,低于-3则有FGR的可能<p>
  142. <div>
  143. <div>
  144. </div>
  145. </div>`;
  146. let gongGao=''; //宫高
  147. let pregnant=''; //孕月
  148. let flagGongGao=false; // 判断宫高是否有值
  149. let flagPregnant=false; //判断宫高孕月是否有值
  150. let endNum=''; //结果
  151. $('.infos-box').append(str);
  152. // 输入判断是否为数字
  153. function numCheck(val,node1,node2,flag){
  154. // val=val.trim()
  155. val=val.replace(/^\s+|\s+$/g,"");
  156. let regs = new RegExp("^[0-9]*$");
  157. if(!regs.test(val)|| !val){
  158. $(node1).show()
  159. $(node1).text('格式错误,请输入数字')
  160. $(node1).css({left:'14px'})
  161. $(node2).addClass("gs_iptq");
  162. flag=false;
  163. return flag
  164. }else{
  165. $(node1).hide()
  166. $(node2).removeClass("gs_iptq");
  167. flag=true;
  168. return flag
  169. }
  170. }
  171. // 宫高输入验证
  172. $('#ipt1').blur(function(){
  173. let val=this.value
  174. gongGao=val
  175. flagGongGao=numCheck(val,'.l_yz','#ipt1',flagGongGao)
  176. })
  177. // 孕月输入验证
  178. $('#ipt2').blur(function(){
  179. let val=this.value
  180. pregnant=val
  181. flagPregnant=numCheck(val,'.r_yz','#ipt2',flagPregnant)
  182. })
  183. // 点击结果
  184. $('.c_btn').click(function(){
  185. // 宫高没有输入
  186. if(!gongGao&&pregnant){
  187. $('.l_yz').show()
  188. $('.l_yz').text('请输入宫高')
  189. $('.l_yz').css({left:'-25px'})
  190. $('.r_yz').css({left:'14px'})
  191. }else if(!pregnant && gongGao){
  192. // 孕月没有输入
  193. $('.r_yz').text('请输入孕月')
  194. $('.r_yz').show()
  195. $('.r_yz').css({left:'-25px'})
  196. $('.l_yz').css({left:'14px'})
  197. }else if(!gongGao && !pregnant){
  198. // 宫高孕月没有输入
  199. $('.r_yz').text('请输入孕月')
  200. $('.l_yz').text('请输入宫高')
  201. $('.r_yz').show()
  202. $('.l_yz').show()
  203. $('.r_yz').css({left:'-25px'})
  204. $('.l_yz').css({left:'-25px'})
  205. }else{
  206. // 改变验证定位的位置
  207. $('.r_yz').css({left:'14px'})
  208. $('.l_yz').css({left:'14px'})
  209. }
  210. if(flagPregnant&&flagGongGao){
  211. endNum=gongGao-3*(pregnant*1+1); //结果计算
  212. // 将值显示在页面上
  213. let str1=`<span class="end_child"><span>结果:胎儿发育指数</span><span class='end_ys'>${endNum}</span></span>`
  214. $('.b_end').text('')
  215. $('.b_end').append(str1)
  216. // 颜色区分正常和不正常
  217. // if(endNum<-3 ||endNum>3){
  218. // $('.end_ys').css({
  219. // color:'#F45454'
  220. // })
  221. // }else{
  222. // $('.end_ys').css({
  223. // color:'#333'
  224. // })
  225. // }
  226. }else{
  227. // 移除
  228. if($('.end_child').length>0){
  229. $('.end_child').remove()
  230. $('.b_end').text('结果:')
  231. }
  232. }
  233. })
  234. // 适配改变样式
  235. function Adaptation(){
  236. let widths=$(document).width();
  237. if(widths<=1025) {
  238. $('.cgs_top').addClass('cgs_tops')
  239. }else{
  240. $('.cgs_top').removeClass('cgs_tops')
  241. }
  242. }
  243. Adaptation()
  244. $(window).bind('load resize',Adaptation)
  245. }
  246. //量表评估内容
  247. function renderContentscale(list, contentWrapClassName, name) {
  248. var pushInfo = []
  249. var textType = []
  250. var constant = 0
  251. $('.scaletitle').html(name);
  252. for (var i = 0; i < list[0].detailList.length; i++) {
  253. var item = list[0].detailList[i];
  254. textType.push(item.textType)
  255. if (item.resultType == 1) {
  256. constant += parseFloat(item.constant)
  257. }
  258. if (item.textType == 11) {
  259. item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  260. str = '<div class="infoBox scaleBox" data-id="' + item.id + '"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
  261. '">'
  262. str += item.content
  263. str += '</h2></div>'
  264. str = `<div class="infoWrapper">${str}</div>`
  265. $(`.${contentWrapClassName} .infos .infos-box`).append(str);
  266. for (var j = 0; j < item.subList.length; j++) {
  267. var items = item.subList[j];
  268. for (var k = 0; k < items.detailList.length; k++) {
  269. var it = items.detailList[k];
  270. it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  271. str = '<div class="contentList" data-id="' + it.parentId + '-' + it.groupNum + '"><div class="item-list">';
  272. if (it.selectType == 21) {
  273. str += '<p class="item-title">' + it.content + '</p>'
  274. } else if (it.selectType == 22) {
  275. str += '<p class="item-titles">' + it.content + '</p>'
  276. }
  277. str += '<div class="item-content" data-id="' + it.id + '">'
  278. str += '</div></div></div>'
  279. $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
  280. for (var l = 0; l < it.subList[0].detailList.length; l++) {
  281. var its = it.subList[0].detailList[l];
  282. its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  283. str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
  284. if (it.selectType == 21 && item.resultType == 1) {
  285. str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor)) + '" resultType="' + item.resultType + '"/>'
  286. } else if (it.selectType == 22 && item.resultType == 1) {
  287. str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor)) + '" resultType="' + item.resultType + '"/>'
  288. } else if (it.selectType == 21 && item.resultType == 2) {
  289. str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
  290. } else if (it.selectType == 22 && item.resultType == 2) {
  291. str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
  292. }
  293. str += '<span class="inp">' + its.content + '</span>'
  294. if (item.resultType == 1) {
  295. str += '<span class="num">(' + its.score + ')</span>'
  296. }
  297. str += '</label>'
  298. str += `${its.match == 1 ? `<img class="recommend" src="./../images/recommend.png" />` : ``}</div>`
  299. $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "] .contentList .item-content[data-id=" + its.parentId + "]").append(str);
  300. }
  301. }
  302. }
  303. }
  304. if (item.textType == 12) {
  305. item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  306. str = '<div class="infoBox scaleBox" data-id="' + item.id + '"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
  307. '">'
  308. str += item.content
  309. str += '</h2></div>'
  310. str = `<div class="infoWrapper">${str}</div>`
  311. $(`.${contentWrapClassName} .infos .infos-box`).append(str);
  312. for (var j = 0; j < item.subList.length; j++) {
  313. var items = item.subList[j];
  314. for (var k = 0; k < items.detailList.length; k++) {
  315. var it = items.detailList[k];
  316. it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  317. str = '<div class="contentList" data-id="' + it.parentId + '-' + it.groupNum + '"><div class="item-list">';
  318. str += it.content
  319. str += '<div class="item-content" data-id="' + it.id + '">'
  320. str += '</div></div></div>'
  321. $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
  322. }
  323. }
  324. }
  325. if (item.textType == 13) {
  326. for (var m = 0; m < item.subList[0].detailList[0].subList[0].detailList.length; m++) {
  327. var itl = item.subList[0].detailList[0].subList[0].detailList[m]
  328. let arr = {
  329. content: JSON.parse(itl.content),
  330. result: itl.result,
  331. pushInfo: itl.pushInfo
  332. }
  333. pushInfo.push(arr)
  334. }
  335. }
  336. }
  337. str = '<div class="scalebot">'
  338. str += '<button class="but">结果</button><p class="score"></p>'
  339. str += '</div>'
  340. str += `<div class="result"><div class="result_box"><div class="result_left"><img src="./../images/icon-hel.png" class="hel"/><p id="result_title" class="result_title"></p></div><textarea id="inputs"></textarea><p id="result_title_tip" class="result_title_tip">该量表需要入院当天评估一次,出院当天评估一次,每七天要评估一次</p></div></div>`
  341. str += `<div class="foot"><div class="foot_box"><div class="printing"><img src="./../images/printing.png" class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
  342. $(`.${contentWrapClassName} .infos .infos-box`).append(str);
  343. function addScrollEvent() {
  344. var scrollTop = $(`.${contentWrapClassName} .infos .infos-box`).scrollTop()
  345. var divHeight = 0;
  346. for (var i = 0; i < list.length; i++) {
  347. divHeight = divHeight + parseInt($('#' + contentWrapClassName + i).css('height')) + parseInt($('#' + contentWrapClassName + i).parent().next().css('height')) + 20
  348. if (divHeight > scrollTop) {
  349. var anchor = 2 * i;
  350. $(`.${contentWrapClassName} .anchors ul`).children().eq(anchor).addClass('active').siblings().removeClass('active');
  351. return;
  352. }
  353. }
  354. }
  355. $(`.${contentWrapClassName} .infos .infos-box`).scroll(throttle(addScrollEvent, 200));
  356. addLinkClickEvent(contentWrapClassName);
  357. adjustHeight();
  358. adjustWidth()
  359. getcheck()
  360. getResult(pushInfo, textType, constant)
  361. copy(name)
  362. getprinting()
  363. }
  364. function getprinting() {
  365. $('.printing').click(function () {
  366. $('.printing').click(function () {
  367. $('.foot').hide()
  368. $('.scalebot').hide()
  369. $('.result_title_tip').hide()
  370. $('#Print').css({
  371. 'height': 'auto', //高度自动
  372. }).print();
  373. $('.foot').show()
  374. $('.scalebot').show()
  375. $('.result_title_tip').show()
  376. $('#Print').css({
  377. 'height': '100%', //高度自动
  378. });
  379. })
  380. })
  381. }
  382. function getcheck() {
  383. $('input:radio').click(function () {
  384. const domName = $(this).attr('name');
  385. const $radio = $(this);
  386. const id = $(this).parents('.contentList').data("id");
  387. if ($radio.data('waschecked') == true) {
  388. $radio.prop('checked', false);
  389. $("input:radio[name='" + domName + "']").data('waschecked', false);
  390. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
  391. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#666666");
  392. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#333333");
  393. if (isclick) {
  394. getchecks()
  395. $(".score").html('');
  396. $(".result_title").html('');
  397. $(".result").css('display', 'none')
  398. $(".foot").css('display', 'none')
  399. }
  400. } else {
  401. $radio.prop('checked', true);
  402. $("input:radio[name='" + domName + "']").data('waschecked', false);
  403. $radio.data('waschecked', true);
  404. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
  405. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#C7C7C7");
  406. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#C7C7C7");
  407. if (isclick) {
  408. getchecks()
  409. $(".score").html('');
  410. $(".result_title").html('');
  411. $(".result").css('display', 'none')
  412. $(".foot").css('display', 'none')
  413. }
  414. }
  415. });
  416. $('input:checkbox').click(function () {
  417. const domName = $(this).attr('name');
  418. const $radio = $(this);
  419. const id = $(this).parents('.contentList').data("id");
  420. $radio.parents('.contentList').each(function (i) {
  421. if ($(this).find('input[type="checkbox"]:checked').val() == undefined) {
  422. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
  423. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#666666");
  424. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#333333");
  425. if (isclick) {
  426. getchecks()
  427. $(".score").html('');
  428. $(".result_title").html('');
  429. $(".result").css('display', 'none')
  430. $(".foot").css('display', 'none')
  431. }
  432. } else {
  433. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
  434. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#C7C7C7");
  435. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#C7C7C7");
  436. if (isclick) {
  437. getchecks()
  438. $(".score").html('');
  439. $(".result_title").html('');
  440. $(".result").css('display', 'none')
  441. $(".foot").css('display', 'none')
  442. }
  443. }
  444. })
  445. });
  446. }
  447. $('#Print').on('scroll', function () {
  448. top = $('#Print').scrollTop()
  449. })
  450. function copy(name) {
  451. $(".copy").click(function () {
  452. var texts = document.getElementById("result_title").innerText;
  453. if (texts == '') {
  454. Toast('温馨提示:结果为空,无法复制', 500, 'warn')
  455. return
  456. }
  457. var inputs = document.getElementById("inputs");
  458. inputs.value = name + '结果为:' + texts.substring(3); // 修改文本框的内容(赋值内容)
  459. inputs.select(); // 选中文本
  460. document.execCommand("copy"); // 执行浏览器复制命令
  461. Toast('复制成功', 500, 'success')
  462. })
  463. }
  464. function getchecks() {
  465. $(".contentList").each(function (i) {
  466. if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  467. $(this).find(".item-title").addClass('chColor');
  468. } else {
  469. $(this).find(".item-title").removeClass('chColor');
  470. }
  471. if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  472. $(this).find(".item-titles").addClass('chColor');
  473. } else {
  474. $(this).find(".item-titles").removeClass('chColor');
  475. }
  476. });
  477. }
  478. function getResult(pushInfo, textType, constant) {
  479. $(".but").click(function () {
  480. let arr = [];
  481. let multarr = []
  482. let multname
  483. let num = 0
  484. let result
  485. let key = false
  486. let proposal = ''
  487. let proposals = []
  488. let scrollTop = []
  489. let v
  490. let numType = false
  491. isclick = true
  492. for (var i = 0; i < textType.length; i++) {
  493. if (textType[i] == 13) {
  494. numType = true
  495. }
  496. }
  497. $(".contentList").each(function (i) {
  498. if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  499. $(this).find(".item-title").addClass('chColor');
  500. } else {
  501. $(this).find(".item-title").removeClass('chColor');
  502. }
  503. if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  504. $(this).find(".item-titles").addClass('chColor');
  505. } else {
  506. $(this).find(".item-titles").removeClass('chColor');
  507. }
  508. scrollTop.push($(this).eq(0).find(".chColor").offset())
  509. });
  510. for (var i = 0; i < scrollTop.length; i++) {
  511. if (scrollTop[i] != undefined) {
  512. v = scrollTop[i]
  513. break
  514. }
  515. }
  516. if (v) {
  517. $(`.scale .infos`).scrollTop(v.top + top-160)
  518. }
  519. if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
  520. $('input[type="radio"]:checked').each(function () {
  521. if ($(this).attr("resultType") == 1) {
  522. num += parseFloat($(this).val())
  523. } else {
  524. arr.push($(this).attr("data_obj"))
  525. proposals.push($(this).attr("proposal"))
  526. }
  527. });
  528. $('input[type="checkbox"]:checkbox:checked').each(function () {
  529. if ($(this).attr("resultType") == 1) {
  530. num += parseFloat($(this).val())
  531. } else {
  532. arr.push($(this).attr("data_obj"))
  533. proposals.push($(this).attr("proposal"))
  534. }
  535. });
  536. num = num + constant
  537. num = parseFloat(num)
  538. tmp = arr.join(";");
  539. if (pushInfo.length > 0) {
  540. for (var i = 0; i < pushInfo.length; i++) {
  541. if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && !tmp) {
  542. result = pushInfo[i].result + '(' + num.toFixed(2) + '分' + ')'
  543. if (proposals.join(";")) {
  544. proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
  545. } else {
  546. proposal = pushInfo[i].pushInfo
  547. }
  548. break
  549. } else if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && tmp) {
  550. result = pushInfo[i].result + '(' + num.toFixed(2) + '分' + ')' + ';' + tmp
  551. if (proposals.join(";")) {
  552. proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
  553. } else {
  554. proposal = pushInfo[i].pushInfo
  555. }
  556. break
  557. } else {
  558. result = tmp
  559. proposal = proposals.join(";");
  560. }
  561. }
  562. } else {
  563. result = tmp
  564. proposal = proposals.join(";");
  565. }
  566. if (result) {
  567. $(".hel").attr({
  568. "title": proposal
  569. });
  570. $(".result_title").html('结果:' + result);
  571. if (num >= 0 && numType) {
  572. $(".score").html('总分:' + num.toFixed(2) + '分');
  573. }
  574. $(".result").css('display', 'block')
  575. $(".score").css('display', 'block')
  576. $(".copy").css('display', 'block')
  577. $(".foot").css('display', 'block')
  578. } else {
  579. if (num >= 0 && numType) {
  580. $(".score").html('总分:' + num.toFixed(2) + '分');
  581. $(".result_title").html('结果:' + num.toFixed(2));
  582. $(".copy").css('display', 'block')
  583. $(".hel").css('display', 'block')
  584. }
  585. $(".result").css('display', 'block')
  586. $(".hel").css('display', 'none')
  587. $(".score").css('display', 'block')
  588. $(".copy").css('display', 'none')
  589. $(".foot").css('display', 'block')
  590. }
  591. } else {
  592. Toast('温馨提示:必填选项不能为空~', 500, 'warn')
  593. }
  594. })
  595. $(".printing").hover(
  596. function () {
  597. $(".slideImg").attr("src", "./../images/printing2.png");
  598. }, function () {
  599. $(".slideImg").attr("src", "./../images/printing.png");
  600. });
  601. }
  602. function addLinkClickEvent(contentWrapClassName) {
  603. $(`.${contentWrapClassName} .anchors li:first`).addClass("active");
  604. $(`.${contentWrapClassName} .anchors li>a`).on("click", function () {
  605. const that = this
  606. setTimeout(function () {
  607. $(`.${contentWrapClassName} .anchors .active`).removeClass('active');
  608. $(that).parent().addClass("active");
  609. }, 20)
  610. });
  611. }
  612. function renderTab(detailList, scale) {
  613. if (detailList['静态知识']) {
  614. $(".tabList").append(`<span class="tab" data-module="staticKnowledge" data-title="` + showName + `">静态知识</span>`)
  615. }
  616. if (detailList['临床路径']) {
  617. $(".tabList").append(`<span class="tab" data-module="clinicalPathway" data-title="` + clinicalPathwayName + `">临床路径</span>`)
  618. //$(".tabBox .title").html(clinicalPathwayName);
  619. }
  620. if (detailList['注意事项']) {
  621. $(".tabList").append(`<span class="tab" data-module="notice" data-title="` + noticeName + `">注意事项</span>`)
  622. //$(".tabBox .title").html(noticeName);
  623. }
  624. if (!!scale && getUrlArgObject('type') == 8) {
  625. $(".tabList").append(`<span class="tab" data-module="scale" data-title="` + showName + `">评估内容</span>`)
  626. //$(".tabBox .title").html(noticeName);
  627. }
  628. let defaultModuleName
  629. if (getUrlArgObject('page') && getUrlArgObject('page') == 1 && scale && detailList['静态知识']) {
  630. $(".tabList .tab").eq(1).addClass("activeTab")
  631. defaultModuleName = $(".tabList .tab").eq(1).attr("data-module")
  632. } else {
  633. $(".tabList .tab").eq(0).addClass("activeTab")
  634. defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
  635. }
  636. $(`.${defaultModuleName}`).css("display", "block")
  637. bindTabClick()
  638. }
  639. function bindTabClick() {
  640. $(".tabList .tab").on("click", function () {
  641. const moduleName = $(this).attr("data-module")
  642. const display = $(`.${moduleName}`).css("display")
  643. $(".tabBox .title").html($(this).attr('data-title'));
  644. if (display == "none") {
  645. $(".activeTab").removeClass("activeTab")
  646. $(this).addClass("activeTab")
  647. $(".container").css("display", "none")
  648. $(`.${moduleName}`).css("display", "block")
  649. $(`.${moduleName} .infos`).scrollTop(0)
  650. }
  651. })
  652. $("#openWin").on("click", function () {
  653. const type = getUrlArgObject('type');
  654. const name = getUrlArgObject('name');
  655. const position = getUrlArgObject('position');
  656. openNewWin("staticInfo.html?name=" + encodeURIComponent(name) + "&position=" + encodeURIComponent(position) + "&type=" + encodeURIComponent(type));
  657. })
  658. }
  659. function adjustHeight() {
  660. var ht = window.innerHeight || document.documentElement.clientHeight;
  661. $(".content").height(ht - 160 + "px");
  662. $(".content .infos").height(ht - 170 + "px");
  663. $(".content .anchors").height(ht - 217 + "px");
  664. }
  665. function adjustWidth() {
  666. var wt = window.innerWidth || document.documentElement.clientWidth;
  667. $(".titleH2").width(wt - 0.2 * wt - 33 - 200 - 17 - 40 - 15 + 'px')
  668. $(".content .infos").width(wt - 210 - 33 - 17 - 40 - 15 + 'px');
  669. }
  670. $(window).on('resize', function () {
  671. adjustHeight()
  672. adjustWidth()
  673. })
  674. //如果是子窗口,隐藏网页查看按钮
  675. if (window.opener) {
  676. $("#openWin").hide();
  677. }