appealUserPage.js 37 KB

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