qcScore.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. require("../css/qcScore.less");
  2. const $ = require('jquery');
  3. require('jquery-templates');
  4. require('./modal.js');
  5. const { post, getUrlArgObject, setBoxHeight, getCookie, getLocal, initScroll } = require('./utils.js');
  6. const { api, ywCheckApi } = require('./api.js');
  7. let checkOk = require('./../images/checkOk.png')
  8. const adLogo = require("../images/adlogo.png")
  9. if (localStorage.getItem('toLogin') === '1') {
  10. window.location.href = '../login.html';
  11. }
  12. $(function () {
  13. const hideLogo = getUrlArgObject("hideLg");
  14. if (hideLogo) {
  15. $(".sub-menu .logo img,.copy-right").remove();
  16. $(".menu-mini .logo").text("");
  17. }
  18. const otherLogo = getUrlArgObject("adLg");
  19. if (otherLogo) {
  20. $(".logo img").attr("src", adLogo);
  21. $(".menu-mini .logo").text("艾登");
  22. $(".copy-right").remove();
  23. }
  24. //本页全局变量
  25. let global_flawData = {}; //缺陷数据
  26. let global_flawDataPay = {}; //缺陷数据
  27. const global_id = getUrlArgObject("id");
  28. const global_hid = getUrlArgObject("hid");
  29. let global_check;
  30. let global_check_home, global_check_show, check_Operation_WithAppeal;
  31. let global_entryName, global_casesEntryId
  32. const global_code = getUrlArgObject("code");
  33. let global_activeTab = $(".sub-menu .page.active").attr("code"); //当前激活菜单项
  34. let global_modules = {}; //模板数据缓存
  35. let global_flaws = []; //缺陷条目列表缓存
  36. let global_selectedFlaw = {}; //新增时选中的条目信息
  37. getAllModules();
  38. let showCheckBtns = global_code === "YH-ZKHC-HCRWLB";
  39. window.document.title = (showCheckBtns ? "质控核查-" : "质控评分-") + getUrlArgObject("name");
  40. let hasAu3 = showCheckBtns && hasData('FUNC000011'); //新增缺陷权限
  41. if (hasAu3) {
  42. $(".add-flaw").click(function () {
  43. getQcCasesEntry();
  44. });
  45. }
  46. $("body").on("click", ".refreshBtn", function () {
  47. // $(".flaw-box").html('')
  48. // $(".patient-info").html('')
  49. // $("#subMenu").html('')
  50. $("#contentInfo").html('')
  51. // console.log(global_activeTab);
  52. getRecordDetailUpdate2()
  53. });
  54. function showAppealDetailEvent() {
  55. //申诉状态点击事件
  56. $(".flaw-item").off("click").on("click", ".title .btn", function () {
  57. showModal("5", $(this).attr("data_id"), $(this).attr("data_type"), $(this).attr("data_casesEntryId"), $(this).attr("data_qcresultDetailId"));
  58. });
  59. }
  60. function initMenu(data) {
  61. const menu = [{ id: 0, name: "缺陷总览", parentId: -1, sonMode: [] }, ...(data || [])];
  62. //菜单数据填充
  63. $("#subMenuTmpl").tmpl(menu).appendTo("#subMenu");
  64. $("#miniMenuTmpl").tmpl(menu).appendTo(".menu-mini ul");
  65. //菜单收起展开
  66. $(document).on("click", ".sub-menu .list-1", function () {
  67. $(".sub-menu .list-1 .slide-up").removeClass('slide-up');
  68. $(this).toggleClass('slide-up');
  69. $(this).find("ul").slideToggle();
  70. // setTimeout(function(){
  71. // initScroll("subMenu","Y",2)
  72. // },300)
  73. });
  74. $(".sub-menu .list-1 li").on("click", function (e) {
  75. e.stopPropagation();
  76. });
  77. //收起菜单
  78. $(".slide-show").click(function () {
  79. $(".sub-menu,.copy-right").animate({ "width": "60px" }, function () {
  80. $(this).hide();
  81. $(".menu-mini").show();
  82. });
  83. $(".tab-container").animate({ "margin-left": "60px" });
  84. });
  85. //展开菜单
  86. $(".slide-hide").click(function () {
  87. $(".menu-mini").hide();
  88. $(".sub-menu,.copy-right").show().animate({ "width": "220px" }, function () {
  89. });
  90. $(".tab-container").animate({ "margin-left": "220px" });
  91. });
  92. //右侧内容切换
  93. $(".page").on("click", function () {
  94. $(".info-item .cont,.flaw-item,td").removeClass("active"); //清空缺陷定位背景
  95. const title = $(this).attr("code");
  96. if (title == '缺陷总览' || !global_check_show) { //质控核查页进来隐藏原核查按钮
  97. $(".check,.ywCheck").css('display', 'none')
  98. }/*else if(title == '病案首页'){
  99. if(showCheckBtns){
  100. $(".ywCheck").show();
  101. }else{
  102. $(".check").css('display','block').text(global_check_home==1?'重新核查':'病案首页核查')
  103. }
  104. }*/else {
  105. if (showCheckBtns) {
  106. $(".ywCheck").show();
  107. } else {
  108. $(".check").css('display', 'block').text(global_check == 1 ? '重新核查' : '病历核查')
  109. }
  110. }
  111. if (title === "缺陷总览" || title === "谈话告知书" || title === "知情同意书" || title === '医嘱信息' || title === '检验信息' || title === '检查信息' || title === '护理信息' || title === '其他信息') {
  112. if (title === "缺陷总览") {
  113. getRecordDetailUpdate()
  114. }
  115. $(".flaw-table .page-item").hide();
  116. $(".flaw-table,.flaw-table .page-item[code=" + title + "]").show();
  117. } else {
  118. $(".flaw-table").hide();
  119. }
  120. iframeShow(title)
  121. //选中样式
  122. $(".sub-menu .active,.menu-mini .active").removeClass('active');
  123. const mItems = $(".sub-menu .page[code=" + title + "],.menu-mini .page[code=" + title + "]");
  124. mItems.addClass("active");
  125. mItems.parents(".list-1").addClass("active");
  126. //显示对应内容
  127. const code = $(this).attr("code");
  128. global_activeTab = code;
  129. //initModuleData();
  130. $(".content-item,.flaw-item").hide();
  131. $(".content-item[code='" + code + "']").show();
  132. showFlawList();
  133. $("#contentInfo").scrollTop(0)
  134. });
  135. // initScroll("subMenu","Y",2)
  136. }
  137. function iframeShow(title) {
  138. if (title === '医嘱信息') {
  139. $("#pacsIframeIn,#assistIframeIn,#pacsDetailIframeIn,#contentNursing,#contentOther").css("display", "none")
  140. $("#contentIframeIn").css({ display: 'block' }).attr("src", 'advice.html').contents().find(".adviceWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  141. $(window).resize(function () {
  142. $("#contentIframeIn").contents().find(".adviceWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  143. });
  144. } else if (title === '检验信息') {
  145. $("#contentIframeIn,#assistIframeIn,#pacsDetailIframeIn,#contentNursing,#contentOther").css("display", "none")
  146. $("#pacsIframeIn").css({ display: 'block' }).attr("src", 'pacs.html').contents().find(".pacsWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  147. $(window).resize(function () {
  148. $("#pacsIframeIn").contents().find(".pacsWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  149. });
  150. } else if (title === '检查信息') {
  151. $("#contentIframeIn,#pacsIframeIn,#pacsDetailIframeIn,#contentNursing,#contentOther").css("display", "none")
  152. $("#assistIframeIn").css({ display: 'block' }).attr("src", 'assist.html').contents().find(".assistWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  153. $(window).resize(function () {
  154. $("#assistIframeIn").contents().find(".assistWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  155. });
  156. } else if (title === '护理信息') {
  157. $("#pacsIframeIn,#assistIframeIn,#pacsDetailIframeIn,#contentIframeIn,#contentOther").css("display", "none")
  158. $("#contentNursing").css({ display: 'block' }).attr("src", 'nursing.html').contents().find(".nursingWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  159. $(window).resize(function () {
  160. $("#contentNursing").contents().find(".nursingWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  161. });
  162. } else if (title === '其他信息') {
  163. $("#pacsIframeIn,#assistIframeIn,#pacsDetailIframeIn,#contentIframeIn,#contentNursing").css("display", "none")
  164. $("#contentOther").css({ display: 'block' }).attr("src", 'other.html').contents().find(".otherWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  165. $(window).resize(function () {
  166. $("#contentOther").contents().find(".otherWrp").height(window.innerHeight - $("#patientInfo").height() - 20 + 'px')
  167. });
  168. } else {
  169. $("#contentIframeIn,#pacsIframeIn,#pacsDetailIframeIn,#assistIframeIn,#contentNursing,#contentOther").css({ display: 'none' })
  170. }
  171. }
  172. //判断有无某一权限
  173. function hasData(data) {
  174. return true
  175. let trdObj = JSON.parse(getLocal("trdObj"))
  176. let lis = trdObj[global_code]
  177. if (!lis) {
  178. return false
  179. }
  180. if (lis.indexOf(data) > -1) {//有权限
  181. return true
  182. }
  183. return false;
  184. }
  185. //获取病例明细
  186. function getRecordDetail(type) {
  187. post(api.getRecordDetail, { 'behospitalCode': global_id }).then(function (res) {
  188. if (res.data.code === '0') {
  189. const data = res.data.data;
  190. const { beHospital, result, msg, checkStatus, drgs, mrStatus, checkShow, checkOperationWithAppeal } = data;
  191. global_check = checkStatus
  192. global_check_home = mrStatus
  193. global_check_show = checkShow;//0隐藏操作按钮1显示
  194. check_Operation_WithAppeal = checkOperationWithAppeal;
  195. const info = Object.assign(beHospital, result);
  196. initMenu(JSON.parse(result.menuData));
  197. // $(".sub-menu>ul>li:first-child.page,.menu-mini>ul>li:first-child.page").addClass("active");
  198. $(".subMenu >li:first-child.page,.menu-mini>ul>li:first-child.page").addClass("active");
  199. global_activeTab = $(".sub-menu .page.active").attr("code");
  200. $(".operation").show()
  201. initPatientInfo(info);
  202. initContent(result.pageData,2);
  203. initList(msg);
  204. initScoreItem(msg);
  205. global_flawData = msg;
  206. global_flawDataPay = drgs;
  207. setBoxHeight();
  208. changePay()
  209. }
  210. });
  211. }
  212. function getRecordDetailUpdate() {
  213. post(api.getRecordDetail, { 'behospitalCode': global_id }).then(function (res) {
  214. if (res.data.code === '0') {
  215. const data = res.data.data;
  216. const { beHospital, result, msg, checkStatus, drgs } = data;
  217. // global_check = checkStatus
  218. // const info=Object.assign(beHospital,result);
  219. // initMenu(JSON.parse(result.menuData));
  220. // $(".subMenu >li:first-child.page,.menu-mini>ul>li:first-child.page").addClass("active");
  221. // global_activeTab=$(".sub-menu .page.active").attr("code");
  222. // initPatientInfo(info);
  223. // initContent(result.pageData);
  224. initList(msg);
  225. initScoreItem(msg);
  226. global_flawData = msg;
  227. global_flawDataPay = drgs;
  228. // setBoxHeight();
  229. // changePay()
  230. }
  231. });
  232. }
  233. function getRecordDetailUpdate2() {
  234. post(api.getRecordDetail, { 'behospitalCode': global_id }).then(function (res) {
  235. if (res.data.code === '0') {
  236. const data = res.data.data;
  237. const { beHospital, result, msg, checkStatus, drgs } = data;
  238. // global_check = checkStatus
  239. // const info=Object.assign(beHospital,result);
  240. // initMenu(JSON.parse(result.menuData));
  241. // $(".subMenu >li:first-child.page,.menu-mini>ul>li:first-child.page").addClass("active");
  242. // global_activeTab=$(".sub-menu .page.active").attr("code");
  243. // initPatientInfo(info);
  244. initContent(result.pageData,1);
  245. initScoreItem(msg);
  246. global_flawData = msg;
  247. global_flawDataPay = drgs;
  248. // setBoxHeight();
  249. // changePay()
  250. }
  251. });
  252. }
  253. function changePay() {
  254. $(document).on('click', ".titleSpecial span", function () {
  255. let type = $(this).attr("data-type")
  256. if (type == 1) {
  257. initList(global_flawDataPay, type);
  258. } else {
  259. initList(global_flawData, type);
  260. }
  261. })
  262. }
  263. //填充患者信息
  264. function initPatientInfo(data) {
  265. const obj = Object.assign({}, data, { showCheckBtns, checkState: global_check, checkStateHome: global_check_home });
  266. $("#infoTmpl").tmpl(obj).appendTo("#patientInfo");
  267. /*$(".check").on("click", function(){
  268. checkQc()
  269. })*/
  270. $(".ywCheck").on("click", function () {
  271. checkYwQc()
  272. })
  273. }
  274. //显示病例模块明细
  275. function initContent(data,type) {
  276. const obj = JSON.parse(data);
  277. let info = [];
  278. let hml = '', moduleId = '';
  279. if(type == 2){
  280. formatSpecPage(obj["谈话告知书"], "谈话告知书");
  281. formatSpecPage(obj["知情同意书"], "知情同意书");
  282. }
  283. // formatSpecPage(obj["医嘱信息"],"医嘱信息");
  284. $(".content-box").show();
  285. for (let k in obj) {
  286. if (k === "谈话告知书" || k === "知情同意书") {
  287. continue;
  288. }
  289. for (let i in obj[k]) {
  290. info = formatInfoData(k, obj[k][i]);
  291. moduleId = info.mode_id;
  292. if (global_modules[moduleId]) {
  293. hml = initModuleData(moduleId, obj[k]);
  294. $.tmpl(hml, info).appendTo("#contentInfo");
  295. } else {
  296. const icon = require("../images/empty1.png");
  297. const sid = moduleId ? "(" + moduleId + ")" : "";
  298. const code = k.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '');
  299. const emptyStr = `<div class="empty">
  300. <img src="${icon}" alt="空"/>
  301. <p>暂无信息~</p>
  302. </div>`;
  303. if (!$(".content-item[code=" + code + "] .empty").length) { //显示一条空提示即可
  304. hml = '<div class="content-item" code="' + code + '">' +
  305. '<h2 class="title">' + k + sid + '</h2>' + emptyStr + '</div>';
  306. $.tmpl(hml, {}).appendTo("#contentInfo");
  307. }
  308. }
  309. }
  310. }
  311. $(".content-item[code=" + global_activeTab + "]").show();
  312. //console.log(obj)
  313. }
  314. function formatInfoData(k, data) {
  315. let obj = {}, name = "";
  316. for (let i in data) {
  317. if (i !== "mode_id") {
  318. name = i.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, "").replace(/^[0-9]+/, "a"); //过滤key中存在的特殊符号,模板会渲染不出来且不报错
  319. obj[name] = data[i].replace(/\n/g, "<br/>") || "";
  320. } else {
  321. obj[i] = data[i].replace(/\n/g, "<br/>") || "";
  322. }
  323. }
  324. return Object.assign({ title: k }, obj);
  325. }
  326. //知情同意书、谈话告知书
  327. function formatSpecPage(data, title, type) {
  328. $(".page-item[code='缺陷总览']").remove()
  329. $("#appointBookTmpl").tmpl({ title, data }).appendTo(".flaw-table");
  330. setBoxHeight();
  331. $(".page-anchor").on("click", function () {
  332. const code = $(this).attr("code");
  333. const pCode = $(this).parents("tr").attr("code").replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '');
  334. //菜单同步状态
  335. $(".sub-menu .page[code=" + pCode + "]").parents(".list-1").click();
  336. $(".sub-menu .page[code=" + pCode + "],.menu-mini .page[code=" + pCode + "").click();
  337. //缺陷定位
  338. $(".info-item .cont,.flaw-item,td").removeClass("active");
  339. const flawItem = $(".flaw-item .title a[code=" + code + "]");
  340. if (!flawItem.length) {
  341. $.alerModal({ "message": '模块数据缺失~', type: "tip", time: '1000', isFather: true, fatherWrapper: $(".flaw-table", parent.document) });
  342. return;
  343. }
  344. $(".flaw-item .title a[code=" + code + "]").click();
  345. const anch = $(".flaw-item .title a[code=" + code + "]").attr("href");
  346. if ($(anch)[0]) {
  347. $('#contentInfo').scrollTop($(anch).offset().top - 60);
  348. }
  349. });
  350. if (global_activeTab == "缺陷总览") {
  351. $(".check").css("display", "none")
  352. } else {
  353. $(".check").css("display", "block")
  354. }
  355. if (type && type == 1) {
  356. $(".titleNo").css({
  357. 'background-color': '#00A1FF',
  358. 'color': '#fff',
  359. 'border-color': '#00A1FF'
  360. })
  361. $(".titlePay").css({
  362. 'background-color': '#fff',
  363. 'border': '1px solid #777',
  364. 'border-right': 0,
  365. 'color': '#777'
  366. })
  367. setBoxHeight()
  368. } else if (type && type == 2) {
  369. $(".titleNo").css({
  370. 'background-color': '#fff',
  371. 'border': '1px solid #777',
  372. 'border-left': 0,
  373. 'color': '#777'
  374. })
  375. $(".titlePay").css({
  376. 'background-color': '#00A1FF',
  377. 'color': '#fff',
  378. 'border-color': '#00A1FF'
  379. })
  380. setBoxHeight()
  381. }
  382. }
  383. function initList(data, type) {
  384. //$("#flawTotalList").tmpl({title:"缺陷总览",data:data}).appendTo(".flaw-table");
  385. formatSpecPage(data, "缺陷总览", type);
  386. $(".flaw-table").show();
  387. $(".flaw-table .page-item[code=" + global_activeTab + "]").show();
  388. $(".slide-up").off("click").on("click", function () {
  389. const name = $(this).text();
  390. $("tr[code='" + name + "']").slideToggle();
  391. $(this).toggleClass("down");
  392. });
  393. }
  394. //评分项数据填充
  395. function initScoreItem(data) {
  396. $("#flaws .flaw-box").html("");
  397. let hasAu = showCheckBtns && global_check_show && hasData('FUNC000013'); //修改缺陷权限
  398. let hasAu2 = showCheckBtns && global_check_show && hasData('FUNC000012'); //删除缺陷权限
  399. let hasAu4 = check_Operation_WithAppeal && showCheckBtns
  400. let hasAu3 = check_Operation_WithAppeal
  401. for (let k in data) {
  402. for (let i = 0; i < data[k].length; i++) {
  403. let item = data[k][i];
  404. item.hasAu3 = hasAu3
  405. }
  406. $("#flawTmpl").tmpl(data[k]).appendTo("#flaws .flaw-box");
  407. }
  408. showFlawList();
  409. $(".flaw-item .oper a").unbind("click").click(function () {
  410. const i = $(".flaw-item[code=" + global_activeTab + "]").index($(this).parents(".flaw-item"));
  411. const code = $(this).attr("code");
  412. const isEdit = $(this).is(".edit-flaw");
  413. //if(!hasAu)return
  414. if (isEdit && hasAu) {
  415. showModal('0', code, i); //编辑
  416. } else if (!isEdit && hasAu2) {
  417. if ($(this).is(".recover-flaw")) {
  418. showModal('3', code, i); //恢复
  419. } else {
  420. showModal('1', code, i); //删除
  421. }
  422. }
  423. })
  424. $(".edit-flaw").css({ "display": hasAu ? "inline" : "none" });
  425. $(".del-flaw").css({ "display": hasAu2 ? "inline" : "none" });
  426. $(".add-flaw").css({ "display": hasAu4 && global_check_show ? "inline" : "none" });
  427. $(".recover-flaw").css({ "display": hasAu2 ? "inline" : "none" });
  428. $(".flaw-item .title a[href]").unbind("click").click(function () {
  429. const id = $(this).attr("href");
  430. const anchors = $(this).attr("anchors").split(",");
  431. let ans = anchors.map((it) => {
  432. return "#anchor" + it;
  433. });
  434. $(".info-item .cont,.flaw-item,td").removeClass("active");
  435. $(ans.join(",")).addClass("active");
  436. $(this).parents(".flaw-item").addClass("active");
  437. });
  438. }
  439. //显示缺陷列表
  440. function showFlawList() {
  441. const hml = $(".flaw-item[code=" + global_activeTab + "]");
  442. if (hml.length) {
  443. hml.show();
  444. $("#flaws .empty").hide();
  445. } else {
  446. $("#flaws .empty").length ? $("#flaws .empty").show() : $("#emptyTmpl").tmpl().appendTo("#flaws .flaw-box");
  447. }
  448. showAppealDetailEvent();
  449. }
  450. //删除评分项
  451. function delScore(id, info, isRecover) {
  452. const text = isRecover ? "恢复" : "删除";
  453. const param = {
  454. 'behospitalCode': global_id,
  455. 'optResultAlgVO': {
  456. 'id': id
  457. },
  458. 'delStatus': isRecover ? 1 : 0
  459. };
  460. post(api.delScore, param).then(function (res) {
  461. if (res.data.code === '0') {
  462. $("#delModal").hide();
  463. updateFlaws(res.data.data);
  464. $("#anchor" + info.pageKeyList[0]).removeClass("active");
  465. $.alerModal({ "message": text + "成功", type: "tip", time: '1000', win: true });
  466. } else {
  467. $.alerModal({ "message": res.data.msg || (text + '失败,请重试~'), type: "tip", time: '1000', win: 'default' });
  468. }
  469. }).catch(() => {
  470. $.alerModal({ "message": text + '失败,请重试~', type: "tip", time: '1000', win: 'default' });
  471. });
  472. }
  473. //修改评分项
  474. function editScore(info) {
  475. info.reviewer = info.exampleDate > info.gmtModified ? info.reviewer : info.linkman
  476. info.exampleDate = info.exampleDate > info.gmtModified ? info.exampleDate : info.gmtModified
  477. const param = {
  478. "behospitalCode": global_id,
  479. "optResultAlgVO": info
  480. };
  481. post(api.editScore, param).then(function (res) {
  482. if (res.data.code === '0') {
  483. $("#delModal").hide();
  484. updateFlaws(res.data.data);
  485. $.alerModal({ "message": "修改成功", type: "tip", time: '1000', win: true });
  486. } else {
  487. $.alerModal({ "message": '修改失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
  488. }
  489. }).catch(() => {
  490. $.alerModal({ "message": '修改失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
  491. });
  492. }
  493. //添加评分项
  494. function addScore(info) {
  495. const optResultAlgVO = {
  496. "casesEntryId": info.casesEntryId,
  497. "casesId": info.casesId,
  498. "casesScore": info.caseScore,
  499. "code": info.code || "",
  500. "id": info.id || "",
  501. "info": info.info || "",
  502. "isReject": info.isReject,
  503. "msg": info.msg || "",
  504. "score": info.score,
  505. "explainInfo": info.explainInfo,
  506. }
  507. const param = {
  508. "behospitalCode": global_id,
  509. "optResultAlgVO": optResultAlgVO
  510. };
  511. post(api.addScore, param).then(function (res) {
  512. if (res.data.code === '0') {
  513. $("#delModal").hide();
  514. updateFlaws(res.data.data);
  515. $.alerModal({ "message": "添加成功", type: "tip", win: true, time: '1000' });
  516. } else {
  517. $.alerModal({ "message": "添加失败,请重试~", type: "tip", win: 'default', time: '1000' });
  518. }
  519. }).catch(() => {
  520. $.alerModal({ "message": "添加失败,请重试~", type: "tip", win: 'default', time: '1000' });
  521. });
  522. }
  523. //显示删除/修改弹窗
  524. function showModal(flag, code, i, id, qcresultDetailId) {
  525. console.log(flag);
  526. $("#delModal .modal-body").html("");
  527. $("#delModal").show();
  528. $("#delModal .cancel").text("关闭")
  529. $("#delModal .cancel").hide();
  530. $(".info-item .cont,.flaw-item .title,td").removeClass("active");
  531. //事件解绑
  532. $("#delModal .confirm").off("click");
  533. const flawsList = formatFlawKeys(global_flawData);
  534. const info = flawsList[global_activeTab] && flawsList[global_activeTab][i];
  535. if (flag === '0') { //修改
  536. $("#delModal .confirm").show()
  537. $("#delModal .title").text("修改");
  538. $("#delModal .confirm").text("保存");
  539. $("#editTmpl").tmpl(info).appendTo("#delModal .modal-body");
  540. $("#qcScore,#qcMsg,#qcInfo").off("input");
  541. //分数输入验证
  542. $("#qcScore").on("input", function () {
  543. const val = $(this).val();
  544. if (/^[0-9]\d*$|^[0-9]\d*(.\d)?$/.test(val) && val <= 100) {
  545. $(".edit-box .warning").hide();
  546. } else {
  547. $(".edit-box .warning .red").text("支持≥0且≤100的数字输入,最多保留小数点后1位~");
  548. $(".edit-box .warning").show();
  549. }
  550. });
  551. //提示信息输入验证
  552. $("#qcMsg").on("input", function () {
  553. const val = $(this).val();
  554. $(this).attr("title", val)
  555. if (val.trim()) {
  556. $(".edit-box .warning").hide();
  557. } else {
  558. $(".edit-box .warning .red").text("提示信息不能为空~");
  559. $(".edit-box .warning").show();
  560. }
  561. });
  562. //提示信息输入验证
  563. $("#qcInfo").on("input", function () {
  564. const val = $(this).val();
  565. $(this).attr("title", val)
  566. if (val.length > 125) {
  567. $(".edit-box .warning .red").text("备注不能超过125个字~");
  568. $(".edit-box .warning").show();
  569. } else {
  570. $(".edit-box .warning").hide();
  571. return;
  572. }
  573. });
  574. if ($("#qcInfo").val().length > 125) {
  575. $(".edit-box .warning .red").text("备注不能超过125个字~");
  576. $(".edit-box .warning").show();
  577. return;
  578. }
  579. $("#delModal .confirm").unbind("click").click(function () {
  580. if ($(".edit-box .warning").is(":visible")) {
  581. return;
  582. }
  583. const obj = Object.assign({}, info, { explainInfo: $("#delModal #qcInfo").val(), msg: $("#delModal #qcMsg").val(), score: $("#delModal #qcScore").val() });
  584. editScore(obj);
  585. });
  586. } else if (flag === '5') { //查看
  587. $("#delModal .title").text("查看");
  588. $("#delModal .confirm").hide();
  589. $("#delModal .cancel").show();
  590. $("#delModal .modal-box").css("margin-top", '-245px');
  591. //0申诉1驳回2审核
  592. //新增项模板
  593. getAppealDetail(code, i, id, qcresultDetailId);
  594. } else if (flag === '2') { //新增
  595. $("#delModal .confirm").show();
  596. $("#delModal .title").text("新增");
  597. $("#delModal .confirm").text("保存");
  598. $("#addFlawTmpl").tmpl().appendTo("#delModal .modal-body");
  599. $("#flawDropTmpl").tmpl({ info: code }).appendTo("#delModal .modal-body ul");
  600. $("#addQcScore,#addQcMsg,#addQcInfo").off("input");
  601. //分数输入验证
  602. $("#addQcScore").on("input", function () {
  603. const val = $(this).val();
  604. if (/^[0-9]\d*$|^[0-9]\d*(.\d)?$/.test(val) && val <= 100) {
  605. $(".add-box .warning").hide();
  606. } else {
  607. $(".add-box .warning .red").text("支持≥0且≤100的数字输入,最多保留小数点后1位~");
  608. $(".add-box .warning").show();
  609. return;
  610. }
  611. });
  612. //提示信息输入验证
  613. $("#addQcMsg").on("input", function () {
  614. const val = $(this).val();
  615. $(this).attr("title", val)
  616. if (val.trim()) {
  617. $(".add-box .warning").hide();
  618. } else {
  619. $(".add-box .warning .red").text("提示信息不能为空~");
  620. $(".add-box .warning").show();
  621. return;
  622. }
  623. });
  624. //提示信息输入验证
  625. $("#addQcInfo").on("input", function () {
  626. const val = $(this).val();
  627. $(this).attr("title", val)
  628. if (val.length > 125) {
  629. $(".add-box .warning .red").text("备注不能超过125个字~");
  630. $(".add-box .warning").show();
  631. } else {
  632. $(".add-box .warning").hide();
  633. return;
  634. }
  635. });
  636. $("#delModal .confirm").unbind("click").click(function () {
  637. if (!$(".flaw-drop-input").attr("code")) {
  638. $(".add-box .warning .red").text("请选择质控条目~");
  639. $(".add-box .warning").show();
  640. return;
  641. }
  642. const msg = $("#delModal #addQcMsg").val();
  643. const score = Number($("#delModal #addQcScore").val());
  644. const explainInfo = $("#delModal #addQcInfo").val();
  645. if ($(".add-box .warning").is(":visible")) {
  646. return;
  647. }
  648. if (!msg.trim()) {
  649. $(".add-box .warning .red").text("提示信息不能为空~");
  650. $(".add-box .warning").show();
  651. return;
  652. }
  653. if ((!score) && $("#delModal #addQcScore").val() != '0') {
  654. $(".add-box .warning .red").text("分值不能为空~");
  655. $(".add-box .warning").show();
  656. return;
  657. }
  658. if ($("#addQcInfo").val().length > 125) {
  659. $(".add-box .warning .red").text("备注不能超过125个字~");
  660. $(".add-box .warning").show();
  661. return;
  662. }
  663. const obj = Object.assign({}, global_selectedFlaw, { msg, score, explainInfo });
  664. addScore(obj);
  665. });
  666. } else if (flag === '3') {
  667. $("#delModal .confirm").show();
  668. $("#delModal .title").text("恢复提示");
  669. $("#delModal .modal-body").html('<p>确定要恢复该评分记录吗?</p>');
  670. $("#delModal .confirm").text("取消").unbind("click").click(function () {
  671. $("#delModal").hide();
  672. });
  673. $("#delModal .cancel").show().text("恢复").unbind("click").click(function () {
  674. delScore(code, info, true);
  675. });
  676. } else {
  677. $("#delModal .confirm").show();
  678. $("#delModal .title").text("删除提示");
  679. $("#delModal .modal-body").html('<p>确定要删除该评分记录吗?</p>');
  680. $("#delModal .confirm").text("取消").unbind("click").click(function () {
  681. $("#delModal").hide();
  682. });
  683. $("#delModal .cancel").show().text("删除").unbind("click").click(function () {
  684. console.log(123);
  685. delScore(code, info);
  686. });
  687. }
  688. }
  689. function getAppealDetail(id, flg, casesEntryId, qcresultDetailId) {
  690. const param = {
  691. behospitalCode: global_id,
  692. casesEntryId: casesEntryId,
  693. hospitalId: global_hid,
  694. qcresultDetailId: qcresultDetailId,
  695. id: +id
  696. };
  697. post(api.getApprovedView, param).then((res) => {
  698. const info = res.data.data || {};
  699. const appealInfo = info.appealExamineRecordDTOList;
  700. $("#appealStatusTmpl").tmpl(appealInfo).appendTo("#delModal .modal-body");
  701. $("#delModal .cancel").text("关闭").unbind("click").click(function () {
  702. $("#delModal").hide();
  703. });
  704. /*if (flg === '1') {
  705. $(".check-item").hide();
  706. $(".reject-item").show();
  707. } else if (flg === '2') {
  708. $(".check-item").show();
  709. }*/
  710. })
  711. }
  712. //缺陷列表key值去掉特殊符号
  713. function formatFlawKeys(data) {
  714. const obj = {};
  715. for (let k in data) {
  716. obj[k.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '')] = data[k];
  717. }
  718. return obj;
  719. }
  720. //获取缺陷条目下拉列表
  721. function getQcCasesEntry(name) {
  722. const id = $("#subMenu [code=" + global_activeTab + "]").attr("mode");
  723. const param = {
  724. 'behospitalCode': global_id,
  725. 'entryName': name || "",
  726. 'modeId': id
  727. };
  728. post(api.findQcCasesEntry, param).then(function (res) {
  729. if (res.data.code === '0') {
  730. const data = res.data.data;
  731. if (name) {
  732. global_flaws = data;
  733. $("#delModal .modal-body ul").html("");
  734. $("#flawDropTmpl").tmpl({ info: data }).appendTo("#delModal .modal-body ul");
  735. } else {
  736. global_flaws = data;
  737. if ($("#delModal").css("display") == "block") {
  738. $("#flawDropTmpl").tmpl({ info: data }).appendTo("#delModal .modal-body ul");
  739. return
  740. }
  741. showModal('2', data);
  742. }
  743. }
  744. });
  745. }
  746. //增加条目弹窗元素事件
  747. $("body").on("click", ".add-box .flaw-drop-input", function () {
  748. $(".add-box .drop-box").addClass("show");
  749. });
  750. $("body").on("blur", ".add-box .flaw-drop-input", function () {
  751. setTimeout(function () {
  752. $(".add-box .drop-box").removeClass("show");
  753. }, 300)
  754. });
  755. $("body").on("input", ".add-box .flaw-drop-input", function () {
  756. $(this).attr({ "code": "", "title": $(this).val().trim() });
  757. getQcCasesEntry($(this).val().trim());
  758. });
  759. $("body").on("click", ".add-box .drop-box li", function () {
  760. const n = $(this).attr("idx");
  761. const flaw = global_flaws[n];
  762. const { score, msg, entryName, casesEntryId } = flaw;
  763. global_selectedFlaw = flaw;
  764. global_entryName = entryName
  765. global_casesEntryId = casesEntryId
  766. $(".flaw-drop-input").val(entryName).attr({ "code": casesEntryId, "title": entryName });
  767. $("#addQcMsg").val(msg).attr("title", msg);
  768. $("#addQcScore").val(score);
  769. $(".add-box .warning").hide();
  770. $(".add-box .drop-box").removeClass("show");
  771. console.log(123);
  772. });
  773. $(document).on("blur", ".flaw-drop-input", (e) => {
  774. $('.flaw-drop-input').val(global_entryName).attr({ "code": global_casesEntryId, "title": global_entryName });
  775. });
  776. //更新缺陷列表
  777. function updateFlaws(info) {
  778. $("#patientInfo .level").text("质控等级:" + info.level);
  779. $("#patientInfo .score").text("质控得分:" + info.scoreRes);
  780. const param = {
  781. 'behospitalCode': global_id,
  782. 'paramStr': [
  783. "msg"
  784. ]
  785. };
  786. post(api.getRecordDetail, param).then(function (res) {
  787. if (res.data.code === '0') {
  788. const data = res.data.data;
  789. const { msg } = data;
  790. initScoreItem(msg);
  791. global_flawData = msg;
  792. }
  793. });
  794. }
  795. //获取病例模板
  796. function getInfoModule(moduleId) {
  797. const param = {
  798. moduleId: moduleId
  799. };
  800. post(api.getInfoModule, param).then(function (res) {
  801. if (res.data.code === '0') {
  802. const data = res.data.data;
  803. cachemoduleDatas(data);
  804. getRecordDetail();
  805. }
  806. });
  807. }
  808. //模板数据缓存
  809. function cachemoduleDatas(data) {
  810. const moudle = data.moduleDetail;
  811. global_modules[data.modeName] = [];
  812. for (let i in moudle) {
  813. global_modules[data.modeName].push(moudle[i]);
  814. }
  815. }
  816. //初始化模板
  817. function initModuleData(mid, obj) {
  818. const n = obj.length;
  819. const module = global_modules[mid].moduleDetail;
  820. const key = global_modules[mid].modeName.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '');
  821. let hml = '<div class="content-item" code="' + key + '">' +
  822. '<h2 class="title">' + global_modules[mid].modeName + '(' + mid + ')</h2>' +
  823. (n > 1 ? '<div class="container">' : '<div class="container content-hts">');
  824. for (let i in module) {
  825. hml = hml + '<div class="info-item">';
  826. for (let j = 0; j < module[i].length; j++) {
  827. const detal = module[i][j].questionDTO;
  828. const { tagType } = detal;
  829. switch (tagType) {
  830. case 1:
  831. hml = hml + simpleStructure(detal, obj);
  832. break;
  833. case 4:
  834. hml = hml + combineStructure(detal);
  835. break;
  836. default:
  837. break;
  838. }
  839. }
  840. hml = hml + "</div>"
  841. }
  842. return hml + "</div></div>";
  843. }
  844. //基础类型结构生成
  845. function simpleStructure(data, obj) {
  846. const { name, val, monoLine, addLine, position, bold, retract, id } = data;
  847. if (name === "手术记录表格-1") {
  848. const value = val.replace("【", "").replace("】", "");
  849. const diag = obj[0][value] ? JSON.parse(obj[0][value]) : "";
  850. let thml = `<div class="cont" style="width: 100%;" id="anchor${id}">`;
  851. thml += $("#tableTmpl").tmpl({ k: "手术信息", data: diag })[0].outerHTML + "</div>";
  852. return thml;
  853. }
  854. if (name === "出院诊断表格-1") {
  855. const value = val.replace("【", "").replace("】", "");
  856. const diag = obj[0][value] ? JSON.parse(obj[0][value]) : "";
  857. let thml = `<div class="cont" style="width: 100%;" id="anchor${id}">`;
  858. thml += $("#tableTmpl").tmpl({ k: "出院诊断", data: diag })[0].outerHTML + "</div>";
  859. return thml;
  860. }
  861. const posClass = position === 1 ? 'text-left' : '';
  862. const boldClass = bold === 1 ? 'text-bold' : '';
  863. const retractClass = retract === 1 ? 'text-indent' : '';
  864. const lineHml = ('<p class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' + extractVars(val) + '</p>');
  865. const txtHml = ('<p style="display: inline;vertical-align: middle;" class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' + extractVars(val) + '</p>');
  866. let hml = addLine || monoLine ? `<div class="cont ${posClass}" style="width: 100%;" id="anchor${id}">` : `<div class="cont" id="anchor${id}">`;
  867. hml = hml + `<span class="label">${name}</span>` + (addLine ? lineHml : txtHml) + `</div>`;
  868. return hml;
  869. }
  870. //组合类型结构生成
  871. function combineStructure(data) {
  872. const { name, questionMapping, id } = data;
  873. let hml = '<div class="inner-table"><table>';
  874. const colNum = Math.ceil(questionMapping.length / 2);
  875. let tdVal = '';
  876. const regexp = /(【(.+?)】)/g;
  877. for (let i = 0; i < questionMapping.length;) {
  878. if (questionMapping[i + 1]) {
  879. tdVal = "<td id='anchor" + questionMapping[i].id + "'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td id='anchor" + questionMapping[i + 1].id + "'>" + questionMapping[i + 1].name + extractVars(questionMapping[i + 1].val) + "</td>";
  880. } else {
  881. tdVal = "<td id='anchor" + questionMapping[i].id + "'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td></td>";
  882. }
  883. if (i == 0) {
  884. hml = hml + `<tr><td rowspan="${colNum}" id='anchor${id}'>${name}</td>${tdVal}`;
  885. } else {
  886. hml = hml + `<tr>${tdVal}`;
  887. }
  888. hml = hml + "</tr>";
  889. i = ((i + 2) > questionMapping.length ? i + 1 : i + 2)
  890. }
  891. hml = hml + "</table></div>";
  892. return hml;
  893. }
  894. //抽取变量
  895. function extractVars(org) {
  896. const regexp = /(【(.+?)】)/g;
  897. const arr = org.split(regexp);
  898. //console.log(arr)
  899. let htl = '', val = '';
  900. for (let i = 0; i < arr.length; i++) {
  901. val = arr[i].indexOf("【") != -1 ? '' : (arr[i - 1] && arr[i - 1].indexOf("【") != -1 ? "{{html " + arr[i] + "}}" : arr[i]);
  902. htl = htl + val;
  903. }
  904. return htl;
  905. }
  906. //获取所有模板
  907. function getAllModules() {
  908. const param = {
  909. hospitalId: getUrlArgObject("hid"),
  910. modeId: ''
  911. };
  912. post(api.getModuleById, param).then((res) => {
  913. if (res.data.code === '0') {
  914. const data = res.data.data;
  915. global_modules = data;
  916. getRecordDetail();
  917. $("#loading").hide();
  918. /*setTimeout(function(){
  919. $(".operation").show()
  920. },50)*/
  921. }
  922. });
  923. }
  924. /*function checkQc(){
  925. const param={
  926. behospitalCode:getUrlArgObject("id"),
  927. hospitalId:getUrlArgObject("hid"),
  928. checkType: global_activeTab == '病案首页'?'1':'0'
  929. };
  930. post(api.checkQc,param).then((res)=>{
  931. if(res.data.code==='0') {
  932. if(global_activeTab == '病案首页'){
  933. global_check_home = 1
  934. }else{
  935. global_check = 1
  936. }
  937. $(".check").text("重新核查")
  938. $.alerModal({"message":"核查成功",type:"tip",time:'1000',win:true});
  939. }else{
  940. $.alerModal({"message":res.data.msg ||"核查失败",type:"tip",time:'1000',isFather: false});
  941. }
  942. });
  943. }*/
  944. function checkYwQc() {
  945. const param = {
  946. behospitalCode: getUrlArgObject("id"),
  947. hospitalId: getUrlArgObject("hid"),
  948. };
  949. post(ywCheckApi.recordCheck, param).then((res) => {
  950. if (res.data.code === '0') {
  951. global_check = 1
  952. $(".ywCheck").text("重新核查")
  953. $.alerModal({ "message": "核查成功", type: "tip", time: '1000', win: true });
  954. } else {
  955. $.alerModal({ "message": res.data.msg || "核查失败", type: "tip", time: '1000', isFather: false });
  956. }
  957. });
  958. }
  959. });