appealUserPage.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  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) {
  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) {
  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.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 obj = {
  524. appealExplain: $("#delModal #qcInfo").val(),
  525. appealOperationType: info.appealOperationType ? info.appealOperationType : 0,
  526. appealType: 1,
  527. checkId: $(".checker-drop-input").attr("code"),
  528. modeId: info.modelId,
  529. modeName: info.modelName,
  530. qcresultDetailId: info.id,
  531. workFlowNodeId: 1,
  532. casesScore: info.casesScore,
  533. casesEntryId: info.casesEntryId,
  534. isReject: info.isReject,
  535. qcresultDetaiValue: info.score,
  536. qcresultDetailMsg: info.standardMsg
  537. };
  538. appealItem(obj);
  539. });
  540. } else if (flag === '1') { //查看
  541. $("#delModal .title").text("查看");
  542. $("#delModal .confirm").hide();
  543. $("#delModal .modal-box").css("margin-top", '-245px');
  544. //0申诉1驳回2审核
  545. //新增项模板
  546. getAppealDetail(code, i, id, qcresultDetailId);
  547. } else if (flag === '2') { //新增
  548. $("#delModal .title").text("申诉新增");
  549. $("#delModal .modal-box").css("margin-top", "-281px");
  550. //新增项模板
  551. $("#addFlawTmpl").tmpl().appendTo("#delModal .modal-body");
  552. //缺陷项下拉模板
  553. $("#flawDropTmpl").tmpl({ info: global_flaws }).appendTo("#delModal .flaw-drop-box ul");
  554. //审核人模板
  555. $("#delModal .checker-drop-box ul").html("");
  556. $("#flawDropTmpl").tmpl({ info: global_checkers }).appendTo("#delModal .checker-drop-box ul");
  557. //事件绑定
  558. flawDropEvent(".add-box .flaw-drop-input", getQcCasesEntry, selectFlaw);
  559. //分数输入验证
  560. $("#addQcScore").on("input", function () {
  561. if (/^[0-9]\d*$|^[0-9]\d*(.\d)?$/.test(val) && val <= 100) {
  562. $(".add-box .warning").hide();
  563. } else {
  564. $(".add-box .warning .red").text("支持≥0且≤100的数字输入,最多保留小数点后1位~");
  565. $(".add-box .warning").show();
  566. return;
  567. }
  568. });
  569. //提示信息输入验证
  570. $("#addQcMsg").on("input", function () {
  571. const val = $(this).val();
  572. $(this).attr("title", val)
  573. if (val.trim()) {
  574. $(".add-box .warning").hide();
  575. } else {
  576. $(".add-box .warning .red").text("提示信息不能为空~");
  577. $(".add-box .warning").show();
  578. return;
  579. }
  580. });
  581. //备注输入验证
  582. $("#addQcInfo").on("input", function () {
  583. const val = $(this).val();
  584. $(this).attr("title", val)
  585. if (val.length > 125) {
  586. $(".add-box .warning .red").text("备注不能超过125个字~");
  587. $(".add-box .warning").show();
  588. } else {
  589. $(".add-box .warning").hide();
  590. return;
  591. }
  592. });
  593. //申诉说明输入验证
  594. $("#addQcEx").on("input", function () {
  595. const val = $(this).val();
  596. if (val.trim().length === 0) {
  597. $(".add-box .warning .red").text("申诉说明不能为空~");
  598. $(".add-box .warning").show();
  599. } else if (val.length > 500) {
  600. $(".add-box .warning .red").text("申诉说明不能超过500个字~");
  601. $(".add-box .warning").show();
  602. } else {
  603. $(".add-box .warning").hide();
  604. return;
  605. }
  606. });
  607. //新增申诉提交事件
  608. $("#delModal .confirm").unbind("click").click(function () {
  609. const type = $("input[name=operType]:checked").val();
  610. const msg = $("#delModal #addQcMsg").val();
  611. const score = Number($("#delModal #addQcScore").val());
  612. const explainInfo = $("#delModal #addQcInfo").val();
  613. const appealExec = $("#delModal #addQcEx").val(); //申诉说明
  614. const userId = $(".checker-drop-input").attr("code");
  615. if ($(".edit-box .warning").is(":visible")) {
  616. return;
  617. }
  618. //必填验证
  619. if (type === '1') { //新增已有时
  620. if (!userId) {
  621. $(".add-box .warning .red").text("请选择审核人~");
  622. $(".add-box .warning").show();
  623. return;
  624. }
  625. if (!$(".flaw-drop-input").attr("code")) {
  626. $(".add-box .warning .red").text("请选择质控条目~");
  627. $(".add-box .warning").show();
  628. return;
  629. }
  630. if ((!score) && $("#delModal #addQcScore").val() != '0') {
  631. $(".add-box .warning .red").text("分值不能为空~");
  632. $(".add-box .warning").show();
  633. return;
  634. }
  635. }
  636. if (appealExec.length === 0) {
  637. $(".add-box .warning .red").text("申诉说明不能为空~");
  638. $(".add-box .warning").show();
  639. return;
  640. }
  641. if (appealExec.length > 500) {
  642. $(".add-box .warning .red").text("申诉说明不能超过500个字~");
  643. $(".add-box .warning").show();
  644. return;
  645. }
  646. const obj = Object.assign({}, global_selectedFlaw, { msg, score, appealExec, type, explainInfo, userId });
  647. addScore(obj);
  648. });
  649. }
  650. }
  651. //缺陷列表key值去掉特殊符号
  652. function formatFlawKeys(data) {
  653. const obj = {};
  654. for (let k in data) {
  655. obj[k.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '')] = data[k];
  656. }
  657. return obj;
  658. }
  659. //获取审核人下拉列表
  660. function getCheckUser() {
  661. const param = {};
  662. post(api.getReviewer, param).then(function (res) {
  663. if (res.data.code === '0') {
  664. const data = res.data.data;
  665. global_checkers = data;
  666. $("#delModal .checker-drop-box ul").html("");
  667. $("#flawDropTmpl").tmpl({ info: data }).appendTo("#delModal .checker-drop-box ul");
  668. userDropEvent(".checker-drop-input", selectChecker);
  669. }
  670. });
  671. }
  672. //获取缺陷条目下拉列表
  673. function getQcCasesEntry() {
  674. const name = ($(".flaw-drop-input").val() || "").trim();
  675. const id = $("#subMenu [code=" + global_activeTab + "]").attr("mode");
  676. const param = {
  677. 'behospitalCode': global_id,
  678. 'entryName': name || "",
  679. 'modeId': id
  680. };
  681. post(api.findQcCasesEntry, param).then(function (res) {
  682. if (res.data.code === '0') {
  683. const data = res.data.data;
  684. //if(name){
  685. global_flaws = data;
  686. //if(name){
  687. $("#delModal .flaw-drop-box ul").html("");
  688. $("#flawDropTmpl").tmpl({ info: data }).appendTo("#delModal .flaw-drop-box ul");
  689. //}
  690. /*$("#delModal .flaw-drop-box ul").html("");
  691. $("#flawDropTmpl").tmpl({info:data}).appendTo("#delModal .flaw-drop-box ul");
  692. /*}else{
  693. glal_flaws=data;
  694. showModal('2',data);
  695. }*/
  696. }
  697. });
  698. }
  699. //审核人下拉事件
  700. function userDropEvent(domSelector, selectEvent) {
  701. $("body").on("click", domSelector, function (e) {
  702. e.stopPropagation()
  703. $(domSelector).parents(".drop-box").toggleClass("show");
  704. });
  705. $("body").on("click", ".checker-drop-box li", function () {
  706. $(".add-box .warning").hide();
  707. const n = $(this).attr("idx");
  708. selectEvent(domSelector, n);
  709. $(domSelector).parents(".drop-box").find(".warning").hide();
  710. $(domSelector).parents(".drop-box").removeClass("show");
  711. });
  712. }
  713. $(document).on("click", function () {
  714. $(".checker-drop-box").removeClass("show");
  715. })
  716. //增加条目弹窗元素事件
  717. function flawDropEvent(domSelector, getData, selectEvent) {
  718. $("body").off("click,blur,input");
  719. $("body").on("click", domSelector, function () {
  720. $(domSelector).parents(".drop-box").addClass("show");
  721. });
  722. $("body").on("blur", domSelector, function () {
  723. setTimeout(function () {
  724. $(domSelector).parents(".drop-box").removeClass("show");
  725. }, 300)
  726. });
  727. $("body").on("input", domSelector, function () {
  728. $(this).attr({ "code": "", "title": $(this).val().trim() });
  729. getData($(this).val().trim());
  730. });
  731. $("body").on("click", ".flaw-drop-box li", function () {
  732. $(".add-box .warning").hide();
  733. const n = $(this).attr("idx");
  734. selectEvent(domSelector, n);
  735. $(domSelector).parents(".drop-box").find(".warning").hide();
  736. $(domSelector).parents(".drop-box").removeClass("show");
  737. });
  738. //单选事件
  739. $(".add-box input[type=radio]").on("click", function () {
  740. if ($(this).val() === '1') {
  741. $(".exist-item").show();
  742. } else {
  743. $(".exist-item").hide();
  744. }
  745. });
  746. }
  747. //条目下拉选中
  748. function selectFlaw(domSelector, n) {
  749. const flaw = global_flaws[n] || {};
  750. const { score, msg, entryName, casesEntryId } = flaw;
  751. global_selectedFlaw = flaw;
  752. $(domSelector).val(entryName).attr({ "code": casesEntryId, "title": entryName });
  753. $("#addQcMsg").val(msg).attr("title", msg);
  754. $("#addQcScore").val(score);
  755. }
  756. //审核人下拉选中
  757. function selectChecker(domSelector, n) {
  758. const flaw = global_checkers[n];
  759. const { id, userName } = flaw;
  760. $(domSelector).text(userName).attr({ "code": id, "title": userName });
  761. }
  762. //更新缺陷列表
  763. function updateFlaws() {
  764. const param = {
  765. 'behospitalCode': global_id,
  766. 'paramStr': [
  767. "msg"
  768. ]
  769. };
  770. post(api.getRecordDetail, param).then(function (res) {
  771. if (res.data.code === '0') {
  772. const data = res.data.data;
  773. const { msg } = data;
  774. initScoreItem(msg);
  775. global_flawData = msg;
  776. }
  777. });
  778. }
  779. //获取病例模板
  780. function getInfoModule(moduleId) {
  781. const param = {
  782. moduleId: moduleId
  783. };
  784. post(api.getInfoModule, param).then(function (res) {
  785. if (res.data.code === '0') {
  786. const data = res.data.data;
  787. cachemoduleDatas(data);
  788. getRecordDetail();
  789. }
  790. });
  791. }
  792. //模板数据缓存
  793. function cachemoduleDatas(data) {
  794. const moudle = data.moduleDetail;
  795. global_modules[data.modeName] = [];
  796. for (let i in moudle) {
  797. global_modules[data.modeName].push(moudle[i]);
  798. }
  799. }
  800. //初始化模板
  801. function initModuleData(mid, obj) {
  802. const n = obj.length;
  803. const module = global_modules[mid].moduleDetail;
  804. const key = global_modules[mid].modeName.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '');
  805. let hml = '<div class="content-item" code="' + key + '">' +
  806. '<h2 class="title">' + global_modules[mid].modeName + '(' + mid + ')</h2>' +
  807. (n > 1 ? '<div class="container">' : '<div class="container content-ht">');
  808. for (let i in module) {
  809. hml = hml + '<div class="info-item">';
  810. for (let j = 0; j < module[i].length; j++) {
  811. const detal = module[i][j].questionDTO;
  812. const { tagType } = detal;
  813. switch (tagType) {
  814. case 1:
  815. hml = hml + simpleStructure(detal, obj);
  816. break;
  817. case 4:
  818. hml = hml + combineStructure(detal);
  819. break;
  820. default:
  821. break;
  822. }
  823. }
  824. hml = hml + "</div>"
  825. }
  826. return hml + "</div></div>";
  827. }
  828. //基础类型结构生成
  829. function simpleStructure(data, obj) {
  830. //console.log(data,obj,7878787)
  831. const { name, val, monoLine, addLine, position, bold, retract, id } = data;
  832. if (name === "手术记录表格-1") {
  833. const value = val.replace("【", "").replace("】", "");
  834. const diag = obj[0][value] ? JSON.parse(obj[0][value]) : "";
  835. let thml = `<div class="cont" style="width: 100%;" id="anchor${id}">`;
  836. thml += $("#tableTmpl").tmpl({ k: "手术信息", data: diag })[0].outerHTML + "</div>";
  837. return thml;
  838. }
  839. if (name === "出院诊断表格-1") {
  840. const value = val.replace("【", "").replace("】", "");
  841. const diag = obj[0][value] ? JSON.parse(obj[0][value]) : "";
  842. let thml = `<div class="cont" style="width: 100%;" id="anchor${id}">`;
  843. thml += $("#tableTmpl").tmpl({ k: "出院诊断", data: diag })[0].outerHTML + "</div>";
  844. return thml;
  845. }
  846. const posClass = position === 1 ? 'text-left' : '';
  847. const boldClass = bold === 1 ? 'text-bold' : '';
  848. const retractClass = retract === 1 ? 'text-indent' : '';
  849. const lineHml = ('<p class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' + extractVars(val) + '</p>');
  850. const txtHml = ('<p style="display: inline;vertical-align: middle;" class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' + extractVars(val) + '</p>');
  851. let hml = addLine || monoLine ? `<div class="cont ${posClass}" style="width: 100%;" id="anchor${id}">` : `<div class="cont" id="anchor${id}">`;
  852. hml = hml + `<span class="label">${name}</span>` + (addLine ? lineHml : txtHml) + `</div>`;
  853. return hml;
  854. }
  855. //组合类型结构生成
  856. function combineStructure(data) {
  857. const { name, questionMapping, id } = data;
  858. let hml = '<div class="inner-table"><table>';
  859. const colNum = Math.ceil(questionMapping.length / 2);
  860. let tdVal = '';
  861. const regexp = /(【(.+?)】)/g;
  862. for (let i = 0; i < questionMapping.length;) {
  863. if (questionMapping[i + 1]) {
  864. 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>";
  865. } else {
  866. tdVal = "<td id='anchor" + questionMapping[i].id + "'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td></td>";
  867. }
  868. if (i == 0) {
  869. hml = hml + `<tr><td rowspan="${colNum}" id='anchor${id}'>${name}</td>${tdVal}`;
  870. } else {
  871. hml = hml + `<tr>${tdVal}`;
  872. }
  873. hml = hml + "</tr>";
  874. i = ((i + 2) > questionMapping.length ? i + 1 : i + 2)
  875. }
  876. hml = hml + "</table></div>";
  877. return hml;
  878. }
  879. //抽取变量
  880. function extractVars(org) {
  881. const regexp = /(【(.+?)】)/g;
  882. const arr = org.split(regexp);
  883. //console.log(arr)
  884. let htl = '', val = '';
  885. for (let i = 0; i < arr.length; i++) {
  886. val = arr[i].indexOf("【") != -1 ? '' : (arr[i - 1] && arr[i - 1].indexOf("【") != -1 ? "{{html " + arr[i] + "}}" : arr[i]);
  887. htl = htl + val;
  888. }
  889. return htl;
  890. }
  891. //获取所有模板
  892. function getAllModules() {
  893. const param = {
  894. hospitalId: getUrlArgObject("hid"),
  895. modeId: ''
  896. };
  897. post(api.getModuleById, param).then((res) => {
  898. if (res.data.code === '0') {
  899. const data = res.data.data;
  900. global_modules = data;
  901. getRecordDetail();
  902. $("#loading").hide();
  903. }
  904. });
  905. }
  906. function checkYwQc() {
  907. const param = {
  908. behospitalCode: getUrlArgObject("id"),
  909. hospitalId: getUrlArgObject("hid"),
  910. };
  911. post(ywCheckApi.recordCheck, param).then((res) => {
  912. if (res.data.code === '0') {
  913. global_check = 1
  914. $(".ywCheck").text("重新核查")
  915. $.alerModal({ "message": "核查成功", type: "tip", time: '1000', win: true });
  916. } else {
  917. $.alerModal({ "message": res.data.msg || "核查失败", type: "tip", time: '1000', isFather: false });
  918. }
  919. });
  920. }
  921. });