appealUserPage.js 38 KB

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