appealUserPage.js 39 KB

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