qcScore.js 36 KB

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