health_control.js 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. } else {
  33. $("#progress_"+planid).css({
  34. "background-color": "#ff9526"
  35. })
  36. $("#stopBtn_"+planid).html("终止计划")
  37. }
  38. console.log(isStop)
  39. var params = {
  40. status: isStop,
  41. planId: planid
  42. }
  43. healthAPI.updatePlanStatusById(params).then(function (res) {
  44. if (res.status == 200) {
  45. getDat()
  46. }
  47. })
  48. layer.close(index);
  49. });
  50. }
  51. new Vue({
  52. el: '#app',
  53. data: {
  54. code: "",
  55. modal: "",
  56. type: "",
  57. status: "",
  58. plan: "",
  59. name: "",
  60. isDanger: "0",
  61. pagesize: 10,
  62. total: "",
  63. pagetotal: '', //总页数
  64. currentPage: 1, //当前页数
  65. tablelist: [],
  66. diseaselist: [],
  67. types: [],
  68. Statics: {},
  69. wujilu: false,
  70. datamodelshow: true,
  71. plantype: 1,
  72. todaylog: 1,
  73. isTotayTodo: 1,
  74. progress: "",
  75. allFinishCount: "",
  76. allCount: "",
  77. planid: "",
  78. isStop: 1, //
  79. isActive: true,
  80. },
  81. watch: {
  82. tablelist: function (val) {
  83. var vm = this
  84. this.$nextTick(function () {
  85. element.init()
  86. for (var i = 0; i < val.length; i++) {
  87. var allFinishCount = val[i].allFinishCount
  88. var allCount = val[i].allCount
  89. var isStop = val[i].status
  90. var ishospitalName=val[i].hospitalName
  91. if(ishospitalName==null){
  92. $("#hospitalName_"+val[i].id).html("暂无社区信息")
  93. }
  94. if(allCount==0){
  95. Progress(val[i].id, 0 + "%")
  96. }else{
  97. var progressNum = Math.ceil((allFinishCount / allCount) * 100)
  98. Progress(val[i].id, progressNum + "%")
  99. }
  100. if (isStop == 0) {
  101. $("#progress_"+val[i].id).css({
  102. "background-color": "gray"
  103. })
  104. $("#stopBtn_"+val[i].id).html("激活计划")
  105. } else {
  106. $("#progress_"+val[i].id).css({
  107. "background-color": "#ff9526"
  108. })
  109. $("#stopBtn_"+val[i].id).html("终止计划")
  110. }
  111. }
  112. var lastColor = 'red';
  113. for (var i = 0; i < val.length; i++) {
  114. if (i == 0) {
  115. $($(".quote")[i]).css("background-color","#12b7f5")
  116. continue
  117. }
  118. if (val[i].patientName == val[i - 1].patientName) {
  119. $($(".quote")[i]).css("background-color","#02cfb9")
  120. if (lastColor === 'red') {
  121. $($(".quote")[i]).css("background-color","#12b7f5")
  122. }
  123. } else {
  124. if (lastColor !== 'red') {
  125. $($(".quote")[i]).css("background-color","#12b7f5")
  126. lastColor = 'red'
  127. } else {
  128. lastColor = 'white'
  129. $($(".quote")[i]).css("background-color","#02cfb9")
  130. }
  131. }
  132. }
  133. })
  134. },
  135. },
  136. mounted() {
  137. var vm = this
  138. // vm.getModal()
  139. vm.getDatas()
  140. vm.gettypes()
  141. },
  142. methods: {
  143. setImgSrc: function(src) {
  144. var str = httpRequest.getImgUrl(src)
  145. return str
  146. },
  147. getDatas: function () {
  148. var vm = this
  149. var params = {
  150. patientCondition: vm.name,// 居民条件,可以按身份证或者居民名称模糊匹配
  151. diseaseCode: vm.type, //疾病类型
  152. planType: vm.status, //安排类型(1康复计划,2转社区医院,3转家庭病床)
  153. todaybacklog: vm.isTotayTodo, // 今日待办(1、今日待办,2、全部)
  154. page: vm.currentPage,
  155. pageSize: vm.pagesize,
  156. isDanger: vm.isDanger,
  157. }
  158. healthAPI.getSpecialList(params).then(function (res) {
  159. console.log(res)
  160. if (res.status == 200) {
  161. vm.wujilu = false
  162. vm.total = res.data.totalCount
  163. vm.pagetotal = Math.ceil(res.data.totalCount / vm.pagesize)
  164. vm.tablelist = _.sortBy(res.data.detailModelList, "patientName")
  165. if (vm.tablelist.length == 0) {
  166. vm.wujilu = true
  167. }
  168. } else {
  169. showErrorMessage(res.msg);
  170. }
  171. })
  172. },
  173. gettypes: function () {
  174. var vm = this
  175. var search = true
  176. $("#Status").bsSuggest({
  177. data: {
  178. value: [{
  179. code: "",
  180. name: "全部"
  181. },
  182. {
  183. code: "1",
  184. name: "康复计划"
  185. },
  186. {
  187. code: "2",
  188. name: "(转)社区医院"
  189. },
  190. {
  191. code: "3",
  192. name: "(转)家庭病床"
  193. }
  194. ]
  195. },
  196. getDataMethod: "data",
  197. effectiveFields: ["name"],
  198. idField: "code",
  199. keyField: "name"
  200. });
  201. healthAPI.getSpecialDisease().then(function (res) {
  202. if (res.status == 200) {
  203. console.log(res)
  204. var data = {}
  205. data.value = _.map(res.data, function (v) {
  206. return {
  207. code: v.code,
  208. name: v.name
  209. }
  210. })
  211. if (search) {
  212. data.value = [{
  213. code: "",
  214. name: "全部"
  215. }].concat(data.value)
  216. }
  217. $("#Type").bsSuggest({
  218. data: data,
  219. getDataMethod: "data",
  220. effectiveFields: ["name"],
  221. idField: "code",
  222. keyField: "name"
  223. });
  224. vm.types = res.data;
  225. } else {
  226. showErrorMessage(res.msg);
  227. }
  228. })
  229. },
  230. search: function (page) {
  231. var vm = this
  232. vm.type = $("#Type").attr("data-id");
  233. vm.status = $("#Status").attr("data-id");
  234. vm.currentPage = page
  235. vm.getDatas()
  236. },
  237. daiban: function (page) {
  238. var vm = this
  239. vm.isTotayTodo = $("#c").prop("checked") ? 2 : 1
  240. $(".icon-chkbox").toggleClass("icon-bgchkbox");
  241. vm.currentPage = page
  242. console.log(vm.currentPage)
  243. vm.getDatas()
  244. },
  245. morePlan: function (data) {
  246. location.href = "moreplan.html?patientCode=" + data.patientCode
  247. },
  248. checkPlan: function (data) {
  249. location.href = "../../rehabilitation/html/rehabilitation_management.html?planid=" + data.id + "&status=" + data.status
  250. },
  251. stop: function (data) {
  252. var vm = this
  253. vm.planid = data.id
  254. conFirm("确定终止该计划吗", data.status, vm.isStop, vm.planid, vm.getDatas)
  255. },
  256. newRecover:function(){
  257. location.href="../../recover/html/new_recover.html"
  258. }
  259. }
  260. })
  261. });