health_control.js 14 KB

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