qcScore.js 36 KB

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