appealHistory.js 37 KB

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