health_control.js 16 KB

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