rehabilitation_management.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. !function(){
  2. var httpData=GetRequest();
  3. var currentGMT=new Date();//当前时间GMT
  4. var xuetangDuring = ['', '早餐前', '早餐后', '午餐前', '午餐后', '晚餐前', '晚餐后', '睡前'];
  5. var normalLevel = [
  6. [],
  7. [7, 4],
  8. [11.1, 4],
  9. [7, 4],
  10. [11.1, 4],
  11. [7, 4],
  12. [11.1, 4],
  13. [7, 4]
  14. ];
  15. function showSuccessMessage(msg) {
  16. layer.msg(msg, {
  17. icon: 1
  18. })
  19. }
  20. function showErrorMessage(msg) {
  21. layer.msg(msg, {
  22. icon: 5
  23. })
  24. }
  25. function showWarningMessage(msg) {
  26. layer.msg(msg, {
  27. icon: 2
  28. })
  29. }
  30. function showInfoMessage(msg) {
  31. layer.msg(msg, {
  32. icon: 6
  33. })
  34. }
  35. top.rehabilitationVue = new Vue({
  36. el:"#app",
  37. data:{
  38. ynow: currentGMT.getFullYear(),//年份
  39. mnow: currentGMT.getMonth(),//月份(比实际少一个月---0开始至11)
  40. dnow: currentGMT.getDate(),//当前日
  41. currentDay:null,//带中文格式的当前年月
  42. currentDayForEn:null,//不带中文格式年月日2018/10/01如果写成/的话 转换成时间戳会变成北京时间8点
  43. calendarData:[],//日历数据
  44. timeAxisData:[],//时间轴数据
  45. __Data:[],//当前的年月(日历)
  46. __xData:[],//当前的年月(时间轴)
  47. isFastSearch: false, // 是否是快速查找任务
  48. status:null,//任务状态(0未完成,1已完成,2已预约)
  49. searchTask:null,//快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访,5、复诊)
  50. searchTaskName:null,//快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访,5、复诊)
  51. planId: httpData['planId'],
  52. patientCode: httpData['patientCode'],
  53. curDoc: JSON.parse(localStorage.docInfo),
  54. taskArr:[
  55. {code:1,name:'我的任务'},
  56. {code:2,name:'健康教育'},
  57. {code:3,name:'健康指导'},
  58. {code:4,name:'随访'},
  59. {code:5,name:'复诊'},
  60. ],
  61. statusArr:[
  62. {code:0,name:'未完成'},
  63. {code:1,name:'已完成'},
  64. {code:2,name:'已预约'},
  65. ],
  66. curTask:'',//快速查找是否点击了搜索按钮
  67. curTaskName:'',//快速查找是否点击了搜索按钮
  68. tabStatus:null,
  69. planInfo:{},
  70. docList:[],
  71. diagnosisInformation: null,
  72. searchData: [], // 搜索计划安排(去年、今年、明年)
  73. medicalRecordsList: [], //病历列表
  74. limitlessItems: []
  75. },
  76. mounted:function(){
  77. if(!this.planId){
  78. layer.msg('未传入计划id(planId)',{icon:2})
  79. }else{
  80. this.tabStatus=1;
  81. }
  82. this.planSchedule();
  83. this.serviceDoctorList();//获取服务医生列表
  84. this.bindEvents();
  85. // 获取最新的诊疗信息1条
  86. this.findDiagnosisInformationByPlanId()
  87. },
  88. methods:{
  89. // 刷新
  90. refresh: function(){
  91. this.planSchedule();
  92. this.timeAxis();
  93. },
  94. //获取计划表
  95. planSchedule:function(){
  96. var vm = this;
  97. var params = {
  98. planId: this.planId,
  99. patientCode: this.patientCode
  100. };
  101. rehaAPI.planSchedule(params).then(function(res){
  102. if(res.status == 200){
  103. vm.planInfo = res.data;
  104. vm.planInfo.tagClass = "tag-"+res.data.healthyConditionType;
  105. //patientImg:居民签名照/证件照,如果不为null的话说明居民已确认,显示康复完成明细
  106. if(vm.planInfo.status==2 && !vm.planInfo.patientImg){//任务全部完成时,显示完成提示框
  107. vm.showCompleteDailog();
  108. }else if(vm.planInfo.status==2 && vm.planInfo.patientImg){//居民已确认计划完成
  109. vm.tabStatus=3;
  110. $("#framePage").attr("src","stop_special_service.html?planids="+vm.planId+"&planStatus="+vm.planInfo.status)
  111. }
  112. vm.selectByMedicalCode(res.data.medicalRecordsCode)
  113. }else{
  114. layer.msg(res.msg,{icon:5});
  115. }
  116. })
  117. },
  118. // 获取住院病历
  119. selectByMedicalCode: function(medicalRecordsCode){
  120. var vm = this;
  121. var params = {
  122. medical: medicalRecordsCode
  123. };
  124. rehaAPI.selectByMedicalCode(params).then(function(res){
  125. if(res.status==200){
  126. vm.medicalRecordsList = res.data
  127. }else {
  128. showErrorMessage(res.msg);
  129. }
  130. })
  131. },
  132. formatter: function(time){
  133. return new Date(time).format('yyyy-MM-dd')
  134. },
  135. // 获取最新的诊疗消息
  136. findDiagnosisInformationByPlanId: function() {
  137. var vm = this,
  138. loading = layer.load(0, {shade: false}),
  139. params = {
  140. planId: vm.planId
  141. }
  142. recoverAPI.findDiagnosisInformationByPlanId(params).then(function(res) {
  143. layer.close(loading)
  144. if(res.status == 200) {
  145. vm.diagnosisInformation = res.data
  146. } else {
  147. showErrorMessage(res.msg);
  148. }
  149. })
  150. },
  151. serviceDoctorList:function(){
  152. var vm = this;
  153. rehaAPI.serviceDoctorList({patientCode: this.patientCode}).then(function(res){
  154. if(res.status == 200){
  155. vm.docList = res.data;
  156. }else{
  157. layer.msg(res.msg,{icon:5});
  158. }
  159. })
  160. },
  161. weiXinConfirmClick:function(){
  162. var vm = this;
  163. rehaAPI.sendWxMsg({planId: this.planId}).then(function(res){
  164. if(res.status == 200){
  165. layer.msg("发送成功,等待居民确认");
  166. setTimeout(function(){
  167. vm.tabStatus=3;
  168. $("#framePage").attr("src","stop_special_service.html?planids="+vm.planId+"&planStatus="+vm.planInfo.status)
  169. },1000)
  170. }else{
  171. layer.msg(res.msg,{icon:5});
  172. }
  173. })
  174. },
  175. setImgSrc: function (src) {
  176. var str = httpRequest.getImgUrl(src)
  177. return str
  178. },
  179. showCompleteDailog:function(){
  180. layer.confirm('<div class="mt10 tac"><image src="../images/yiwancheng_icon.png" width="100" height="100"/><div class="mt20 c-f20 c-333 mb40">本次康复计划已完成</div><div class="div-patient-comfirm c-f14 c-fff bgc-12b7f5" style="margin:40px auto 20px;">邀请居民确认</div></div>', {
  181. btn: [],
  182. area: ["400px", "340px"],
  183. title: "完成提示"
  184. }, function (index) {
  185. // layer.close(index);
  186. });
  187. },
  188. refreshPage:function(){
  189. if(!this.planId){
  190. layer.msg('未传入计划id(planId)',{icon:2})
  191. return ;
  192. }
  193. this.goToLoadData(true);
  194. },
  195. bindEvents:function(){
  196. var vm = this;
  197. $("body").on("click",".div-patient-comfirm",function(){
  198. layer.closeAll();
  199. vm.weiXinConfirmClick();
  200. }).on("click", ".div-patient-home", function() {
  201. location.href = "../../recover/html/personal-manage.html?patientCode=" + vm.patientCode
  202. })
  203. },
  204. viewDetail:function(planids,status,type){
  205. var vm=this;
  206. if(!planids){
  207. layer.msg('无服务项',{icon:5})
  208. return ;
  209. }
  210. if(type==1){ // 单个服务项
  211. top.layer.open({
  212. type: 2,
  213. area: ['800px', '700px'],
  214. shade: 0.5,
  215. title: '服务项目内容',
  216. fixed: true, //不固定
  217. maxmin: true,
  218. closeBtn:1,
  219. shift: 5,
  220. shadeClose: false, //点击遮罩关闭层
  221. content: '../../rehabilitation/html/guide_the_message.html?planid='+planids+'&oprateType=1'+'&pId='+httpData['planId']+'&patient='+vm.patientCode
  222. });
  223. return ;
  224. }
  225. layer.open({ // 康复计划的所有服务项
  226. type: 2,
  227. area: ['800px', '700px'],
  228. shade: 0.5,
  229. title: '服务项目内容',
  230. fixed: true, //不固定
  231. maxmin: true,
  232. closeBtn:1,
  233. shift: 5,
  234. shadeClose: false, //点击遮罩关闭层
  235. content: '../../rehabilitation/html/service_item_content.html?planids='+planids+'&planId='+httpData['planId']+'&patient='+vm.patientCode,
  236. end:function(){
  237. vm.goToLoadData(true);
  238. }
  239. });
  240. },
  241. changeStatus:function(val){
  242. this.status=this.status==val?null:val;
  243. },
  244. changeTask:function(val){
  245. this.searchTask=this.searchTask==val.code?null:val.code;
  246. this.searchTaskName=this.searchTaskName==val.name?null:val.name;
  247. },
  248. monDetail:function(){
  249. this.currentDay = this.ynow + '年'+ (this.mnow + 1) +'月';
  250. this.currentDayForEn=this.ynow+'/'+(this.mnow>=9?(this.mnow+1):"0"+(this.mnow+1))+'/'+(this.dnow>=9?this.dnow:"0"+this.dnow)
  251. },
  252. is_leap:function(year) { //判断是否为闰年
  253. return (year%100==0?res=(year%400==0?1:0):res=(year%4==0?1:0));
  254. },
  255. preMonth:function(){ //上一个月
  256. if(this.mnow<=0){
  257. this.mnow=11;
  258. this.ynow=this.ynow-1;
  259. }else{
  260. this.mnow--;
  261. }
  262. this.monDetail();
  263. this.goToLoadData(true);
  264. },
  265. getPreMouth:function(){
  266. var pMnow,pYnow;
  267. if(this.mnow<=0){
  268. pMnow=11;
  269. pYnow=this.ynow-1;
  270. }else{
  271. pMnow=this.mnow-1;
  272. pYnow=this.ynow;
  273. }
  274. var m_days=new Array(31,(28+this.is_leap(pYnow)),31,30,31,30,31,31,30,31,30,31); //每个月的天数
  275. return {
  276. days:m_days[pMnow],
  277. date:pYnow+'-'+(++pMnow>=10?pMnow:"0"+pMnow)
  278. }
  279. },
  280. nextMonth:function(){ //下一个月
  281. if(this.mnow>=11){
  282. this.mnow=0;
  283. this.ynow=this.ynow+1;
  284. }else{
  285. this.mnow++;
  286. }
  287. this.monDetail();
  288. this.goToLoadData(true);
  289. },
  290. getNextMouth:function(){
  291. var nMnow,nYnow;
  292. if(this.mnow>=11){
  293. nMnow=0;
  294. nYnow=this.ynow+1;
  295. }else{
  296. nMnow=this.mnow+1;
  297. nYnow=this.ynow;
  298. }
  299. var m_days=new Array(31,(28+this.is_leap(nYnow)),31,30,31,01,31,31,30,31,30,31); //每个月的天数
  300. return {
  301. days:m_days[nMnow],
  302. date:nYnow+'-'+(++nMnow>=10?nMnow:"0"+nMnow)
  303. }
  304. },
  305. goToLoadData:function(flag){//flag是否更新数据
  306. this.tabStatus==1 && (!this.calendarData.length || flag) && this.calendar();
  307. this.tabStatus==2 && (!this.timeAxisData.length || flag) && this.timeAxis();
  308. this.changeSearch(-1)
  309. },
  310. calendar:function(){
  311. var nlstr = new Date(this.ynow,this.mnow,1); //当月第一天
  312. var firstday = nlstr.getDay()-1;//第一天星期几,默认是周日 我们改成周一
  313. firstday=firstday==-1?6:firstday;//如果是-1,说明当月的第一天是周日
  314. var m_days=new Array(31,(28+this.is_leap(this.ynow)),31,30,31,30,31,31,30,31,30,31); //每个月的天数
  315. var tr_str=Math.ceil((m_days[this.mnow] + firstday)/7); //当前月天数+第一天是星期几的数值 获得 表格行数
  316. var c_days=m_days[this.mnow];//当前月份的天数
  317. var p_arr=this.getPreMouth();
  318. var n_arr=this.getNextMouth();
  319. var i,k,idx,date_str;
  320. var dataArr=[];//天数/年月
  321. for(i=0;i<tr_str;i++) { //表格的行
  322. for(k=0;k<7;k++) { //表格每行的单元格
  323. idx=i*7+k; //单元格自然序列号
  324. date_str=idx-firstday+1; //计算日期
  325. var __ym;
  326. if(date_str<=0){//过滤无效日期(小于等于零的、大于月总天数的)
  327. date_str=date_str+p_arr['days'];//当前日期+上个月的天数就是上个月的日期
  328. __ym=p_arr['date'];
  329. }else if(date_str>c_days){
  330. date_str=date_str-c_days;//下个月的日期就是这个月的天数-当月的天数
  331. __ym=n_arr['date'];
  332. }else{
  333. __ym=this.ynow+'-'+(this.mnow>=9?"":"0")+(this.mnow+1);
  334. }
  335. dataArr.push({
  336. day:date_str,
  337. date:__ym
  338. });
  339. }
  340. }
  341. this.__Data=dataArr;
  342. this.monDetail();
  343. this.calenderPlanDetail();
  344. },
  345. daysSort: function(arr) {
  346. var getArr = JSON.parse(JSON.stringify(arr)),
  347. returnArr = []
  348. for(var i = 1; i < 31; i++) {
  349. for(var j = 0, len = getArr.length; j < len; j++) {
  350. var stri = i > 9 + '' ? i : '0'+i
  351. if(getArr[j].day == stri) {
  352. returnArr.push(getArr[j])
  353. getArr.splice(j,1)
  354. break;
  355. }
  356. }
  357. }
  358. return returnArr
  359. },
  360. // 日历有计划数据处理
  361. planHandleData: function(data, day, mounth) {
  362. var item = data;
  363. item.day = day;
  364. if(mounth) {item.mounth = mounth}
  365. var finishFlag=false
  366. var sFlag=false;
  367. var fFlag=false;
  368. if(item.specialist){
  369. if(item.specialist.all==item.specialist.finish){
  370. sFlag=true;
  371. }
  372. }else{
  373. sFlag = true;
  374. }
  375. if(item.family){
  376. if(item.family.all==item.family.finish){
  377. fFlag = true;
  378. }
  379. }else{
  380. fFlag = true;
  381. }
  382. finishFlag = sFlag && fFlag;
  383. item.finishFlag=finishFlag;
  384. return item
  385. },
  386. // 日历请求
  387. calenderPlanDetail:function(){
  388. var vm=this;
  389. var __days=vm.__Data;
  390. var lastDay=(__days.concat()).pop().day;
  391. lastDay=lastDay>9?lastDay:'0'+lastDay;
  392. if(vm.searchTask || vm.status || vm.status == 0) {
  393. vm.isFastSearch = true
  394. } else {
  395. vm.isFastSearch = false
  396. }
  397. var params={
  398. executeStartTime: vm.isFastSearch ? '' : __days[0].date+'-'+__days[0].day+' 00:00:00',//日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
  399. executeEndTime: vm.isFastSearch ? '' : (__days.concat()).pop().date+'-'+lastDay+' 23:59:59',//日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
  400. planId:vm.planId,//计划id
  401. searchTask:vm.searchTask,//快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访)
  402. status:vm.status,//任务状态(0未完成,1已完成,2已预约)
  403. }
  404. rehaAPI.calendarPlanDetail(params).then(function(res){
  405. vm.curTask=vm.searchTask;
  406. vm.curTaskName=vm.searchTaskName;
  407. vm.calendarData=[];
  408. var list = [];
  409. if(res.status==200){
  410. var data=res.data
  411. // 快速查找
  412. if(vm.isFastSearch) {
  413. vm.searchData = []
  414. var searchData0 = [],
  415. searchData1 = [],
  416. searchData2 = [];
  417. for(var setM = 1; setM <= 12; setM++) {
  418. var _setM = setM > 9 ? setM : '0' + setM,
  419. _setY = new Date().getFullYear();
  420. var data0 = [],
  421. data1 = [],
  422. data2 = [];
  423. for(var i in data) {
  424. var getY = i.split("-")[0],
  425. getM = i.split("-")[1],
  426. getD = i.split("-")[2];
  427. // 去年
  428. if(_setY - 1 == getY && _setM == getM) {
  429. var item = vm.planHandleData(data[i], getD, getM)
  430. data0.push(item)
  431. data.length && data.splice(i,1);
  432. } else if(_setY == getY && _setM == getM) { // 今年
  433. var item = vm.planHandleData(data[i], getD, getM)
  434. data1.push(item)
  435. data.length && data.splice(i,1);
  436. } else if(_setY + 1 == getY && _setM == getM) { // 明年
  437. var item = vm.planHandleData(data[i], getD, getM)
  438. data2.push(item)
  439. data.length && data.splice(i,1);
  440. }
  441. }
  442. if(data0.length) {
  443. var dataSort = vm.daysSort(data0)
  444. var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
  445. for(var i = 0; i < 7 - addlen; i++) {
  446. dataSort.push({
  447. noService:true
  448. })
  449. }
  450. searchData0.push(dataSort)
  451. }
  452. if(data1.length) {
  453. var dataSort = vm.daysSort(data1)
  454. var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
  455. for(var i = 0; i < 7 - addlen; i++) {
  456. dataSort.push({
  457. noService:true
  458. })
  459. }
  460. searchData1.push(dataSort)
  461. }
  462. if(data2.length) {
  463. var dataSort = vm.daysSort(data2)
  464. var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
  465. for(var i = 0; i < 7 - addlen; i++) {
  466. dataSort.push({
  467. noService:true
  468. })
  469. }
  470. searchData2.push(dataSort)
  471. }
  472. }
  473. if(searchData0.length) {vm.searchData.push(searchData0)}
  474. if(searchData1.length) {vm.searchData.push(searchData1)}
  475. if(searchData2.length) {vm.searchData.push(searchData2)}
  476. return false;
  477. }
  478. // 正常日历
  479. var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0));
  480. for(var i in __days){
  481. var _key=__days[i].date+'-'+(__days[i].day>9?__days[i].day:'0'+__days[i].day);
  482. var item={
  483. noService:true,
  484. day:__days[i].day
  485. };
  486. for(var j in data){
  487. if(_key==j){
  488. item = vm.planHandleData(data[j], __days[i].day)
  489. data.length && data.splice(j,1);
  490. break;
  491. }
  492. }
  493. var thatTime=+new Date(_key)-8*60*60*1000;
  494. var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
  495. item.future=future;
  496. list.push(item);
  497. // vm.calendarData.push(item);
  498. }
  499. vm.calendarData = _.chunk(list, 7)
  500. }
  501. })
  502. },
  503. // 时间轴请求
  504. timeAxis:function(){
  505. var m_days=new Array(31,(28+this.is_leap(this.ynow)),31,30,31,30,31,31,30,31,30,31); //每个月的天数
  506. var c_days=m_days[this.mnow];//当前月份的天数
  507. var __ym=this.ynow+'-'+(this.mnow>=9?"":"0")+(this.mnow+1);
  508. var dataArr=[];//天数/年月
  509. for(;c_days>0;c_days--){
  510. dataArr.push({
  511. day:c_days,
  512. date:__ym
  513. });
  514. }
  515. this.__xData=dataArr;
  516. this.monDetail();
  517. this.calendarPlanDetailList();
  518. this.calendarPlanDetailItems();
  519. },
  520. // 时间轴请求
  521. calendarPlanDetailList:function(){
  522. var vm=this;
  523. var __days=vm.__xData;
  524. var lastDay=(__days.concat()).pop().day;
  525. lastDay=lastDay>9?lastDay:'0'+lastDay;
  526. var params={
  527. executeEndTime:__days[0].date+'-'+__days[0].day+' 00:00:00',//日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
  528. executeStartTime:(__days.concat()).pop().date+'-'+lastDay+' 23:59:59',//日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
  529. planId:vm.planId,//计划id
  530. searchTask:vm.searchTask,//快速查找任务:(1、我的任务,2、随访,3、复诊,4、健康教育)
  531. status:vm.status,//任务状态(0未完成,1已完成,2已预约)
  532. }
  533. rehaAPI.calendarPlanDetailList(params).then(function(res){
  534. if(res.status==200){
  535. var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
  536. vm.timeAxisData=_.map(res.data||{},function(o){
  537. var _time=o.executeTime.split(' ');
  538. var thatTime=+new Date(_time[0]);
  539. var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
  540. (o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
  541. var _html=o.status==2?'预':(future==-1?'逾':'');
  542. _html=future==1?'今':_html;
  543. if(_html=='预') future=3;
  544. o.html=_html
  545. o.date=_time[0];
  546. o.time=_time[1];
  547. o.future=future;
  548. return o;
  549. })||[];
  550. }
  551. })
  552. },
  553. calendarPlanDetailItems: function(){
  554. var vm=this;
  555. var __days=vm.__xData;
  556. var lastDay=(__days.concat()).pop().day;
  557. lastDay=lastDay>9?lastDay:'0'+lastDay;
  558. var params={
  559. executeEndTime:__days[0].date+'-'+__days[0].day+' 00:00:00',//日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
  560. executeStartTime:(__days.concat()).pop().date+'-'+lastDay+' 23:59:59',//日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
  561. planId:vm.planId,//计划id
  562. searchTask:vm.searchTask,//快速查找任务:(1、我的任务,2、随访,3、复诊,4、健康教育)
  563. status:vm.status,//任务状态(0未完成,1已完成,2已预约)
  564. }
  565. rehaAPI.calendarPlanDetailItems(params).then(function(res){
  566. if(res.status==200){
  567. var arr = []
  568. $.each(res.data, function(i, o){
  569. if(o.code=='3'&&o.type){
  570. if(o.type==2){
  571. o.levelClazz = vm.getLevelClazz(o.value1, 139, 90) || vm.getLevelClazz(o.value2, 89, 60)
  572. o.levelClazz1 = vm.getLevelClazz(o.value1, 139, 90)
  573. o.levelClazz2 = vm.getLevelClazz(o.value2, 89, 60)
  574. o.levelClazz3 = vm.getLevelClazz(o.value3, 100, 60)
  575. } else {
  576. var num = parseInt(o.value2)
  577. var max = normalLevel[num][0],
  578. min = normalLevel[num][1];
  579. o.levelClazz1 = vm.getLevelClazz(o.value1, max, min)
  580. o.levelName = xuetangDuring[o.value2]
  581. }
  582. }
  583. arr.push(o)
  584. })
  585. vm.limitlessItems = arr
  586. }
  587. })
  588. },
  589. getLevelClazz: function(value,max,min) {
  590. if(!value||(!max && !min)) {
  591. return '';
  592. }
  593. var value = parseFloat(value);
  594. if(value < min) {
  595. return 'low';
  596. } else if(value > max) {
  597. return 'high';
  598. } else {
  599. return ''
  600. }
  601. },
  602. getNormalLevel: function(index) {
  603. return [
  604. [],
  605. [7, 4],
  606. [11.1, 4],
  607. [7, 4],
  608. [11.1, 4],
  609. [7, 4],
  610. [11.1, 4],
  611. [7, 4]
  612. ][index];
  613. },
  614. changeSearch: function(status) {
  615. var i = status == 1 ? -400 : 0;
  616. var timer1 = setInterval(function() {
  617. i += (5 * status)
  618. $(".search-left").css("right", i + "px")
  619. if(status == 1 && i >= 0) {
  620. clearInterval(timer1)
  621. }
  622. if(status == -1 && i <= -400) {
  623. clearInterval(timer1)
  624. }
  625. }, 5)
  626. },
  627. goConsulting: function(){
  628. var otherCode = this.curDoc.code,
  629. otherName = this.curDoc.name,
  630. planDetailId = this.planId;
  631. showInfoMessage('请从“消息-患者消息列表”中查看患者的康复咨询记录')
  632. },
  633. //邀请视频聊天
  634. openVideoChat: function(otherDoc){
  635. var vm = this;
  636. var loading = layer.load(0);
  637. var participants = []
  638. var participantsMobile = {}
  639. var docInfo = JSON.parse(localStorage.docInfo);
  640. //发起人
  641. participants.push({mobile: docInfo.mobile, name: docInfo.name, sex: docInfo.sex==1? 1 : 2, birthdate: "", level: 3, hospital_name: docInfo.hospitalName, idcard: ""});
  642. participantsMobile[docInfo.mobile] = 1;
  643. if(otherDoc){
  644. //被邀请人
  645. participants.push({
  646. mobile: otherDoc.doctorMobile,
  647. name: otherDoc.doctorName,
  648. sex: otherDoc.doctorSex==1? 1 : 2,
  649. birthdate: "",
  650. level: 3,
  651. hospital_name: otherDoc.doctorHospitalName,
  652. idcard: otherDoc.doctorIdcard})
  653. participantsMobile[otherDoc.doctorMobile] = 0;
  654. }
  655. videoChatAPI.addDoctor({participants : JSON.stringify(participants)}).then(function(res){
  656. if(res.status == 200){
  657. videoChatAPI.sessions({
  658. sessionId: httpRequest.uuid(24, 16),
  659. sessionType: 4,
  660. sessionName: vm.planInfo.patientName +"的远程门诊",
  661. participants: JSON.stringify(participantsMobile),
  662. videoconferencing: 1,
  663. idcard: vm.planInfo.idcard
  664. }).then(function(res1){
  665. layer.close(loading)
  666. if(res1.status == 200){
  667. layer.msg("发起会话成功",{icon:6});
  668. } else{
  669. layer.msg("发起会话失败",{icon:5});
  670. }
  671. }).catch(function(){
  672. layer.close(loading)
  673. layer.msg("系统繁忙",{icon:5});
  674. })
  675. }else{
  676. layer.close(loading)
  677. layer.msg(res.msg,{icon:5});
  678. }
  679. }).catch(function(){
  680. layer.close(loading)
  681. layer.msg("系统繁忙",{icon:5});
  682. })
  683. }
  684. },
  685. watch:{
  686. tabStatus:function(){
  687. this.goToLoadData();
  688. }
  689. }
  690. })
  691. }();