health_control.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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. docInfo: [],
  88. isLeader: 0,
  89. planCreateUser: ""
  90. },
  91. watch: {
  92. tablelist: function (val) {
  93. var vm = this
  94. this.$nextTick(function () {
  95. element.init()
  96. for (var i = 0; i < val.length; i++) {
  97. var allFinishCount = val[i].allFinishCount
  98. var allCount = val[i].allCount
  99. var isStop = val[i].status
  100. var ishospitalName = val[i].hospitalName
  101. vm.planCreateUser = val[i].planCreateUser
  102. if (vm.planCreateUser[i]!== vm.docInfo.code) {
  103. $("#stopBtn_" + val[i].id).attr('disabled', "true")
  104. $("#stopBtn_" + val[i].id).addClass("falsebutton")
  105. }
  106. if (ishospitalName == null) {
  107. $("#hospitalName_" + val[i].id).html("暂无社区信息")
  108. }
  109. if (allCount == 0) {
  110. Progress(val[i].id, 0 + "%")
  111. } else {
  112. var progressNum = Math.ceil((allFinishCount / allCount) * 100)
  113. Progress(val[i].id, progressNum + "%")
  114. }
  115. if (isStop == 0) {
  116. $("#progress_" + val[i].id).css({
  117. "background-color": "gray"
  118. })
  119. $("#stopBtn_" + val[i].id).html("激活计划")
  120. $("#stopBtn_" + val[i].id).css({
  121. "background-color": "#2dbe55"
  122. })
  123. } else {
  124. $("#progress_" + val[i].id).css({
  125. "background-color": "#ff9526"
  126. })
  127. $("#stopBtn_" + val[i].id).html("中止计划")
  128. $("#stopBtn_" + val[i].id).css({
  129. "background-color": "#ff3b30"
  130. })
  131. }
  132. }
  133. var lastColor = 'red';
  134. for (var i = 0; i < val.length; i++) {
  135. if (i == 0) {
  136. $($(".quote")[i]).css("background-color", "#12b7f5")
  137. continue
  138. }
  139. if (val[i].patientName == val[i - 1].patientName) {
  140. $($(".quote")[i]).css("background-color", "#02cfb9")
  141. if (lastColor === 'red') {
  142. $($(".quote")[i]).css("background-color", "#12b7f5")
  143. }
  144. } else {
  145. if (lastColor !== 'red') {
  146. $($(".quote")[i]).css("background-color", "#12b7f5")
  147. lastColor = 'red'
  148. } else {
  149. lastColor = 'white'
  150. $($(".quote")[i]).css("background-color", "#02cfb9")
  151. }
  152. }
  153. }
  154. })
  155. },
  156. },
  157. mounted() {
  158. var vm = this
  159. // vm.getModal()
  160. vm.getDatas()
  161. vm.gettypes()
  162. },
  163. methods: {
  164. setImgSrc: function (src) {
  165. var str = httpRequest.getImgUrl(src)
  166. return str
  167. },
  168. getDatas: function () {
  169. var vm = this
  170. var params = {
  171. patientCondition: vm.name,// 居民条件,可以按身份证或者居民名称模糊匹配
  172. diseaseCode: vm.type, //疾病类型
  173. planType: vm.status, //安排类型(1康复计划,2转社区医院,3转家庭病床)
  174. todaybacklog: vm.isTotayTodo, // 今日待办(1、今日待办,2、全部)
  175. page: vm.currentPage,
  176. pageSize: vm.pagesize,
  177. isDanger: vm.isDanger,
  178. }
  179. healthAPI.getSpecialList(params).then(function (res) {
  180. console.log(res)
  181. if (res.status == 200) {
  182. vm.wujilu = false
  183. vm.total = res.data.totalCount
  184. vm.pagetotal = Math.ceil(res.data.totalCount / vm.pagesize)
  185. vm.tablelist = _.sortBy(res.data.detailModelList, "patientName")
  186. if (vm.tablelist.length == 0) {
  187. vm.wujilu = true
  188. }
  189. vm.docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
  190. vm.doctorType = vm.docInfo.doctorType
  191. if (vm.doctorType !== 1) {
  192. $(".neironglef>button").attr('disabled', "true")
  193. $(".neironglef>button").addClass("falsebutton")
  194. $(".neironglef>button").css("color", "white")
  195. }
  196. } else {
  197. showErrorMessage(res.msg);
  198. }
  199. })
  200. healthAPI.doctorBaseinfo().then(function (res) {
  201. console.log(res.data)
  202. vm.isLeader = res.data.isLeader
  203. console.log(vm.isLeader)
  204. if (vm.isLeader == 0) {
  205. }
  206. })
  207. },
  208. gettypes: function () {
  209. var vm = this
  210. var search = true
  211. $("#Status").bsSuggest({
  212. data: {
  213. value: [{
  214. code: "",
  215. name: "全部"
  216. },
  217. {
  218. code: "1",
  219. name: "康复计划"
  220. },
  221. {
  222. code: "2",
  223. name: "(转)社区医院"
  224. },
  225. {
  226. code: "3",
  227. name: "(转)家庭病床"
  228. }
  229. ]
  230. },
  231. getDataMethod: "data",
  232. effectiveFields: ["name"],
  233. idField: "code",
  234. keyField: "name"
  235. });
  236. healthAPI.getSpecialDisease().then(function (res) {
  237. if (res.status == 200) {
  238. console.log(res)
  239. var data = {}
  240. data.value = _.map(res.data, function (v) {
  241. return {
  242. code: v.code,
  243. name: v.name
  244. }
  245. })
  246. if (search) {
  247. data.value = [{
  248. code: "",
  249. name: "全部"
  250. }].concat(data.value)
  251. }
  252. $("#Type").bsSuggest({
  253. data: data,
  254. getDataMethod: "data",
  255. effectiveFields: ["name"],
  256. idField: "code",
  257. keyField: "name"
  258. });
  259. vm.types = res.data;
  260. } else {
  261. showErrorMessage(res.msg);
  262. }
  263. })
  264. },
  265. search: function (page) {
  266. var vm = this
  267. vm.type = $("#Type").attr("data-id");
  268. vm.status = $("#Status").attr("data-id");
  269. vm.currentPage = page
  270. vm.getDatas()
  271. },
  272. daiban: function (page) {
  273. var vm = this
  274. vm.isTotayTodo = $("#c").prop("checked") ? 2 : 1
  275. $(".icon-chkbox").toggleClass("icon-bgchkbox");
  276. vm.currentPage = page
  277. console.log(vm.currentPage)
  278. vm.getDatas()
  279. },
  280. morePlan: function (data) {
  281. location.href = "moreplan.html?patientCode=" + data.patientCode
  282. },
  283. stop: function (data) {
  284. var vm = this
  285. vm.planid = data.id
  286. conFirm("确定终止该计划吗", data.status, vm.isStop, vm.planid, vm.getDatas)
  287. },
  288. newRecover: function () {
  289. location.href = "../../recover/html/new_recover.html"
  290. },
  291. checkPlan: function (data) {
  292. var vm = this
  293. location.href = "../../rehabilitation/html/rehabilitation_management.html?planId=" + data.id
  294. }
  295. }
  296. })
  297. });