health_control.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. layui.use('element', function () {
  2. // var $ = layui.jquery
  3. element = layui.element//Tab的切换功能,切换事件监听等,需要依赖element模块
  4. function Progress(dom, num) {
  5. window.setTimeout(function () {
  6. element.progress(dom, num)
  7. }, 360)
  8. }
  9. function showInfoMessage(msg) {
  10. layer.msg(msg, {
  11. icon: 6
  12. })
  13. }
  14. function showErrorMessage(msg) {
  15. layer.msg(msg, {
  16. icon: 5
  17. })
  18. }
  19. function conFirm(msg, num, isStop, planid, getDat) {
  20. layer.confirm('您确定要执行该操作吗?', { btn: ['确定', '取消'], title: "提示" }, function (index) {
  21. if (num == 2) {
  22. showInfoMessage("计划已完成")
  23. $("#stopBtn_" + planid).attr('disabled', true).addClass("falsebutton")
  24. } else {
  25. isStop = num == 0 ? 1 : 0
  26. }
  27. if (isStop == 0) {
  28. $("#progress_" + planid).css({
  29. "background-color": "gray"
  30. })
  31. $("#stopBtn_" + planid).html("激活计划")
  32. $("#stopBtn_" + planid).css({
  33. "background-color": "#2dbe55"
  34. })
  35. } else {
  36. $("#progress_" + planid).css({
  37. "background-color": "#ff9526"
  38. })
  39. $("#stopBtn_" + planid).html("中止计划")
  40. $("#stopBtn_" + planid).css({
  41. "background-color": "#ff3b30"
  42. })
  43. }
  44. console.log(isStop)
  45. var params = {
  46. status: isStop,
  47. planId: planid
  48. }
  49. healthAPI.updatePlanStatusById(params).then(function (res) {
  50. if (res.status == 200) {
  51. getDat()
  52. }
  53. })
  54. layer.close(index);
  55. });
  56. }
  57. new Vue({
  58. el: '#app',
  59. data: {
  60. code: "",
  61. modal: "",
  62. type: "",
  63. status: "",
  64. plan: "",
  65. name: "",
  66. isDanger: "0",
  67. pagesize: 10,
  68. total: "",
  69. pagetotal: '', //总页数
  70. currentPage: 1, //当前页数
  71. tablelist: [],
  72. diseaselist: [],
  73. types: [],
  74. Statics: {},
  75. wujilu: false,
  76. datamodelshow: true,
  77. plantype: 1,
  78. todaylog: 1,
  79. isTotayTodo: 1,
  80. progress: "",
  81. allFinishCount: "",
  82. allCount: "",
  83. planid: "",
  84. isStop: 1, //
  85. isActive: true,
  86. doctorType: "",
  87. docCode: "",
  88. docInfo: [],
  89. isLeader: 0,
  90. planCreateUser: ""
  91. },
  92. watch: {
  93. tablelist: function (val) {
  94. var vm = this
  95. this.$nextTick(function () {
  96. element.init()
  97. for (var i = 0; i < val.length; i++) {
  98. var allFinishCount = val[i].allFinishCount
  99. var allCount = val[i].allCount
  100. var isStop = val[i].status
  101. var ishospitalName = val[i].hospitalName
  102. vm.planCreateUser = val[i].planCreateUser
  103. if (ishospitalName == null) {
  104. $("#hospitalName_" + val[i].id).html("暂无社区信息")
  105. }
  106. if (allCount == 0) {
  107. Progress(val[i].id, 0 + "%")
  108. } else {
  109. var progressNum = Math.ceil((allFinishCount / allCount) * 100)
  110. Progress(val[i].id, progressNum + "%")
  111. }
  112. if (isStop == 0) {
  113. $("#progress_" + val[i].id).css({
  114. "background-color": "gray"
  115. })
  116. $("#stopBtn_" + val[i].id).html("激活计划")
  117. $("#stopBtn_" + val[i].id).css({
  118. "background-color": "#2dbe55"
  119. })
  120. } else {
  121. $("#progress_" + val[i].id).css({
  122. "background-color": "#ff9526"
  123. })
  124. $("#stopBtn_" + val[i].id).html("中止计划")
  125. $("#stopBtn_" + val[i].id).css({
  126. "background-color": "#ff3b30"
  127. })
  128. }
  129. }
  130. var lastColor = 'red';
  131. for (var i = 0; i < val.length; i++) {
  132. if (i == 0) {
  133. $($(".quote")[i]).css("background-color", "#12b7f5")
  134. continue
  135. }
  136. if (val[i].patientName == val[i - 1].patientName) {
  137. $($(".quote")[i]).css("background-color", "#02cfb9")
  138. if (lastColor === 'red') {
  139. $($(".quote")[i]).css("background-color", "#12b7f5")
  140. }
  141. } else {
  142. if (lastColor !== 'red') {
  143. $($(".quote")[i]).css("background-color", "#12b7f5")
  144. lastColor = 'red'
  145. } else {
  146. lastColor = 'white'
  147. $($(".quote")[i]).css("background-color", "#02cfb9")
  148. }
  149. }
  150. }
  151. })
  152. },
  153. },
  154. mounted() {
  155. var vm = this
  156. // vm.getModal()
  157. vm.getDatas()
  158. vm.gettypes()
  159. },
  160. methods: {
  161. setImgSrc: function (src) {
  162. var str = httpRequest.getImgUrl(src)
  163. return str
  164. },
  165. getDatas: function () {
  166. var vm = this
  167. var params = {
  168. patientCondition: vm.name,// 居民条件,可以按身份证或者居民名称模糊匹配
  169. diseaseCode: vm.type, //疾病类型
  170. planType: vm.status, //安排类型(1康复计划,2转社区医院,3转家庭病床)
  171. todaybacklog: vm.isTotayTodo, // 今日待办(1、今日待办,2、全部)
  172. page: vm.currentPage,
  173. pageSize: vm.pagesize,
  174. isDanger: vm.isDanger,
  175. }
  176. healthAPI.getSpecialList(params).then(function (res) {
  177. console.log(res)
  178. if (res.status == 200) {
  179. vm.wujilu = false
  180. vm.total = res.data.totalCount
  181. vm.pagetotal = Math.ceil(res.data.totalCount / vm.pagesize)
  182. vm.tablelist = _.sortBy(res.data.detailModelList, "patientName")
  183. if (vm.tablelist.length == 0) {
  184. vm.wujilu = true
  185. }
  186. vm.docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
  187. vm.doctorType = vm.docInfo.doctorType
  188. if (vm.doctorType != 1) {
  189. $(".neironglef>button:nth-child(1)").attr('disabled', "true")
  190. $(".neironglef>button:nth-child(1)").addClass("falsebutton")
  191. $(".neironglef>button:nth-child(1)").css("color", "white")
  192. }
  193. healthAPI.doctorBaseinfo().then(function (res) {
  194. vm.isLeader = res.data.isLeader
  195. for (var i = 0; i < vm.tablelist.length; i++) {
  196. if (vm.isLeader == 0) {
  197. $("#stopBtn_" + vm.tablelist[i].id).attr('disabled', "true")
  198. $("#stopBtn_" + vm.tablelist[i].id).addClass("falsebutton")
  199. $(".neironglef>button:nth-child(2)").attr('disabled', "true")
  200. $(".neironglef>button:nth-child(2)").addClass("falsebutton")
  201. $(".neironglef>button:nth-child(2)").css("color", "white")
  202. }
  203. }
  204. })
  205. } else {
  206. showErrorMessage(res.msg);
  207. }
  208. })
  209. },
  210. gettypes: function () {
  211. var vm = this
  212. var search = true
  213. $("#Status").bsSuggest({
  214. data: {
  215. value: [{
  216. code: "",
  217. name: "全部"
  218. },
  219. {
  220. code: "1",
  221. name: "康复计划"
  222. },
  223. {
  224. code: "2",
  225. name: "(转)社区医院"
  226. },
  227. {
  228. code: "3",
  229. name: "(转)家庭病床"
  230. }
  231. ]
  232. },
  233. getDataMethod: "data",
  234. effectiveFields: ["name"],
  235. idField: "code",
  236. keyField: "name"
  237. });
  238. healthAPI.getSpecialDisease().then(function (res) {
  239. if (res.status == 200) {
  240. console.log(res)
  241. var data = {}
  242. data.value = _.map(res.data, function (v) {
  243. return {
  244. code: v.code,
  245. name: v.name
  246. }
  247. })
  248. if (search) {
  249. data.value = [{
  250. code: "",
  251. name: "全部"
  252. }].concat(data.value)
  253. }
  254. $("#Type").bsSuggest({
  255. data: data,
  256. getDataMethod: "data",
  257. effectiveFields: ["name"],
  258. idField: "code",
  259. keyField: "name"
  260. });
  261. vm.types = res.data;
  262. } else {
  263. showErrorMessage(res.msg);
  264. }
  265. })
  266. },
  267. search: function (page) {
  268. var vm = this
  269. vm.type = $("#Type").attr("data-id");
  270. vm.status = $("#Status").attr("data-id");
  271. vm.currentPage = page
  272. vm.getDatas()
  273. },
  274. daiban: function (page) {
  275. var vm = this
  276. vm.isTotayTodo = $("#c").prop("checked") ? 2 : 1
  277. $(".icon-chkbox").toggleClass("icon-bgchkbox");
  278. vm.currentPage = page
  279. console.log(vm.currentPage)
  280. vm.getDatas()
  281. },
  282. morePlan: function (data) {
  283. location.href = "moreplan.html?patientCode=" + data.patientCode
  284. },
  285. stop: function (data) {
  286. var vm = this
  287. vm.planid = data.id
  288. conFirm("确定终止该计划吗", data.status, vm.isStop, vm.planid, vm.getDatas)
  289. },
  290. newRecover: function () {
  291. location.href = "../../recover/html/new_recover.html"
  292. },
  293. checkPlan: function (data) {
  294. var vm = this
  295. location.href = "../../rehabilitation/html/rehabilitation_management.html?planId=" + data.id
  296. },
  297. modelControl: function () {
  298. location.href = "../../rehabilitation/html/management.html"
  299. }
  300. }
  301. })
  302. });