rehabilitation_management.js 23 KB

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