health_control.js 9.4 KB

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