appealUserPage.js 37 KB

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