qcScore.js 36 KB

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