rehabilitation_management.js 22 KB

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