qcScore.js 37 KB

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