health_control.js 11 KB

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