health_control.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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. doctorTeamList:[],
  140. healthyConditionType:0
  141. },
  142. watch: {
  143. tablelist: function (val) {
  144. var vm = this
  145. this.$nextTick(function () {
  146. element.init()
  147. for (var i = 0; i < val.length; i++) {
  148. var allFinishCount = val[i].allFinishCount
  149. var allCount = val[i].allCount
  150. var isStop = val[i].status
  151. var ishospitalName = val[i].hospitalName
  152. vm.planCreateUser = val[i].planCreateUser
  153. vm.healthyConditionType=val[i].healthyConditionType//1住院 2康复期 3日常健康 4健康筛查
  154. if(vm.healthyConditionType==1){
  155. $("#quote_"+val[i].id).css("backgroundColor","#FF3B30")
  156. }
  157. if(vm.healthyConditionType==2){
  158. $("#quote_"+val[i].id).css("backgroundColor","#FF9526")
  159. }
  160. if(vm.healthyConditionType==3){
  161. $("#quote_"+val[i].id).css("backgroundColor","#2DBE55")
  162. }
  163. if(vm.healthyConditionType==4){
  164. $("#quote_"+val[i].id).css("backgroundColor","#02CFB9")
  165. }
  166. if (ishospitalName == null) {
  167. $("#hospitalName_" + val[i].id).html("暂无社区信息")
  168. }
  169. if (allCount == 0) {
  170. Progress(val[i].id, 0 + "%")
  171. } else {
  172. var progressNum = Math.ceil((allFinishCount / allCount) * 100)
  173. Progress(val[i].id, progressNum + "%")
  174. }
  175. if (isStop == 0) {
  176. $("#progress_" + val[i].id).css({
  177. "background-color": "gray"
  178. })
  179. $("#stopBtn_" + val[i].id).html("激活计划")
  180. $("#stopBtn_" + val[i].id).css({
  181. "background-color": "#2dbe55"
  182. })
  183. } else {
  184. $("#progress_" + val[i].id).css({
  185. "background-color": "#ff9526"
  186. })
  187. $("#stopBtn_" + val[i].id).html("中止计划")
  188. if(val[i].status == 2) {
  189. $("#stopBtn_" + val[i].id).css({
  190. "background-color": "gray"
  191. })
  192. } else {
  193. $("#stopBtn_" + val[i].id).css({
  194. "background-color": "#ff3b30"
  195. })
  196. }
  197. }
  198. }
  199. var lastColor = 'red';
  200. for (var i = 0; i < val.length; i++) {
  201. if (i == 0) {
  202. $($(".quote")[i]).css("background-color", "#12b7f5")
  203. continue
  204. }
  205. if (val[i].patientName == val[i - 1].patientName) {
  206. $($(".quote")[i]).css("background-color", "#02cfb9")
  207. if (lastColor === 'red') {
  208. $($(".quote")[i]).css("background-color", "#12b7f5")
  209. }
  210. } else {
  211. if (lastColor !== 'red') {
  212. $($(".quote")[i]).css("background-color", "#12b7f5")
  213. lastColor = 'red'
  214. } else {
  215. lastColor = 'white'
  216. $($(".quote")[i]).css("background-color", "#02cfb9")
  217. }
  218. }
  219. }
  220. })
  221. },
  222. },
  223. mounted: function() {
  224. var vm = this
  225. vm.getDatas()
  226. vm.gettypes()
  227. vm.getDoctorTeam()
  228. },
  229. methods: {
  230. setImgSrc: function (src) {
  231. var str = httpRequest.getImgUrl(src)
  232. return str
  233. },
  234. getDoctorTeam:function(){
  235. var vm=this
  236. var wlyyAgentForDoc=JSON.parse(window.localStorage.getItem('wlyyAgentForDoc'));
  237. var uid=wlyyAgentForDoc && wlyyAgentForDoc.uid;
  238. healthAPI.getDoctorTeam(uid).then(function(res){
  239. if(res.status==200){
  240. vm.doctorTeamList=res.data;
  241. }
  242. })
  243. },
  244. getDatas: function () {
  245. var vm = this
  246. var params = {
  247. patientCondition: vm.name,// 居民条件,可以按身份证或者居民名称模糊匹配
  248. diseaseCode: vm.type, //疾病类型
  249. planType: vm.status, //安排类型(1康复计划,2转社区医院,3转家庭病床)
  250. todaybacklog: vm.isTotayTodo, // 今日待办(1、今日待办,2、全部)
  251. page: vm.currentPage,
  252. pageSize: vm.pagesize,
  253. isDanger: vm.isDanger,
  254. }
  255. healthAPI.getSpecialList(params).then(function (res) {
  256. console.log(res)
  257. if (res.status == 200) {
  258. vm.wujilu = false
  259. vm.total = res.data.totalCount
  260. vm.pagetotal = Math.ceil(res.data.totalCount / vm.pagesize)
  261. vm.tablelist = _.sortBy(res.data.detailModelList, "patientName")
  262. if (vm.tablelist.length == 0) {
  263. vm.wujilu = true
  264. }
  265. vm.docInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'))
  266. vm.doctorType = vm.docInfo.doctorType
  267. if (vm.doctorType != 1) {
  268. $(".neironglef>button:nth-child(1)").attr('disabled', "true")
  269. $(".neironglef>button:nth-child(1)").addClass("falsebutton")
  270. $(".neironglef>button:nth-child(1)").css("color", "white")
  271. }
  272. healthAPI.doctorBaseinfo().then(function (res) {
  273. vm.isLeader = res.data.isLeader//0非团队长 1团队长
  274. vm.level=res.data.level//1专科医生,2全科医生,3健康管理师
  275. vm.planCreateUser //创建者跟登录者相等可中止操作
  276. vm.docCode=res.data.code
  277. for (var i = 0; i < vm.tablelist.length; i++) {
  278. if(vm.docCode!=vm.planCreateUser){
  279. $("#stopBtn_" + vm.tablelist[i].id).attr('disabled', "true")
  280. $("#stopBtn_" + vm.tablelist[i].id).addClass("falsebutton")
  281. }
  282. }
  283. // if (vm.isLeader == 0||vm.level != 1) {
  284. // $(".neironglef>button:nth-child(2)").attr('disabled', "true")
  285. // $(".neironglef>button:nth-child(2)").addClass("falsebutton")
  286. // $(".neironglef>button:nth-child(2)").css("color", "white")
  287. // }
  288. })
  289. } else {
  290. showErrorMessage(res.msg);
  291. }
  292. })
  293. },
  294. gettypes: function () {
  295. var vm = this
  296. var search = true
  297. $("#Status").bsSuggest({
  298. data: {
  299. value: [{
  300. code: "",
  301. name: "全部"
  302. },
  303. {
  304. code: "1",
  305. name: "康复计划"
  306. },
  307. {
  308. code: "2",
  309. name: "(转)社区医院"
  310. },
  311. {
  312. code: "3",
  313. name: "(转)家庭病床"
  314. }
  315. ]
  316. },
  317. getDataMethod: "data",
  318. effectiveFields: ["name"],
  319. idField: "code",
  320. keyField: "name"
  321. });
  322. healthAPI.getSpecialDisease().then(function (res) {
  323. if (res.status == 200) {
  324. console.log(res)
  325. var data = {}
  326. data.value = _.map(res.data, function (v) {
  327. return {
  328. code: v.code,
  329. name: v.name
  330. }
  331. })
  332. if (search) {
  333. data.value = [{
  334. code: "",
  335. name: "全部"
  336. }].concat(data.value)
  337. }
  338. $("#Type").bsSuggest({
  339. data: data,
  340. getDataMethod: "data",
  341. effectiveFields: ["name"],
  342. idField: "code",
  343. keyField: "name"
  344. });
  345. vm.types = res.data;
  346. } else {
  347. showErrorMessage(res.msg);
  348. }
  349. })
  350. },
  351. search: function (page) {
  352. var vm = this
  353. vm.type = $("#Type").attr("data-id");
  354. vm.status = $("#Status").attr("data-id");
  355. vm.currentPage = page
  356. vm.getDatas()
  357. },
  358. daiban: function (page) {
  359. var vm = this
  360. vm.isTotayTodo = $("#c").prop("checked") ? 1 : 2
  361. $(".icon-chkbox").toggleClass("icon-bgchkbox");
  362. vm.currentPage = page
  363. console.log(vm.currentPage)
  364. vm.getDatas()
  365. },
  366. morePlan: function (data) {
  367. location.href = "moreplan.html?patientCode=" + data.patientCode
  368. },
  369. stop: function (data) {
  370. var vm = this
  371. vm.planid = data.id
  372. conFirm("确定终止该计划吗", data.status, vm.isStop, vm.planid, vm.getDatas)
  373. },
  374. newRecover: function () {
  375. location.href = "../../recover/html/new_recover.html"
  376. },
  377. checkPlan: function (data) {
  378. var vm = this
  379. location.href = "../../rehabilitation/html/rehabilitation_management.html?planId=" + data.id+"&patientCode=" + data.patientCode
  380. },
  381. modelControl: function () {
  382. location.href = "../../rehabilitation/html/management.html"
  383. },
  384. checkPatient: function (data) {
  385. var vm = this
  386. layer.open({
  387. type: 2,
  388. area: ['750px', '650px'],
  389. shade: 0.5,
  390. title: '居民信息',
  391. fixed: true, //不固定
  392. maxmin: true,
  393. closeBtn: 1,
  394. shift: 5,
  395. shadeClose: false, //点击遮罩关闭层
  396. content: '../../temporary/html/userInfo.html?patient=' + data.patientCode
  397. })
  398. // location.href = "" +
  399. },
  400. recoveryPlan:function (data){
  401. location.href = "../../recover/html/personal-manage.html?patientCode="+data.patientCode+'&planId='+data.id
  402. }
  403. }
  404. })
  405. });