appealUserPage.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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. 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. getQcCasesEntry();
  164. //initModuleData();
  165. global_activeTab = $(".sub-menu .page.active").attr("code");
  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. showFlawList();
  362. $(".flaw-item .oper a").unbind("click").click(function () {
  363. const i = $(".flaw-item[code=" + global_activeTab + "]").index($(this).parents(".flaw-item"));
  364. const code = $(this).attr("code");
  365. showModal('0', code, i); //申诉
  366. //审核人下拉渲染
  367. $("#delModal .checker-drop-box ul").html("");
  368. $("#flawDropTmpl").tmpl({ info: global_checkers }).appendTo("#delModal .checker-drop-box ul");
  369. })
  370. $(".flaw-item .title a[href]").unbind("click").click(function () {
  371. const id = $(this).attr("href");
  372. const anchors = $(this).attr("anchors").split(",");
  373. let ans = anchors.map((it) => {
  374. return "#anchor" + it;
  375. });
  376. $(".info-item .cont,.flaw-item,td").removeClass("active");
  377. $(ans.join(",")).addClass("active");
  378. $(this).parents(".flaw-item").addClass("active");
  379. });
  380. }
  381. //显示缺陷列表
  382. function showFlawList() {
  383. const hml = $(".flaw-item[code=" + global_activeTab + "]");
  384. if (hml.length) {
  385. hml.show();
  386. $("#flaws .empty").hide();
  387. } else {
  388. $("#flaws .empty").length ? $("#flaws .empty").show() : $("#emptyTmpl").tmpl().appendTo("#flaws .flaw-box");
  389. }
  390. showAppealDetailEvent();
  391. }
  392. //申诉
  393. function appealItem(info) {
  394. const param = {
  395. "behospitalCode": global_id,
  396. ...info
  397. };
  398. post(api.addAppealInfo, param).then(function (res) {
  399. if (res.data.code === '0') {
  400. $("#delModal").hide();
  401. updateFlaws(res.data.data);
  402. $.alerModal({ "message": "申诉成功", type: "tip", time: '1000', win: true });
  403. } else {
  404. $.alerModal({ "message": res.data.msg || '申诉失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
  405. }
  406. }).catch(() => {
  407. $.alerModal({ "message": res.data.msg || '申诉失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
  408. });
  409. }
  410. //新增申诉
  411. function addScore(info) {
  412. let param = {};
  413. if (info.type === '1') {
  414. param = {
  415. "appealExplain": info.appealExec,
  416. "appealOperationType": info.type,
  417. "appealType": 1,
  418. "behospitalCode": global_id,
  419. "casesEntryId": info.casesEntryId,
  420. "casesEntryMsg": info.msg,
  421. "casesEntryName": info.msg,
  422. "checkId": info.userId,
  423. "modeId": info.modelId,
  424. "modeName": info.modelName,
  425. "remark": info.explainInfo,
  426. "value": info.score,
  427. "casesScore": info.caseScore,
  428. "msg": info.msg,
  429. "isReject": info.isReject,
  430. "qcresultDetaiValue": info.score,
  431. };
  432. } else {
  433. param = {
  434. "appealExplain": info.appealExec,
  435. "appealOperationType": info.type,
  436. "appealType": 1,
  437. "behospitalCode": global_id,
  438. "checkId": info.userId,
  439. "modeName": info.modelName,
  440. "remark": info.explainInfo,
  441. "casesName": info.global_activeTab
  442. };
  443. }
  444. post(api.addAppealInfo, param).then(function (res) {
  445. if (res.data.code === '0') {
  446. $("#delModal").hide();
  447. //updateFlaws(res.data.data);
  448. $.alerModal({ "message": "申诉成功", type: "tip", win: true, time: '1000' });
  449. } else {
  450. $.alerModal({ "message": "申诉失败,请重试~", type: "tip", win: 'default', time: '1000' });
  451. }
  452. }).catch(() => {
  453. $.alerModal({ "message": "申诉失败,请重试~", type: "tip", win: 'default', time: '1000' });
  454. });
  455. }
  456. function getAppealDetail(id, flg, casesEntryId, qcresultDetailId) {
  457. const param = {
  458. behospitalCode: global_id,
  459. casesEntryId: casesEntryId,
  460. hospitalId: global_hid,
  461. qcresultDetailId: qcresultDetailId,
  462. id: +id
  463. };
  464. post(api.getApprovedView, param).then((res) => {
  465. const info = res.data.data || {};
  466. const appealInfo = info.appealExamineRecordDTOList;
  467. $("#appealStatusTmpl").tmpl(appealInfo).appendTo("#delModal .modal-body");
  468. /*if (flg === '1') {
  469. $(".check-item").hide();
  470. $(".reject-item").show();
  471. } else if (flg === '2') {
  472. $(".check-item").show();
  473. }*/
  474. })
  475. }
  476. //申诉弹窗
  477. function showModal(flag, code, i, id, qcresultDetailId) {
  478. $("#delModal .modal-body").html("");
  479. $("#delModal").show();
  480. //事件解绑
  481. $("#delModal .confirm").off("click");
  482. $("#addQcScore,#addQcMsg,#addQcInfo").off("input");
  483. $("#delModal .confirm").show();
  484. if (flag === '0') { //申诉
  485. const flawsList = formatFlawKeys(global_flawData);
  486. const info = JSON.parse(JSON.stringify(flawsList[global_activeTab])) && JSON.parse(JSON.stringify(flawsList[global_activeTab][i]))
  487. if (info.appealOperationType == 1) {
  488. if (info.exampleStatus == 2) {
  489. info.appealOperationType = 0
  490. } else {
  491. info.appealOperationType = 1
  492. }
  493. } else if (info.appealOperationType == 3) {
  494. info.appealOperationType = 0
  495. } else if (info.isDeleted == 'Y') {
  496. info.appealOperationType = 3
  497. }
  498. $("#delModal .title").text("申诉");
  499. $("#delModal .modal-box").css("margin-top", "-215px");
  500. $("#editTmpl").tmpl(info).appendTo("#delModal .modal-body");
  501. $("#flawDropTmpl").tmpl({ info: global_checkers }).appendTo("#delModal .modal-body ul");
  502. $("#qcInfo").off("input");
  503. //申诉说明输入验证
  504. const num = 500;
  505. $("#qcInfo").on("input", function () {
  506. const val = $(this).val().trim();
  507. $(this).attr("title", val)
  508. if (!val) {
  509. $(".edit-box .warning .red").text("申诉说明不能为空~");
  510. $(".edit-box .warning").show();
  511. } else if (val.length > num) {
  512. $(".edit-box .warning .red").text("申诉说明不能超过" + num + "个字~");
  513. $(".edit-box .warning").show();
  514. } else {
  515. $(".edit-box .warning").hide();
  516. return;
  517. }
  518. });
  519. $("#delModal .confirm").unbind("click").click(function () {
  520. if ($(".edit-box .warning").is(":visible")) {
  521. return;
  522. }
  523. const userId = $(".checker-drop-input").attr("code");
  524. const appealExec = $("#delModal #qcInfo").val(); //申诉说明
  525. if (!userId) {
  526. $(".edit-box .warning .red").text("请选择审核人~");
  527. $(".edit-box .warning").show();
  528. return;
  529. }
  530. if (appealExec.length === 0) {
  531. $(".edit-box .warning .red").text("申诉说明不能为空~");
  532. $(".edit-box .warning").show();
  533. return;
  534. }
  535. if (appealExec.length > 500) {
  536. $(".edit-box .warning .red").text("申诉说明不能超过500个字~");
  537. $(".edit-box .warning").show();
  538. return;
  539. }
  540. const obj = {
  541. appealExplain: $("#delModal #qcInfo").val(),
  542. appealOperationType: info.appealOperationType ? info.appealOperationType : 0,
  543. appealType: 1,
  544. checkId: $(".checker-drop-input").attr("code"),
  545. modeId: info.modelId,
  546. modeName: info.modelName,
  547. qcresultDetailId: info.id,
  548. workFlowNodeId: 1,
  549. casesScore: info.casesScore,
  550. casesEntryId: info.casesEntryId,
  551. isReject: info.isReject,
  552. qcresultDetaiValue: info.score,
  553. qcresultDetailMsg: info.standardMsg
  554. };
  555. appealItem(obj);
  556. });
  557. } else if (flag === '1') { //查看
  558. $("#delModal .title").text("查看");
  559. $("#delModal .confirm").hide();
  560. $("#delModal .modal-box").css("margin-top", '-245px');
  561. //0申诉1驳回2审核
  562. //新增项模板
  563. getAppealDetail(code, i, id, qcresultDetailId);
  564. } else if (flag === '2') { //新增
  565. $("#delModal .title").text("申诉新增");
  566. $("#delModal .modal-box").css("margin-top", "-281px");
  567. //新增项模板
  568. $("#addFlawTmpl").tmpl().appendTo("#delModal .modal-body");
  569. //缺陷项下拉模板
  570. $("#flawDropTmpl").tmpl({ info: global_flaws }).appendTo("#delModal .flaw-drop-box ul");
  571. //审核人模板
  572. $("#delModal .checker-drop-box ul").html("");
  573. $("#flawDropTmpl").tmpl({ info: global_checkers }).appendTo("#delModal .checker-drop-box ul");
  574. //事件绑定
  575. flawDropEvent(".add-box .flaw-drop-input", getQcCasesEntry, selectFlaw);
  576. //分数输入验证
  577. $("#addQcScore").on("input", function () {
  578. if (/^[0-9]\d*$|^[0-9]\d*(.\d)?$/.test(val) && val <= 100) {
  579. $(".add-box .warning").hide();
  580. } else {
  581. $(".add-box .warning .red").text("支持≥0且≤100的数字输入,最多保留小数点后1位~");
  582. $(".add-box .warning").show();
  583. return;
  584. }
  585. });
  586. //提示信息输入验证
  587. $("#addQcMsg").on("input", function () {
  588. const val = $(this).val();
  589. $(this).attr("title", val)
  590. if (val.trim()) {
  591. $(".add-box .warning").hide();
  592. } else {
  593. $(".add-box .warning .red").text("提示信息不能为空~");
  594. $(".add-box .warning").show();
  595. return;
  596. }
  597. });
  598. //备注输入验证
  599. $("#addQcInfo").on("input", function () {
  600. const val = $(this).val();
  601. $(this).attr("title", val)
  602. if (val.length > 125) {
  603. $(".add-box .warning .red").text("备注不能超过125个字~");
  604. $(".add-box .warning").show();
  605. } else {
  606. $(".add-box .warning").hide();
  607. return;
  608. }
  609. });
  610. //申诉说明输入验证
  611. $("#addQcEx").on("input", function () {
  612. const val = $(this).val();
  613. if (val.trim().length === 0) {
  614. $(".add-box .warning .red").text("申诉说明不能为空~");
  615. $(".add-box .warning").show();
  616. } else if (val.length > 500) {
  617. $(".add-box .warning .red").text("申诉说明不能超过500个字~");
  618. $(".add-box .warning").show();
  619. } else {
  620. $(".add-box .warning").hide();
  621. return;
  622. }
  623. });
  624. //新增申诉提交事件
  625. $("#delModal .confirm").unbind("click").click(function () {
  626. const type = $("input[name=operType]:checked").val();
  627. const msg = $("#delModal #addQcMsg").val();
  628. const score = Number($("#delModal #addQcScore").val());
  629. const explainInfo = $("#delModal #addQcInfo").val();
  630. const appealExec = $("#delModal #addQcEx").val(); //申诉说明
  631. const userId = $(".checker-drop-input").attr("code");
  632. if ($(".edit-box .warning").is(":visible")) {
  633. return;
  634. }
  635. console.log(userId);
  636. if (!userId) {
  637. $(".add-box .warning .red").text("请选择审核人~");
  638. $(".add-box .warning").show();
  639. return;
  640. }
  641. //必填验证
  642. if (type === '1') { //新增已有时
  643. if (!$(".flaw-drop-input").attr("code")) {
  644. $(".add-box .warning .red").text("请选择质控条目~");
  645. $(".add-box .warning").show();
  646. return;
  647. }
  648. if ((!score) && $("#delModal #addQcScore").val() != '0') {
  649. $(".add-box .warning .red").text("分值不能为空~");
  650. $(".add-box .warning").show();
  651. return;
  652. }
  653. }
  654. if (appealExec.length === 0) {
  655. $(".add-box .warning .red").text("申诉说明不能为空~");
  656. $(".add-box .warning").show();
  657. return;
  658. }
  659. if (appealExec.length > 500) {
  660. $(".add-box .warning .red").text("申诉说明不能超过500个字~");
  661. $(".add-box .warning").show();
  662. return;
  663. }
  664. const obj = Object.assign({}, global_selectedFlaw, { msg, score, appealExec, type, explainInfo, userId });
  665. addScore(obj);
  666. });
  667. }
  668. }
  669. $(document).on("click", "input[name=operType]", (e) => {
  670. $(".add-box .warning").hide();
  671. });
  672. //缺陷列表key值去掉特殊符号
  673. function formatFlawKeys(data) {
  674. const obj = {};
  675. for (let k in data) {
  676. obj[k.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '')] = data[k];
  677. }
  678. return obj;
  679. }
  680. //获取审核人下拉列表
  681. function getCheckUser() {
  682. const param = {};
  683. post(api.getReviewer, param).then(function (res) {
  684. if (res.data.code === '0') {
  685. const data = res.data.data;
  686. global_checkers = data;
  687. $("#delModal .checker-drop-box ul").html("");
  688. $("#flawDropTmpl").tmpl({ info: data }).appendTo("#delModal .checker-drop-box ul");
  689. userDropEvent(".checker-drop-input", selectChecker);
  690. }
  691. });
  692. }
  693. //获取缺陷条目下拉列表
  694. function getQcCasesEntry() {
  695. const name = ($(".flaw-drop-input").val() || "").trim();
  696. const id = $("#subMenu [code=" + global_activeTab + "]").attr("mode");
  697. const param = {
  698. 'behospitalCode': global_id,
  699. 'entryName': name || "",
  700. 'modeId': id
  701. };
  702. post(api.findQcCasesEntry, param).then(function (res) {
  703. if (res.data.code === '0') {
  704. const data = res.data.data;
  705. //if(name){
  706. global_flaws = data;
  707. //if(name){
  708. $("#delModal .flaw-drop-box ul").html("");
  709. $("#flawDropTmpl").tmpl({ info: data }).appendTo("#delModal .flaw-drop-box ul");
  710. //}
  711. /*$("#delModal .flaw-drop-box ul").html("");
  712. $("#flawDropTmpl").tmpl({info:data}).appendTo("#delModal .flaw-drop-box ul");
  713. /*}else{
  714. glal_flaws=data;
  715. showModal('2',data);
  716. }*/
  717. }
  718. });
  719. }
  720. //审核人下拉事件
  721. function userDropEvent(domSelector, selectEvent) {
  722. $("body").on("click", domSelector, function (e) {
  723. e.stopPropagation()
  724. $(domSelector).parents(".drop-box").toggleClass("show");
  725. });
  726. $("body").on("click", ".checker-drop-box li", function () {
  727. $(".add-box .warning").hide();
  728. const n = $(this).attr("idx");
  729. selectEvent(domSelector, n);
  730. $(domSelector).parents(".drop-box").find(".warning").hide();
  731. $(domSelector).parents(".drop-box").removeClass("show");
  732. });
  733. }
  734. $(document).on("click", function () {
  735. $(".checker-drop-box").removeClass("show");
  736. })
  737. //增加条目弹窗元素事件
  738. function flawDropEvent(domSelector, getData, selectEvent) {
  739. $("body").off("click,blur,input");
  740. $("body").on("click", domSelector, function () {
  741. $(domSelector).parents(".drop-box").addClass("show");
  742. });
  743. $("body").on("blur", domSelector, function () {
  744. setTimeout(function () {
  745. $(domSelector).parents(".drop-box").removeClass("show");
  746. }, 300)
  747. });
  748. $("body").on("input", domSelector, function () {
  749. $(this).attr({ "code": "", "title": $(this).val().trim() });
  750. getData($(this).val().trim());
  751. });
  752. $("body").on("click", ".flaw-drop-box li", function () {
  753. $(".add-box .warning").hide();
  754. const n = $(this).attr("idx");
  755. selectEvent(domSelector, n);
  756. $(domSelector).parents(".drop-box").find(".warning").hide();
  757. $(domSelector).parents(".drop-box").removeClass("show");
  758. });
  759. //单选事件
  760. $(".add-box input[type=radio]").on("click", function () {
  761. if ($(this).val() === '1') {
  762. $(".exist-item").show();
  763. } else {
  764. $(".exist-item").hide();
  765. }
  766. });
  767. }
  768. //条目下拉选中
  769. function selectFlaw(domSelector, n) {
  770. const flaw = global_flaws[n] || {};
  771. const { score, msg, entryName, casesEntryId } = flaw;
  772. global_selectedFlaw = flaw;
  773. $(domSelector).val(entryName).attr({ "code": casesEntryId, "title": entryName });
  774. $("#addQcMsg").val(msg).attr("title", msg);
  775. $("#addQcScore").val(score);
  776. }
  777. //审核人下拉选中
  778. function selectChecker(domSelector, n) {
  779. const flaw = global_checkers[n];
  780. const { id, userName } = flaw;
  781. $(domSelector).text(userName).attr({ "code": id, "title": userName });
  782. }
  783. //更新缺陷列表
  784. function updateFlaws() {
  785. const param = {
  786. 'behospitalCode': global_id,
  787. 'paramStr': [
  788. "msg"
  789. ]
  790. };
  791. post(api.getRecordDetail, param).then(function (res) {
  792. if (res.data.code === '0') {
  793. const data = res.data.data;
  794. const { msg } = data;
  795. initScoreItem(msg);
  796. global_flawData = msg;
  797. }
  798. });
  799. }
  800. //获取病例模板
  801. function getInfoModule(moduleId) {
  802. const param = {
  803. moduleId: moduleId
  804. };
  805. post(api.getInfoModule, param).then(function (res) {
  806. if (res.data.code === '0') {
  807. const data = res.data.data;
  808. cachemoduleDatas(data);
  809. getRecordDetail();
  810. }
  811. });
  812. }
  813. //模板数据缓存
  814. function cachemoduleDatas(data) {
  815. const moudle = data.moduleDetail;
  816. global_modules[data.modeName] = [];
  817. for (let i in moudle) {
  818. global_modules[data.modeName].push(moudle[i]);
  819. }
  820. }
  821. //初始化模板
  822. function initModuleData(mid, obj) {
  823. const n = obj.length;
  824. const module = global_modules[mid].moduleDetail;
  825. const key = global_modules[mid].modeName.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '');
  826. let hml = '<div class="content-item" code="' + key + '">' +
  827. '<h2 class="title">' + global_modules[mid].modeName + '(' + mid + ')</h2>' +
  828. (n > 1 ? '<div class="container">' : '<div class="container content-ht">');
  829. for (let i in module) {
  830. hml = hml + '<div class="info-item">';
  831. for (let j = 0; j < module[i].length; j++) {
  832. const detal = module[i][j].questionDTO;
  833. const { tagType } = detal;
  834. switch (tagType) {
  835. case 1:
  836. hml = hml + simpleStructure(detal, obj);
  837. break;
  838. case 4:
  839. hml = hml + combineStructure(detal);
  840. break;
  841. default:
  842. break;
  843. }
  844. }
  845. hml = hml + "</div>"
  846. }
  847. return hml + "</div></div>";
  848. }
  849. //基础类型结构生成
  850. function simpleStructure(data, obj) {
  851. //console.log(data,obj,7878787)
  852. const { name, val, monoLine, addLine, position, bold, retract, id } = data;
  853. if (name === "手术记录表格-1") {
  854. const value = val.replace("【", "").replace("】", "");
  855. const diag = obj[0][value] ? JSON.parse(obj[0][value]) : "";
  856. let thml = `<div class="cont" style="width: 100%;" id="anchor${id}">`;
  857. thml += $("#tableTmpl").tmpl({ k: "手术信息", data: diag })[0].outerHTML + "</div>";
  858. return thml;
  859. }
  860. if (name === "出院诊断表格-1") {
  861. const value = val.replace("【", "").replace("】", "");
  862. const diag = obj[0][value] ? JSON.parse(obj[0][value]) : "";
  863. let thml = `<div class="cont" style="width: 100%;" id="anchor${id}">`;
  864. thml += $("#tableTmpl").tmpl({ k: "出院诊断", data: diag })[0].outerHTML + "</div>";
  865. return thml;
  866. }
  867. const posClass = position === 1 ? 'text-left' : '';
  868. const boldClass = bold === 1 ? 'text-bold' : '';
  869. const retractClass = retract === 1 ? 'text-indent' : '';
  870. const lineHml = ('<p class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' + extractVars(val) + '</p>');
  871. const txtHml = ('<p style="display: inline;vertical-align: middle;" class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' + extractVars(val) + '</p>');
  872. let hml = addLine || monoLine ? `<div class="cont ${posClass}" style="width: 100%;" id="anchor${id}">` : `<div class="cont" id="anchor${id}">`;
  873. hml = hml + `<span class="label">${name}</span>` + (addLine ? lineHml : txtHml) + `</div>`;
  874. return hml;
  875. }
  876. //组合类型结构生成
  877. function combineStructure(data) {
  878. const { name, questionMapping, id } = data;
  879. let hml = '<div class="inner-table"><table>';
  880. const colNum = Math.ceil(questionMapping.length / 2);
  881. let tdVal = '';
  882. const regexp = /(【(.+?)】)/g;
  883. for (let i = 0; i < questionMapping.length;) {
  884. if (questionMapping[i + 1]) {
  885. 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>";
  886. } else {
  887. tdVal = "<td id='anchor" + questionMapping[i].id + "'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td></td>";
  888. }
  889. if (i == 0) {
  890. hml = hml + `<tr><td rowspan="${colNum}" id='anchor${id}'>${name}</td>${tdVal}`;
  891. } else {
  892. hml = hml + `<tr>${tdVal}`;
  893. }
  894. hml = hml + "</tr>";
  895. i = ((i + 2) > questionMapping.length ? i + 1 : i + 2)
  896. }
  897. hml = hml + "</table></div>";
  898. return hml;
  899. }
  900. //抽取变量
  901. function extractVars(org) {
  902. const regexp = /(【(.+?)】)/g;
  903. const arr = org.split(regexp);
  904. //console.log(arr)
  905. let htl = '', val = '';
  906. for (let i = 0; i < arr.length; i++) {
  907. val = arr[i].indexOf("【") != -1 ? '' : (arr[i - 1] && arr[i - 1].indexOf("【") != -1 ? "{{html " + arr[i] + "}}" : arr[i]);
  908. htl = htl + val;
  909. }
  910. return htl;
  911. }
  912. //获取所有模板
  913. function getAllModules() {
  914. const param = {
  915. hospitalId: getUrlArgObject("hid"),
  916. modeId: ''
  917. };
  918. post(api.getModuleById, param).then((res) => {
  919. if (res.data.code === '0') {
  920. const data = res.data.data;
  921. global_modules = data;
  922. getRecordDetail();
  923. $("#loading").hide();
  924. }
  925. });
  926. }
  927. function checkYwQc() {
  928. const param = {
  929. behospitalCode: getUrlArgObject("id"),
  930. hospitalId: getUrlArgObject("hid"),
  931. };
  932. post(ywCheckApi.recordCheck, param).then((res) => {
  933. if (res.data.code === '0') {
  934. global_check = 1
  935. $(".ywCheck").text("重新核查")
  936. $.alerModal({ "message": "核查成功", type: "tip", time: '1000', win: true });
  937. } else {
  938. $.alerModal({ "message": res.data.msg || "核查失败", type: "tip", time: '1000', isFather: false });
  939. }
  940. });
  941. }
  942. });