appealHistory.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. const $ = require('jquery');
  2. require("../css/appealHistory.less");
  3. require('./modal.js');
  4. require('jquery-templates');
  5. const { api } = require('./api.js')
  6. const { post, getCookie, getLocal, getUrlArgObjectNew, emptyBox, downloadExportedData, expJson, getLogoParam, listenScroll, getPickerDate, exportTimeLimit } = require('./utils.js')
  7. require('./../resource/jquery-ui/jquery-ui.min.js');
  8. require('./../resource/jquery-ui/jquery-ui.min.css');
  9. const iconCheck = require("./../images/icon_check.png")
  10. const iconUnCheck = require("./../images/icon_unchecked.png")
  11. const iconCalenBlue = require("./../images/icon_calen_blue.png")
  12. const iconCalenGrey = require("./../images/icon_calen_grey.png")
  13. const iconDown = require("./../images/arrow_down.png")
  14. const iconUp = require("./../images/arrow_up.png")
  15. const arrowLeft = require("./../images/arrow_left.png")
  16. const arrowRight = require("./../images/arrow_right.png")
  17. const goUpG = require("./../images/arrow_up_grey.png")
  18. const goUpB = require("./../images/arrow_up_blue.png")
  19. const goDownG = require("./../images/arrow_down_grey.png")
  20. const goDownB = require("./../images/arrow_down_blue.png");
  21. const ret = require('bluebird/js/release/util');
  22. listenScroll()
  23. let pageSet = [], pageSetCopy = [], showNum = 0, scrollTop = 0;
  24. $(".selectModular").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  25. $(".selectType").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  26. $(".selectDept").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  27. $(".fpSelectCheck").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  28. $(".qcSelectCheck").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  29. let srcUrl = $("#contentIframe", parent.document).attr("src")
  30. let statisticsType = getUrlArgObjectNew("dateType", srcUrl) || getUrlArgObjectNew("shijian", srcUrl) || ""
  31. let startDateParam = getUrlArgObjectNew("startDateParam", srcUrl) || ""
  32. let endDateParam = getUrlArgObjectNew("endDateParam", srcUrl) || ""
  33. let tabList = [], deptName = "", deptNameTemp = "", behosDateStart = "", behosDateEnd = "", moduleName = "", operationType = "",
  34. deptId = "", deptIdTemp = "",
  35. fpCheckStatusTemp = "", fpCheckNameTemp = "", qcCheckNameTemp = "", state = "",
  36. global_checkers = []; //审核人列表;
  37. let isPlacefile = getCookie('isPlacefile') || 1
  38. $('.datapickerBox').append(`<img class="iconCalen" src=${iconCalenGrey} />`)
  39. $('.iconCalen').on("mouseenter", function (e) {
  40. $(this).attr("src", iconCalenBlue)
  41. })
  42. $('.iconCalen').on("mouseleave", function (e) {
  43. $(this).attr("src", iconCalenGrey)
  44. })
  45. $('.iconCalen').on("click", function (e) {
  46. $(this).parent().find("input").focus()
  47. })
  48. $(".menu .page", parent.document).removeClass("active")
  49. $(parent.document).find(".menu .page[code=YH-SSXX-SSJL]").addClass("active")
  50. function getTabData(activePage) {
  51. const behosDateStart = getPickerDate($("#datepicker"), 1)
  52. const behosDateEnd = getPickerDate($("#datepicker2"), 2)
  53. const param = {
  54. current: activePage,
  55. deptId: deptId.trim(),
  56. deptName: deptName == "全部" ? "" : deptName || '',
  57. casesName: moduleName,
  58. operationType: operationType,
  59. state: state,
  60. size: 15,
  61. name: $('.patientNameInp').val(),
  62. complaintDateEnd: behosDateEnd.replaceAll("/", "-"),
  63. complaintDateStart: behosDateStart.replaceAll("/", "-"),
  64. }
  65. $('.pagination').html("")
  66. $('.tbody').html(emptyBox('努力加载中...', '',))
  67. return post(api.getComplaintRecord, param).then(res => {
  68. if (res.data.code == '0') {
  69. tabList = res.data.data.data.records
  70. const totalPage = res.data.data.data.pages
  71. const totalNum = res.data.data.data.total
  72. renderTab(tabList)
  73. renderPagination(totalPage, Number(activePage), totalNum)
  74. if (totalPage > 1) {
  75. renderPagination(totalPage, Number(activePage), totalNum)
  76. } else {
  77. $('.pagination').html("")
  78. }
  79. } else {
  80. const token = localStorage.getItem('accessToken');
  81. if (!token && window.location.href.indexOf('login') == -1) {
  82. //alert('无token判断,跳回登录')
  83. } else {
  84. $.alerModal({ "message": res.data.msg, type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
  85. }
  86. }
  87. }).catch((e) => {
  88. })
  89. }
  90. $(".filter").on("click", function (e) {
  91. behosDateStart = $("#datepicker").val()
  92. behosDateEnd = $("#datepicker2").val()
  93. const behosDateStartTime = new Date(behosDateStart).getTime()
  94. const behosDateEndTime = new Date(behosDateEnd).getTime()
  95. if (behosDateStartTime > behosDateEndTime) {
  96. $.alerModal({ "message": '申诉时间开始时间不能大于结束时间~', type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
  97. return
  98. }
  99. if (behosDateStart) {
  100. behosDateStart = behosDateStart.replace(/\//g, '-') + ' 00:00:00'
  101. }
  102. if (behosDateEnd) {
  103. behosDateEnd = behosDateEnd.replace(/\//g, '-') + ' 23:59:59'
  104. }
  105. deptId = deptIdTemp
  106. deptName = deptNameTemp
  107. fpCheckName = fpCheckNameTemp
  108. qcCheckName = qcCheckNameTemp
  109. fpCheckStatus = fpCheckStatusTemp
  110. qcCheckStatus = state
  111. getTabData(1)
  112. })
  113. $(".abnormalClear").on("click", function (e) {
  114. tabList = [];
  115. scoreSum = 0;
  116. deptId = "";
  117. deptIdTemp = "";
  118. deptName = deptNameTemp = "";
  119. fpCheckName = "";
  120. qcCheckName = "";
  121. qcCheckMain = "";
  122. fpCheckNameTemp = "";
  123. qcCheckNameTemp = "";
  124. qcCheckMainTemp = "";
  125. fpCheckStatus = "";
  126. fpCheckStatusTemp = "";
  127. qcCheckStatus = "";
  128. state = ""
  129. operationType = ""
  130. data_desc = ["leave_hospital_date"]
  131. if (isPlacefile != 1) {
  132. data_desc = ["behospital_date"]
  133. }
  134. data_asc = [];
  135. $('.patientNameInp').val('')
  136. // $('#datepicker').val('')
  137. // $('#datepicker2').val('')
  138. //默认日期为近一周
  139. $("#datepicker").datepicker({
  140. changeMonth: true,
  141. changeYear: true,
  142. dateFormat: "yy/mm/dd",
  143. }).datepicker("setDate", "-6d");
  144. $("#datepicker2").datepicker({
  145. changeMonth: true,
  146. changeYear: true,
  147. dateFormat: "yy/mm/dd"
  148. }).datepicker("setDate", new Date());
  149. $("#datepickerFp1").datepicker({
  150. changeMonth: true,
  151. changeYear: true,
  152. dateFormat: "yy/mm/dd",
  153. }).datepicker("setDate", "");
  154. $("#datepickerFp2").datepicker({
  155. changeMonth: true,
  156. changeYear: true,
  157. dateFormat: "yy/mm/dd"
  158. }).datepicker("setDate", "");
  159. $("#datepickerQc1").datepicker({
  160. changeMonth: true,
  161. changeYear: true,
  162. dateFormat: "yy/mm/dd",
  163. }).datepicker("setDate", "");
  164. $("#datepickerQc2").datepicker({
  165. changeMonth: true,
  166. changeYear: true,
  167. dateFormat: "yy/mm/dd"
  168. }).datepicker("setDate", "");
  169. $('.selectDept ').html('全部')
  170. $(".deptList").css("display", "none")
  171. $(".selectDept").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  172. // $('.selectDept ').addClass('unSelect')
  173. $('.selectModular').html('全部')
  174. $(".modularList").css("display", "none")
  175. $(".selectModular").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  176. // $('.selectModular ').addClass('unSelect')
  177. $('.fpSelectCheck').html('全部')
  178. $(".fpCheckList").css("display", "none")
  179. $(".fpSelectCheck").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  180. $('.qcSelectCheck').html('全部')
  181. $(".qcCheckList").css("display", "none")
  182. $(".qcSelectCheck").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  183. $("th[code]").removeClass("asc desc")
  184. if (isPlacefile == 1) {
  185. $(".leaveHospitalDate").addClass(" desc")
  186. } else {
  187. $(".behospitalDate").addClass(" desc")
  188. }
  189. behosDateStart = $("#datepicker").val()
  190. behosDateEnd = $("#datepicker2").val()
  191. if (behosDateStart) {
  192. behosDateStart = behosDateStart.replace(/\//g, '-') + ' 00:00:00'
  193. }
  194. if (behosDateEnd) {
  195. behosDateEnd = behosDateEnd.replace(/\//g, '-') + ' 23:59:59'
  196. }
  197. getTabData(1)
  198. })
  199. getmoduleList()
  200. //获取模块类型
  201. function getmoduleList() {
  202. post(api.getQcCasesAll).then(res => {
  203. if (res.data.code == '0') {
  204. const moduleTypeList = res.data.data
  205. renderModuleList(moduleTypeList)
  206. } else { }
  207. }).catch((e) => {
  208. })
  209. }
  210. function renderModuleList(moduleTypeList) {
  211. let str = `<li class="modularItem " data-id="" data-name="全部">全部</li>`
  212. for (let i = 0; i < moduleTypeList.length; i++) {
  213. str += `<li class="modularItem ellipsis" title=${moduleTypeList[i].name} data-id=${moduleTypeList[i].id} data-name=${moduleTypeList[i].name}> ${moduleTypeList[i].name}</li>`
  214. }
  215. $('.modularList').html(str)
  216. bindModuleSelect()
  217. }
  218. //模块类型选择
  219. function bindModuleSelect() {
  220. $('.modularItem').on("click", function () {
  221. const modularItemName = $(this).attr("data-name")
  222. const modularItemItemId = $(this).attr("data-id")
  223. moduleName = modularItemItemId
  224. $('.selectModular').html(modularItemName)
  225. $(".modularList").css("display", "none")
  226. $(".selectModular").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  227. $('.selectModular').removeClass('unSelect')
  228. })
  229. }
  230. getAppealReviewDictionary()
  231. //获取操作类型
  232. function getAppealReviewDictionary() {
  233. post(api.getAppealReviewDictionary).then(res => {
  234. if (res.data.code == '0') {
  235. const typeList = res.data.data['操作类型']
  236. const statusList = res.data.data['状态']
  237. renderTypeList(typeList)
  238. renderStatusList(statusList)
  239. } else { }
  240. }).catch((e) => {
  241. })
  242. }
  243. function renderTypeList(data) {
  244. let str = `<li class="typeItem " data-id="" data-name="全部">全部</li>`
  245. for (var i in data) {
  246. str += `<li class="typeItem ellipsis" title=${data[i]} data-id=${i} data-name=${data[i]}> ${data[i]}</li>`
  247. }
  248. $('.typeList').html(str)
  249. bindTypedSelect()
  250. }
  251. //操作类型选择
  252. function bindTypedSelect() {
  253. $('.typeItem').on("click", function () {
  254. const typeItemName = $(this).attr("data-name")
  255. const typeItemItemId = $(this).attr("data-id")
  256. operationType = typeItemItemId
  257. $('.selectType').html(typeItemName)
  258. $(".typeList").css("display", "none")
  259. $(".selectType").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  260. $('.selectType').removeClass('unSelect')
  261. })
  262. }
  263. function renderStatusList(data) {
  264. let str = `<li class="qcCheckItem " data-id="" data-name="全部">全部</li>`
  265. for (var i in data) {
  266. str += `<li class="qcCheckItem ellipsis" title=${data[i]} data-id=${i} data-name=${data[i]}> ${data[i]}</li>`
  267. }
  268. $('.qcCheckList').html(str)
  269. bindCheckedSelectQc()
  270. }
  271. //状态
  272. function bindCheckedSelectQc() {
  273. $('.qcCheckItem').on("click", function () {
  274. const qcCheckItemName = $(this).attr("data-name")
  275. const qcCheckItemItemId = $(this).attr("data-id") || ""
  276. state = qcCheckItemItemId
  277. $('.qcSelectCheck').html(qcCheckItemName)
  278. $(".qcCheckList").css("display", "none")
  279. $(".qcSelectCheck").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  280. $('.qcSelectCheck').removeClass('unSelect')
  281. })
  282. }
  283. //获取审核人下拉列表
  284. function getCheckUser() {
  285. const param = {};
  286. post(api.getReviewer, param).then(function (res) {
  287. if (res.data.code === '0') {
  288. const data = res.data.data;
  289. global_checkers = data;
  290. $("#flawDropTmpl").tmpl({ info: data }).appendTo("#delModal .checker-drop-box ul");
  291. userDropEvent(".checker-drop-input", selectChecker);
  292. }
  293. });
  294. }
  295. function userDropEvent(domSelector, selectEvent) {
  296. $("body").on("click", domSelector, function () {
  297. $(domSelector).parents(".drop-box").toggleClass("show");
  298. });
  299. $("body").on("click", ".checker-drop-box li", function () {
  300. $(".add-box .warning").hide();
  301. const n = $(this).attr("idx");
  302. selectEvent(domSelector, n);
  303. $(domSelector).parents(".drop-box").find(".warning").hide();
  304. $(domSelector).parents(".drop-box").removeClass("show");
  305. });
  306. }
  307. //审核人下拉选中
  308. function selectChecker(domSelector, n) {
  309. const flaw = global_checkers[n];
  310. const { id, userName } = flaw;
  311. $(domSelector).text(userName).attr({ "code": id, "title": userName });
  312. }
  313. function renderTab(data) {
  314. let str = ``
  315. if (data.length === 0) {
  316. $('.tbody').html(emptyBox(null, showNum + 12))
  317. return;
  318. }
  319. for (let i = 0; i < data.length; i++) {
  320. const item = data[i]
  321. str += `
  322. <tr>
  323. <td >${item.claimantName || "-"}</td>
  324. <td >${item.behDeptName || "-"}</td>
  325. <td >${item.claimantGmtCreate}</td>
  326. <td >${item.behospitalCode}</td>
  327. <td >${item.name || "-"}</td>
  328. <td >${item.casesName || "-"}</td>
  329. <td >${item.defectContent || "-"}</td>
  330. <td >${item.checkName || "-"}</td>
  331. <td >${item.checkGmtCreate || "-"}</td>
  332. <td >${item.appealOperationType == 0 ? '删改条目' : item.appealOperationType == 1 ? '新增已有条目' : item.appealOperationType == 2 ? '新增缺失条目' : '恢复条目'}</td>
  333. <td >${item.exampleStatus == 0 ? '<span class="review"><i></i>待审核</span>' : item.exampleStatus == 1 ? '<span class="rejected"><i></i>已驳回</span>' : '<span class="approved"><i></i>审核通过</span>'}</td>
  334. <td data-id="${item.id || ""}" data-hos="${item.hospitalId || ""}" data-behospitalCode="${item.behospitalCode || ""}" data-casesEntryId="${item.casesEntryId || ""}" data-qcresultDetailId="${item.qcresultDetailId || ""}" data-appealOperationType="${item.appealOperationType || ""}" data-index=${i}>
  335. ${item.exampleStatus == 0 ? `<span class="appealBtn goHomeDetail1">查看</span><span class="appealBtn withdraw" >撤回</span>` : ''}
  336. ${item.exampleStatus == 1 || item.exampleStatus == 2 ? `<span class="appealBtn appealAgain">再次申诉</span>` : ''}
  337. </td>
  338. </tr>
  339. `
  340. }
  341. $('.tbody').html(str)
  342. $(".withdraw").click(function () {
  343. let id = $(this).parent().attr("data-id")
  344. console.log(id);
  345. cancelAppealInfo(id)
  346. })
  347. $(".appealAgain").click(function () {
  348. let i = $(this).parent().attr("data-index")
  349. $("#delModal .modal-body").html("");
  350. $("#delModal").show();
  351. getCheckUser()
  352. if (data[i].appealOperationType == 1) {
  353. if (data[i].exampleStatus == 2) {
  354. data[i].appealOperationType = 0
  355. } else {
  356. data[i].appealOperationType = 1
  357. }
  358. } else if (data[i].appealOperationType == 3) {
  359. data[i].appealOperationType = 0
  360. }
  361. $("#appealDef").tmpl(data[i]).appendTo("#delModal .modal-body");
  362. $("#delModal .confirm").text("确定").unbind("click").click(function () {
  363. addAppealInfo(data[i])
  364. });
  365. })
  366. $(".goHomeDetail1").click(function () {
  367. let id = $(this).parent().attr("data-id")
  368. let hospitalId = $(this).parent().attr("data-hos")
  369. let behospitalCode = $(this).parent().attr("data-behospitalCode")
  370. let casesEntryId = $(this).parent().attr("data-casesEntryId")
  371. let qcresultDetailId = $(this).parent().attr("data-qcresultDetailId")
  372. let appealOperationType = $(this).parent().attr("data-appealOperationType")
  373. $(parent.document).find("#contentIframe").attr("src", "appealExamine.html?id=" + id + "&hospitalId=" + hospitalId + "&behospitalCode=" + behospitalCode + "&casesEntryId=" + casesEntryId + "&qcresultDetailId=" + qcresultDetailId + "&appealOperationType=" + appealOperationType + "&form=" + 3)
  374. })
  375. }
  376. function cancelAppealInfo(id) {
  377. post(api.cancelAppealInfo, { id: id }).then(function (res) {
  378. if (res.data.code === '0') {
  379. getTabData(1)
  380. $.alerModal({ "message": "撤回成功", type: "tip", time: '1000', win: true });
  381. } else {
  382. $.alerModal({ "message": res.data.msg || '失败,请重试~', type: "tip", time: '1000', win: 'default' });
  383. }
  384. }).catch(() => {
  385. $.alerModal({ "message": '失败,请重试~', type: "tip", time: '1000', win: 'default' });
  386. });
  387. }
  388. //再次申诉
  389. function addAppealInfo(data) {
  390. $(".warning").hide();
  391. let val = $(".textarea").val()
  392. let num = 500
  393. if (!val) {
  394. $(".warning .red").text("申诉说明不能为空~");
  395. $(".warning").show();
  396. return
  397. } else if (val.length > num) {
  398. $(".warning .red").text("申诉说明不能超过" + num + "个字~");
  399. $(".warning").show();
  400. return
  401. }
  402. const param = {
  403. appealExplain: $(".textarea").val(),
  404. appealOperationType: data.appealOperationType,
  405. behospitalCode: data.behospitalCode,
  406. checkId: $(".checker-drop-input").attr("code"),
  407. appealType: 1,
  408. qcresultDetailId: data.qcresultDetailId,
  409. }
  410. post(api.addAppealInfo, param).then(function (res) {
  411. if (res.data.code === '0') {
  412. getTabData(1)
  413. $("#delModal").hide();
  414. $.alerModal({ "message": "申诉成功", type: "tip", time: '1000', win: true });
  415. } else {
  416. $.alerModal({ "message": res.data.msg || '失败,请重试~', type: "tip", time: '1000', win: 'default' });
  417. }
  418. }).catch(() => {
  419. $.alerModal({ "message": '失败,请重试~', type: "tip", time: '1000', win: 'default' });
  420. });
  421. }
  422. $(document).on("click", ".checker-drop-input", (e) => {
  423. e.stopPropagation()
  424. $("#delModal ul").css("display", "block")
  425. });
  426. $(document).on("click", ".infoItem", (e) => {
  427. e.stopPropagation()
  428. const name = $(this).attr("data-name")
  429. $("#delModal ul").css("display", "none")
  430. });
  431. //选择病历等级
  432. $('.selectModular').on("click", function (e) {
  433. e.stopPropagation()
  434. $(".deptList ").css("display", "none")
  435. $(".selectDept .arrow").attr("src", iconDown)
  436. $(".checkList ").css("display", "none")
  437. $(".selectCheck .arrow").attr("src", iconDown)
  438. $(".fpCheckList ").css("display", "none")
  439. $(".fpSelectCheck .arrow").attr("src", iconDown)
  440. $(".qcSelectCheck .arrow").attr("src", iconDown)
  441. $(".qcCheckList ").css("display", "none")
  442. const showList = $(".modularList ").css("display")
  443. if (showList == "none" || !showList) {
  444. $(".modularList ").css("display", "block")
  445. $(".selectModular .arrow").attr("src", iconUp)
  446. } else {
  447. $(".modularList ").css("display", "none")
  448. $(".selectModular .arrow").attr("src", iconDown)
  449. }
  450. })
  451. //操作类型
  452. $('.selectType').on("click", function (e) {
  453. e.stopPropagation()
  454. $(".deptList ").css("display", "none")
  455. $(".selectDept .arrow").attr("src", iconDown)
  456. $(".checkList ").css("display", "none")
  457. $(".selectCheck .arrow").attr("src", iconDown)
  458. $(".fpCheckList ").css("display", "none")
  459. $(".fpSelectCheck .arrow").attr("src", iconDown)
  460. $(".qcSelectCheck .arrow").attr("src", iconDown)
  461. $(".qcCheckList ").css("display", "none")
  462. const showList = $(".typeList ").css("display")
  463. if (showList == "none" || !showList) {
  464. $(".typeList ").css("display", "block")
  465. $(".selectType .arrow").attr("src", iconUp)
  466. } else {
  467. $(".typeList ").css("display", "none")
  468. $(".selectType .arrow").attr("src", iconDown)
  469. }
  470. })
  471. //选择状态
  472. $('.qcSelectCheck').on("click", function (e) {
  473. e.stopPropagation()
  474. $(".deptList ").css("display", "none")
  475. $(".selectDept .arrow").attr("src", iconDown)
  476. $(".modularList ").css("display", "none")
  477. $(".selectModular .arrow").attr("src", iconDown)
  478. $(".fpSelectCheck .arrow").attr("src", iconDown)
  479. $(".fpCheckList ").css("display", "none")
  480. const showList = $(".qcCheckList ").css("display")
  481. if (showList == "none" || !showList) {
  482. $(".qcCheckList ").css("display", "block")
  483. $(".qcSelectCheck .arrow").attr("src", iconUp)
  484. } else {
  485. $(".qcCheckList ").css("display", "none")
  486. $(".qcSelectCheck .arrow").attr("src", iconDown)
  487. }
  488. })
  489. $('.selectDept').on("click", function (e) {
  490. e.stopPropagation()
  491. $(".modularList ").css("display", "none")
  492. $(".selectModular .arrow").attr("src", iconDown)
  493. $(".checkList ").css("display", "none")
  494. $(".selectCheck .arrow").attr("src", iconDown)
  495. $(".fpCheckList ").css("display", "none")
  496. $(".fpSelectCheck .arrow").attr("src", iconDown)
  497. $(".qcCheckList ").css("display", "none")
  498. $(".qcSelectCheck .arrow").attr("src", iconDown)
  499. const showList = $(".deptList ").css("display")
  500. if (showList == "none" || !showList) {
  501. $(".deptList ").css("display", "block")
  502. $(".selectDept .arrow").attr("src", iconUp)
  503. } else {
  504. $(".deptList ").css("display", "none")
  505. $(".selectDept .arrow").attr("src", iconDown)
  506. }
  507. })
  508. //获取科室列表
  509. getDeptList()
  510. function getDeptList() {
  511. post(api.getDeptListDept, { inputStr: "" }).then(res => {
  512. if (res.data.code == '0') {
  513. const deptList = res.data.data
  514. rendeDeptList(deptList)
  515. } else { }
  516. }).catch((e) => {
  517. })
  518. }
  519. function rendeDeptList(deptList) {
  520. let str = `<li class="deptItem ellipsis" data-id=" " data-name="全部">全部</li>`
  521. for (let i = 0; i < deptList.length; i++) {
  522. str += `<li class="deptItem ellipsis" title=${deptList[i].deptName} data-id=${deptList[i].deptId} data-name=${deptList[i].deptName}> ${deptList[i].deptName}</li>`
  523. }
  524. $('.deptList').html(str)
  525. bindDeptSelect()
  526. }
  527. //科室选择
  528. function bindDeptSelect() {
  529. $('.deptItem').on("click", function () {
  530. const deptItemName = $(this).attr("data-name")
  531. const deptItemId = $(this).attr("data-id")
  532. deptIdTemp = deptItemId
  533. deptName = deptNameTemp = deptItemName
  534. if (deptItemName.length > 10) {
  535. $('.selectDept').html(deptItemName.substring(0, 8) + '...')
  536. } else {
  537. $('.selectDept').html(deptItemName)
  538. }
  539. $('.selectDept ').attr('title', deptItemName)
  540. $(".selectDept").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
  541. $('.selectDept').removeClass('unSelect')
  542. $(".deptList").css("display", "none")
  543. })
  544. }
  545. function renderColSet(list) {
  546. let pageSetList = list || pageSetCopy
  547. let allSelect = true
  548. for (let i = 0; i < pageSetList.length; i++) {
  549. if (pageSetList[i].status != 1) {
  550. allSelect = false
  551. }
  552. }
  553. let str = `<div class='colSetBox'>
  554. <div class='mask'></div>
  555. <div class='cloInfobox'>
  556. <div class='cloInfoTitle'><span class='cloInfoTitleTxt'>列显示设置</span> <img class="iconClose" src=${require('./../images/icon_close_default.png')} alt="关闭" /></div>
  557. <div class='cloInfo'></div>
  558. <div class='btnBox'><span class='defaultColSet'>恢复默认</span> <span class='cancalColSet'>取消</span> <span class='saveColSet'>保存设置</span></div>
  559. </div>
  560. </div>`
  561. let infoStr = `<div class='colTabTitle' ><span class='colOpera toggleSelectColAll' data-select=${allSelect}>${allSelect ? `<img src=${iconCheck} />` : `<img src=${iconUnCheck} />`}全选</span><span class='colName'>列名</span></div><div class='colTabInfoBox' >`
  562. for (let i = 0; i < pageSetList.length; i++) {
  563. infoStr += `<div class='colTabInfo' data-index=${i}>
  564. <span class='colOpera' data-index=${i}>${pageSetList[i].status == 1 ? `<img class="toggleSelectCol" src=${iconCheck} />` : `<img class="toggleSelectCol" src=${iconUnCheck} />`}</span>
  565. <span class='colName'>
  566. <span>${pageSetList[i].name}</span>
  567. <span class="pageOrder">
  568. <span class="pageSetUpBox">${i === 0 ? '' : `<img class="pageSetUp" src=${goUpG} />`}</span>
  569. <span class="pageSetDownBox">${i === pageSetList.length - 1 ? '' : `<img class="pageSetDown" src=${goDownG} />`}</span>
  570. </span>
  571. </span>
  572. </div>`
  573. }
  574. infoStr += "</div>"
  575. // $(".main-body").append(str)
  576. if (!$("#mainBox .colSetBox", parent.document).length) {
  577. $("#mainBox", parent.document).append(str)
  578. }
  579. $("#mainBox .colSetBox .cloInfo", parent.document).html(infoStr)
  580. $(".colTabInfoBox", parent.document).scrollTop(scrollTop)
  581. scrollTop = 0
  582. bindSelectCol()
  583. bindColOrder()
  584. bindSaveColSet()
  585. bindDefaultColset()
  586. bindCloseColSet()
  587. bindImgEnter()
  588. }
  589. function bindDefaultColset() {
  590. $('.defaultColSet', parent.document).off("hover").hover(function () {
  591. $(this).css('color', '#00A1FF')
  592. }, function () {
  593. $(this).css('color', '#777777')
  594. })
  595. $('.defaultColSet', parent.document).off("click").on('click', function () {
  596. return post(api.getDefaultPageSet, { pageType: 1 }).then(res => {
  597. if (res.data.code == '0') {
  598. pageSet = res.data.data
  599. pageSetCopy = JSON.parse(JSON.stringify(pageSet))
  600. renderColSet(pageSetCopy)
  601. } else { }
  602. }).catch((e) => {
  603. })
  604. // closeColSet()
  605. })
  606. }
  607. function bindImgEnter() {
  608. $(".pageSetUpBox img", parent.document).off("mouseenter").on("mouseenter", function () {
  609. $(this).attr('src', goUpB)
  610. })
  611. $(".pageSetDownBox img", parent.document).off("mouseenter").on("mouseenter", function () {
  612. $(this).attr('src', goDownB)
  613. })
  614. $(".pageSetUpBox img", parent.document).off("mouseout").on("mouseout", function () {
  615. $(this).attr('src', goUpG)
  616. })
  617. $(".pageSetDownBox img", parent.document).off("mouseout").on("mouseout", function () {
  618. $(this).attr('src', goDownG)
  619. })
  620. }
  621. function bindSelectCol() {
  622. $(".toggleSelectCol", parent.document).off("click").on("click", function () {
  623. const index = $(this).parent().attr("data-index")
  624. pageSetCopy[index].status = pageSetCopy[index].status == 1 ? 0 : 1
  625. scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
  626. renderColSet(pageSetCopy)
  627. })
  628. $(".toggleSelectColAll", parent.document).off("click").on("click", function () {
  629. const hasSelectAll = $(this).attr("data-select")
  630. for (let i = 0; i < pageSetCopy.length; i++) {
  631. if (hasSelectAll == "true") {
  632. pageSetCopy[i].status = 0
  633. } else {
  634. pageSetCopy[i].status = 1
  635. }
  636. }
  637. scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
  638. renderColSet(pageSetCopy)
  639. })
  640. }
  641. function closeColSet() {
  642. pageSetCopy = JSON.parse(JSON.stringify(pageSet))
  643. $("#mainBox .colSetBox", parent.document).remove()
  644. }
  645. function bindCloseColSet() {
  646. $(".colSetBox .iconClose", parent.document).off("click").on("click", function () {
  647. closeColSet()
  648. })
  649. $(".colSetBox .cancalColSet", parent.document).off("click").on("click", function () {
  650. closeColSet()
  651. })
  652. }
  653. function bindSaveColSet() {
  654. $(".saveColSet", parent.document).off("click").on("click", function () {
  655. let showNumSet = 0
  656. let sysUserPagesetVOList = []
  657. for (let i = 0; i < pageSetCopy.length; i++) {
  658. const item = pageSetCopy[i]
  659. sysUserPagesetVOList.push({
  660. name: item.name,
  661. orderNo: i,
  662. status: item.status,
  663. val: item.val
  664. })
  665. if (item.status == 1) {
  666. showNumSet++
  667. }
  668. }
  669. if (showNumSet === 0) {
  670. $.alerModal({ "message": '最少显示一列', type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
  671. return
  672. }
  673. return post(api.saveQcListPageSet, { pageType: 1, sysUserPagesetVOList: sysUserPagesetVOList }).then(res => {
  674. if (res.data.code == '0') {
  675. closeColSet()
  676. } else {
  677. $("#mainBox .colSetBox", parent.document).remove()
  678. $.alerModal({ "message": '保存失败,请重试~', type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
  679. }
  680. }).catch((e) => {
  681. $("#mainBox .colSetBox", parent.document).remove()
  682. $.alerModal({ "message": '保存失败,请重试~', type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
  683. })
  684. })
  685. }
  686. function bindColOrder() {
  687. $(".pageSetUp", parent.document).off("click").on("click", function () {
  688. const index = parseInt($(this).parent().parent().parent().parent().attr("data-index"))
  689. if (index != 0) {
  690. const upItem = pageSetCopy[index]
  691. const upItemPre = pageSetCopy[index - 1]
  692. pageSetCopy.splice(index - 1, 2, upItem, upItemPre)
  693. scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
  694. renderColSet(pageSetCopy)
  695. } else {
  696. return
  697. }
  698. })
  699. $(".pageSetDown", parent.document).off("click").on("click", function () {
  700. const index = parseInt($(this).parent().parent().parent().parent().attr("data-index"))
  701. if (index == pageSetCopy.length - 1) {
  702. return
  703. } else {
  704. const downItem = pageSetCopy[index]
  705. const downItemBack = pageSetCopy[index + 1]
  706. pageSetCopy.splice(index, 2, downItemBack, downItem)
  707. scrollTop = $(".colTabInfoBox", parent.document).scrollTop()
  708. renderColSet(pageSetCopy)
  709. }
  710. })
  711. }
  712. $(".fpCheckPeople").on("input", function (e) {
  713. const val = $(this).val().trim()
  714. fpCheckNameTemp = val
  715. })
  716. $(".qcCheckPeople").on("input", function (e) {
  717. const val = $(this).val().trim()
  718. qcCheckNameTemp = val
  719. })
  720. $(".qcCheckMain").on("input", function (e) {
  721. const val = $(this).val().trim()
  722. qcCheckMain = qcCheckMainTemp = val
  723. })
  724. $(function () {
  725. $.datepicker.regional['zh-CN'] = {
  726. clearText: '清除',
  727. clearStatus: '清除已选e799bee5baa6e59b9ee7ad9431333361303131日期',
  728. closeText: '关闭',
  729. closeStatus: '不改变当前选择',
  730. prevText: '<上月',
  731. prevStatus: '显示上月',
  732. prevBigText: '<<',
  733. prevBigStatus: '显示上一年',
  734. nextText: '下月>',
  735. nextStatus: '显示下月',
  736. nextBigText: '>>',
  737. nextBigStatus: '显示下一年',
  738. currentText: '今天',
  739. currentStatus: '显示本月',
  740. monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  741. monthNamesShort: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  742. yearNamesShort: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
  743. monthStatus: '选择月份',
  744. yearStatus: '选择年份',
  745. weekHeader: '周',
  746. weekStatus: '年内周次',
  747. dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  748. dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
  749. dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
  750. dayStatus: '设置 DD 为一周起始',
  751. dateStatus: '选择 m月 d日, DD',
  752. dateFormat: 'yy-mm-dd',
  753. firstDay: 1,
  754. initStatus: '请选择日期',
  755. isRTL: false
  756. };
  757. $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
  758. let startDate = "", endDate = new Date()
  759. let year = new Date().getFullYear()
  760. let month = new Date().getMonth() + 1
  761. if (statisticsType == '1') {
  762. startDate = new Date(`${year}-${month}-01`)
  763. } else if (statisticsType == '2') {
  764. startDate = new Date(`${year}-01-01`)
  765. } else if (statisticsType == '3') {
  766. startDate = new Date(startDateParam)
  767. endDate = new Date(endDateParam)
  768. } else {
  769. startDate = "-6d"
  770. }
  771. $("#datepicker").datepicker({
  772. changeMonth: true,
  773. changeYear: true,
  774. dateFormat: "yy/mm/dd",
  775. }).datepicker("setDate", startDate);
  776. $("#datepicker2").datepicker({
  777. changeMonth: true,
  778. changeYear: true,
  779. dateFormat: "yy/mm/dd"
  780. }).datepicker("setDate", endDate);
  781. $("#datepickerFp1").datepicker({
  782. changeMonth: true,
  783. changeYear: true,
  784. dateFormat: "yy/mm/dd"
  785. }).datepicker("setDate", "");
  786. $("#datepickerFp2").datepicker({
  787. changeMonth: true,
  788. changeYear: true,
  789. dateFormat: "yy/mm/dd"
  790. }).datepicker("setDate", "");
  791. $("#datepickerQc1").datepicker({
  792. changeMonth: true,
  793. changeYear: true,
  794. dateFormat: "yy/mm/dd"
  795. }).datepicker("setDate", "");
  796. $("#datepickerQc2").datepicker({
  797. changeMonth: true,
  798. changeYear: true,
  799. dateFormat: "yy/mm/dd"
  800. }).datepicker("setDate", "");
  801. getTabData(1)
  802. });
  803. //分页渲染
  804. function renderPagination(totalPage, activePage, totalNum) {
  805. let str = `<span class="totalSum">共${totalPage}页/${totalNum}条数据</span><span class="prePage"><img class="arrowPage" src=${arrowLeft} /></span>`
  806. if (totalPage <= 6) {
  807. for (let i = 1; i <= totalPage; i++) {
  808. str += `<span class="pageNum ${'page' + i}" data-page=${i}>${i}</span>`
  809. }
  810. } else {
  811. if (activePage <= 3) { //选中页数小于4
  812. for (let i = 1; i <= 4; i++) {
  813. str += `<span class="pageNum ${'page' + i}" data-page=${i}>${i}</span>`
  814. }
  815. str += `<span class="more" >...</span>`
  816. str += `<span class="pageNum ${'page' + totalPage}" data-page=${totalPage}>${totalPage}</span>`
  817. } else if (activePage > totalPage - 3) {
  818. str += `<span class="pageNum page1" data-page=1>1</span>`
  819. str += `<span class="more" >...</span>`
  820. str += `<span class="pageNum ${'page' + (totalPage - 3)}" data-page=${totalPage - 3}>${totalPage - 3}</span>`
  821. str += `<span class="pageNum ${'page' + (totalPage - 2)}" data-page=${totalPage - 2}>${totalPage - 2}</span>`
  822. str += `<span class="pageNum ${'page' + (totalPage - 1)}" data-page=${totalPage - 1}>${totalPage - 1}</span>`
  823. str += `<span class="pageNum ${'page' + totalPage}" data-page=${totalPage}>${totalPage}</span>`
  824. } else {
  825. str += `<span class="pageNum page1" data-page=1>1</span>`
  826. str += `<span class="more" >...</span>`
  827. str += `<span class="pageNum ${'page' + (activePage - 1)}" data-page=${activePage - 1}>${activePage - 1}</span>`
  828. str += `<span class="pageNum ${'page' + activePage}" data-page=${activePage}>${activePage}</span>`
  829. str += `<span class="pageNum ${'page' + (activePage + 1)}" data-page=${activePage + 1}>${activePage + 1}</span>`
  830. str += `<span class="more" >...</span>`
  831. str += `<span class="pageNum ${'page' + totalPage}" data-page=${totalPage}>${totalPage}</span>`
  832. }
  833. }
  834. str += `<span class="nextPage"><img class="arrowPage" src=${arrowRight} /></span>`
  835. $('.pagination').html(str)
  836. $('.page' + activePage).addClass('activePage')
  837. $(".pageNum").on("click", function (e) {
  838. const activePageNow = Number($(this).attr('data-page'))
  839. getTabData(activePageNow)
  840. // renderPagination(totalPage,activePageNow,totalNum)
  841. })
  842. $(".prePage").on("click", function (e) {
  843. let activePageNow = Number($(".activePage").attr('data-page'))
  844. if (activePageNow > 1) {
  845. activePageNow--
  846. getTabData(activePageNow)
  847. // renderPagination(totalPage,activePageNow,totalNum)
  848. }
  849. })
  850. $(".nextPage").on("click", function (e) {
  851. let activePageNow = Number($(".activePage").attr('data-page'))
  852. if (activePageNow < totalPage) {
  853. activePageNow++
  854. getTabData(activePageNow)
  855. // renderPagination(totalPage,activePageNow,totalNum)
  856. }
  857. })
  858. }
  859. $(document).on("click", function () {
  860. $(".modularList ").css("display", "none")
  861. $(".deptList").css("display", "none")
  862. $(".checkList").css("display", "none")
  863. $(".fpCheckList").css("display", "none")
  864. $(".qcCheckList").css("display", "none")
  865. $(".selectDept .arrow").attr("src", iconDown)
  866. $(".selectModular .arrow").attr("src", iconDown)
  867. $(".selectCheck .arrow").attr("src", iconDown)
  868. $(".fpSelectCheck .arrow").attr("src", iconDown)
  869. $(".qcSelectCheck .arrow").attr("src", iconDown)
  870. $("#delModal ul").css("display", "none")
  871. })
  872. let radioCheck = 1;
  873. $((function ($) {
  874. $('.export').click(function () {
  875. const behosDateStartTime = new Date(behosDateStart).getTime()
  876. const behosDateEndTime = new Date(behosDateEnd).getTime()
  877. if (behosDateStartTime > behosDateEndTime) {
  878. $.alerModal({ "message": '开始时间不能大于结束时间~', type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
  879. return
  880. }
  881. const param = {
  882. deptId: deptId.trim(),
  883. deptName: deptName == "全部" ? "" : deptName || '',
  884. casesName: moduleName,
  885. operationType: operationType,
  886. state: state,
  887. size: 15,
  888. name: $('.patientNameInp').val(),
  889. complaintDateEnd: behosDateEnd.replaceAll("/", "-"),
  890. complaintDateStart: behosDateStart.replaceAll("/", "-"),
  891. }
  892. expJson(api.getComplaintRecordExport, param).then(res => {
  893. downloadExportedData(res.data, "申诉记录.xls")
  894. })
  895. })
  896. })($));