health_control.js 16 KB

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