rehabilitation_management.js 23 KB

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