health_control.js 9.3 KB

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