health_control.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. layui.use('element', function () {
  2. element = layui.element //Tab的切换功能,切换事件监听等,需要依赖element模块
  3. function Progress(dom, num) {
  4. window.setTimeout(function () {
  5. element.progress(dom, num)
  6. }, 360)
  7. }
  8. function showInfoMessage(msg) {
  9. layer.msg(msg, {
  10. icon: 6
  11. })
  12. }
  13. function showErrorMessage(msg) {
  14. layer.msg(msg, {
  15. icon: 5
  16. })
  17. }
  18. function conFirm(msg, num, isStop, planid, getDat) {
  19. if (num == 1) {
  20. layer.confirm(
  21. '<p class="c-333 mb10">请说明中止计划的原因?</p><textarea class="plr5 ptb5 w-100 h200 c-333 set-textarea" maxlength="300" placeholder="请简要描述一下原因,不多于300字"></textarea>',
  22. {
  23. btn: ['确定', '取消'],
  24. area: ['400px', 'auto'],
  25. title: '提示'
  26. },
  27. function (index) {
  28. var reason = $('.set-textarea').val()
  29. if (!reason) {
  30. showErrorMessage('请填写中止计划原因!')
  31. return false
  32. }
  33. if (num == 2) {
  34. showInfoMessage('计划已完成')
  35. $('#stopBtn_' + planid)
  36. .attr('disabled', true)
  37. .addClass('falsebutton')
  38. return false
  39. } else {
  40. isStop = num == 0 ? 1 : 0
  41. }
  42. if (isStop == 0) {
  43. $('#progress_' + planid).css({
  44. 'background-color': 'gray'
  45. })
  46. $('#stopBtn_' + planid).html('激活计划')
  47. $('#stopBtn_' + planid).css({
  48. 'background-color': '#2dbe55'
  49. })
  50. } else {
  51. $('#progress_' + planid).css({
  52. 'background-color': '#ff9526'
  53. })
  54. $('#stopBtn_' + planid).html('中止计划')
  55. $('#stopBtn_' + planid).css({
  56. 'background-color': '#ff3b30'
  57. })
  58. }
  59. var params = {
  60. status: isStop,
  61. planId: planid,
  62. abortReason: reason
  63. }
  64. healthAPI.updatePlanStatusById(params).then(function (res) {
  65. if (res.status == 200) {
  66. getDat()
  67. }
  68. })
  69. layer.close(index)
  70. }
  71. )
  72. } else {
  73. layer.confirm('您确定要执行该操作吗?', { btn: ['确定', '取消'], title: '提示' }, function (index) {
  74. if (num == 2) {
  75. showInfoMessage('计划已完成')
  76. $('#stopBtn_' + planid)
  77. .attr('disabled', true)
  78. .addClass('falsebutton')
  79. return false
  80. } else {
  81. isStop = num == 0 ? 1 : 0
  82. }
  83. if (isStop == 0) {
  84. $('#progress_' + planid).css({
  85. 'background-color': 'gray'
  86. })
  87. $('#stopBtn_' + planid).html('激活计划')
  88. $('#stopBtn_' + planid).css({
  89. 'background-color': '#2dbe55'
  90. })
  91. } else {
  92. $('#progress_' + planid).css({
  93. 'background-color': '#ff9526'
  94. })
  95. $('#stopBtn_' + planid).html('中止计划')
  96. $('#stopBtn_' + planid).css({
  97. 'background-color': '#ff3b30'
  98. })
  99. }
  100. var params = {
  101. status: isStop,
  102. planId: planid
  103. }
  104. healthAPI.updatePlanStatusById(params).then(function (res) {
  105. if (res.status == 200) {
  106. getDat()
  107. }
  108. })
  109. layer.close(index)
  110. })
  111. }
  112. }
  113. new Vue({
  114. el: '#app',
  115. data: {
  116. code: '',
  117. modal: '',
  118. type: '',
  119. status: '',
  120. plan: '',
  121. name: '',
  122. isDanger: '0',
  123. pagesize: 10,
  124. total: '',
  125. pagetotal: '', //总页数
  126. currentPage: 1, //当前页数
  127. tablelist: [],
  128. diseaselist: [],
  129. types: [],
  130. Statics: {},
  131. wujilu: false,
  132. datamodelshow: true,
  133. plantype: 1,
  134. todaylog: 1,
  135. isTotayTodo: 1,
  136. progress: '',
  137. allFinishCount: '',
  138. allCount: '',
  139. planid: '',
  140. isStop: 1, //
  141. isActive: true,
  142. doctorType: '',
  143. docCode: '',
  144. docInfo: {},
  145. isLeader: 0,
  146. planCreateUser: '',
  147. doctorTeamList: [],
  148. healthyConditionType: 0
  149. },
  150. watch: {
  151. tablelist: function (val) {
  152. var vm = this
  153. this.$nextTick(function () {
  154. element.init()
  155. for (var i = 0; i < val.length; i++) {
  156. var allFinishCount = val[i].allFinishCount
  157. var allCount = val[i].allCount
  158. var isStop = val[i].status
  159. var ishospitalName = val[i].hospitalName
  160. vm.planCreateUser = val[i].planCreateUser
  161. vm.healthyConditionType = val[i].healthyConditionType //1住院 2康复期 3日常健康 4健康筛查
  162. if (vm.healthyConditionType == 1) {
  163. $('#quote_' + val[i].id).css('backgroundColor', '#FF3B30')
  164. }
  165. if (vm.healthyConditionType == 2) {
  166. $('#quote_' + val[i].id).css('backgroundColor', '#FF9526')
  167. }
  168. if (vm.healthyConditionType == 3) {
  169. $('#quote_' + val[i].id).css('backgroundColor', '#2DBE55')
  170. }
  171. if (vm.healthyConditionType == 4) {
  172. $('#quote_' + val[i].id).css('backgroundColor', '#02CFB9')
  173. }
  174. if (ishospitalName == null) {
  175. $('#hospitalName_' + val[i].id).html('暂无社区信息')
  176. }
  177. if (allCount == 0) {
  178. Progress(val[i].id, 0 + '%')
  179. } else {
  180. var progressNum = Math.ceil((allFinishCount / allCount) * 100)
  181. Progress(val[i].id, progressNum + '%')
  182. }
  183. if (isStop == 0) {
  184. $('#progress_' + val[i].id).css({
  185. 'background-color': 'gray'
  186. })
  187. $('#stopBtn_' + val[i].id).html('激活计划')
  188. $('#stopBtn_' + val[i].id).css({
  189. 'background-color': '#2dbe55'
  190. })
  191. } else {
  192. $('#progress_' + val[i].id).css({
  193. 'background-color': '#ff9526'
  194. })
  195. $('#stopBtn_' + val[i].id).html('中止计划')
  196. if (val[i].status == 2) {
  197. $('#stopBtn_' + val[i].id).css({
  198. 'background-color': 'gray'
  199. })
  200. } else {
  201. $('#stopBtn_' + val[i].id).css({
  202. 'background-color': '#ff3b30'
  203. })
  204. }
  205. }
  206. }
  207. var lastColor = 'red'
  208. for (var i = 0; i < val.length; i++) {
  209. if (i == 0) {
  210. $($('.quote')[i]).css('background-color', '#12b7f5')
  211. continue
  212. }
  213. if (val[i].patientName == val[i - 1].patientName) {
  214. $($('.quote')[i]).css('background-color', '#02cfb9')
  215. if (lastColor === 'red') {
  216. $($('.quote')[i]).css('background-color', '#12b7f5')
  217. }
  218. } else {
  219. if (lastColor !== 'red') {
  220. $($('.quote')[i]).css('background-color', '#12b7f5')
  221. lastColor = 'red'
  222. } else {
  223. lastColor = 'white'
  224. $($('.quote')[i]).css('background-color', '#02cfb9')
  225. }
  226. }
  227. }
  228. })
  229. }
  230. },
  231. mounted: function () {
  232. var vm = this
  233. vm.getDatas()
  234. vm.gettypes()
  235. vm.getDoctorTeam()
  236. },
  237. methods: {
  238. setImgSrc: function (src) {
  239. var str = httpRequest.getImgUrl(src)
  240. return str
  241. },
  242. getDoctorTeam: function () {
  243. var vm = this
  244. var wlyyAgentForDoc = JSON.parse(window.localStorage.getItem('wlyyAgentForDoc'))
  245. var uid = wlyyAgentForDoc && wlyyAgentForDoc.uid
  246. healthAPI.getDoctorTeam(uid).then(function (res) {
  247. if (res.status == 200) {
  248. vm.doctorTeamList = res.data
  249. }
  250. })
  251. },
  252. getDatas: function () {
  253. var vm = this
  254. var params = {
  255. patientCondition: vm.name, // 居民条件,可以按身份证或者居民名称模糊匹配
  256. diseaseCode: vm.type, //疾病类型
  257. planType: vm.status, //安排类型(1康复计划,2转社区医院,3转家庭病床)
  258. todaybacklog: vm.isTotayTodo, // 今日待办(1、今日待办,2、全部)
  259. page: vm.currentPage,
  260. pageSize: vm.pagesize,
  261. isDanger: vm.isDanger
  262. }
  263. healthAPI.getSpecialList(params).then(function (res) {
  264. if (res.status == 200) {
  265. vm.wujilu = false
  266. vm.total = res.data.totalCount
  267. vm.pagetotal = Math.ceil(res.data.totalCount / vm.pagesize)
  268. vm.tablelist = _.sortBy(res.data.detailModelList, 'patientName')
  269. if (vm.tablelist.length == 0) {
  270. vm.wujilu = true
  271. }
  272. vm.docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
  273. vm.doctorType = vm.docInfo.doctorType
  274. if (vm.doctorType != 1) {
  275. $('.neironglef>button:nth-child(1)').attr('disabled', 'true')
  276. $('.neironglef>button:nth-child(1)').addClass('falsebutton')
  277. $('.neironglef>button:nth-child(1)').css('color', 'white')
  278. }
  279. healthAPI.doctorBaseinfo().then(function (res) {
  280. window.localStorage.setItem("docInfo", JSON.stringify(res.data))
  281. vm.isLeader = res.data.isLeader //0非团队长 1团队长
  282. vm.level = res.data.level //1专科医生,2全科医生,3健康管理师
  283. vm.planCreateUser //创建者跟登录者相等可中止操作
  284. vm.docCode = res.data.code
  285. for (var i = 0; i < vm.tablelist.length; i++) {
  286. if (vm.docCode != vm.planCreateUser) {
  287. $('#stopBtn_' + vm.tablelist[i].id).attr('disabled', 'true')
  288. $('#stopBtn_' + vm.tablelist[i].id).addClass('falsebutton')
  289. }
  290. }
  291. // if (vm.isLeader == 0||vm.level != 1) {
  292. // $(".neironglef>button:nth-child(2)").attr('disabled', "true")
  293. // $(".neironglef>button:nth-child(2)").addClass("falsebutton")
  294. // $(".neironglef>button:nth-child(2)").css("color", "white")
  295. // }
  296. })
  297. } else {
  298. showErrorMessage(res.msg)
  299. }
  300. })
  301. },
  302. gettypes: function () {
  303. var vm = this
  304. var search = true
  305. $('#Status').bsSuggest({
  306. data: {
  307. value: [
  308. {
  309. code: '',
  310. name: '全部'
  311. },
  312. {
  313. code: '1',
  314. name: '康复计划'
  315. },
  316. {
  317. code: '2',
  318. name: '(转)社区医院'
  319. },
  320. {
  321. code: '3',
  322. name: '(转)家庭病床'
  323. }
  324. ]
  325. },
  326. getDataMethod: 'data',
  327. effectiveFields: ['name'],
  328. idField: 'code',
  329. keyField: 'name'
  330. })
  331. healthAPI.getSpecialDisease().then(function (res) {
  332. if (res.status == 200) {
  333. var data = {}
  334. data.value = _.map(res.data, function (v) {
  335. return {
  336. code: v.code,
  337. name: v.name
  338. }
  339. })
  340. if (search) {
  341. data.value = [
  342. {
  343. code: '',
  344. name: '全部'
  345. }
  346. ].concat(data.value)
  347. }
  348. $('#Type').bsSuggest({
  349. data: data,
  350. getDataMethod: 'data',
  351. effectiveFields: ['name'],
  352. idField: 'code',
  353. keyField: 'name'
  354. })
  355. vm.types = res.data
  356. } else {
  357. showErrorMessage(res.msg)
  358. }
  359. })
  360. },
  361. search: function (page) {
  362. var vm = this
  363. vm.type = $('#Type').attr('data-id')
  364. vm.status = $('#Status').attr('data-id')
  365. vm.currentPage = page
  366. vm.getDatas()
  367. },
  368. daiban: function (page) {
  369. var vm = this
  370. vm.isTotayTodo = $('#c').prop('checked') ? 1 : 2
  371. $('.icon-chkbox').toggleClass('icon-bgchkbox')
  372. vm.currentPage = page
  373. vm.getDatas()
  374. },
  375. morePlan: function (data) {
  376. location.href = 'moreplan.html?patientCode=' + data.patientCode
  377. },
  378. stop: function (data) {
  379. var vm = this
  380. vm.planid = data.id
  381. conFirm('确定终止该计划吗', data.status, vm.isStop, vm.planid, vm.getDatas)
  382. },
  383. newRecover: function () {
  384. location.href = '../../recover/html/new_recover.html'
  385. },
  386. checkPlan: function (data) {
  387. var vm = this
  388. if (this.doctorType == 1 || data.turnDownState == 2) {
  389. location.href = '../../rehabilitation/html/rehabilitation_management.html?planId=' + data.id + '&patientCode=' + data.patientCode
  390. } else {
  391. this.$confirm('是否确认管理', '提示', {
  392. confirmButtonText: '确定',
  393. cancelButtonText: '取消',
  394. type: 'warning'
  395. })
  396. .then(function () {
  397. httpRequest.post('doctor/specialist/rehabilitation/manageAllPlanByPatient', { data: { patient: data.patientCode } }).then(function (res) {
  398. if (res.status == 200) {
  399. location.href = '../../rehabilitation/html/rehabilitation_management.html?planId=' + data.id + '&patientCode=' + data.patientCode
  400. }
  401. })
  402. })
  403. .catch(function () {})
  404. }
  405. },
  406. modelControl: function () {
  407. location.href = '../../rehabilitation/html/management.html'
  408. },
  409. checkPatient: function (data) {
  410. var vm = this
  411. layer.open({
  412. type: 2,
  413. area: ['750px', '650px'],
  414. shade: 0.5,
  415. title: '居民信息',
  416. fixed: true, //不固定
  417. maxmin: true,
  418. closeBtn: 1,
  419. shift: 5,
  420. shadeClose: false, //点击遮罩关闭层
  421. content: '../../temporary/html/userInfo.html?patient=' + data.patientCode
  422. })
  423. // location.href = "" +
  424. },
  425. recoveryPlan: function (data) {
  426. location.href = '../../recover/html/personal-manage.html?patientCode=' + data.patientCode + '&planId=' + data.id
  427. },
  428. getTurnDownName(turnDown) {
  429. var obj = {
  430. 1: '已下转',
  431. 2: '已接收',
  432. 3: '未下转'
  433. }
  434. return obj[turnDown]
  435. }
  436. }
  437. })
  438. })