!(function () {
var httpData = GetRequest()
var currentGMT = new Date() //当前时间GMT
var xuetangDuring = ['', '早餐前', '早餐后', '午餐前', '午餐后', '晚餐前', '晚餐后', '睡前']
var normalLevel = [[], [7, 4], [11.1, 4], [7, 4], [11.1, 4], [7, 4], [11.1, 4], [7, 4]]
var docInfo = JSON.parse(localStorage.wlyyAgent)
function showSuccessMessage(msg) {
layer.msg(msg, {
icon: 1
})
}
function showErrorMessage(msg) {
layer.msg(msg, {
icon: 5
})
}
function showWarningMessage(msg) {
layer.msg(msg, {
icon: 2
})
}
function showInfoMessage(msg) {
layer.msg(msg, {
icon: 6
})
}
top.rehabilitationVue = new Vue({
el: '#app',
data: {
ynow: currentGMT.getFullYear(), //年份
mnow: currentGMT.getMonth(), //月份(比实际少一个月---0开始至11)
dnow: currentGMT.getDate(), //当前日
currentDay: null, //带中文格式的当前年月
currentDayForEn: null, //不带中文格式年月日2018/10/01如果写成/的话 转换成时间戳会变成北京时间8点
calendarData: [], //日历数据
loginDoctor: JSON.parse(localStorage.getItem('wlyyAgent')),
timeAxisData: [], //时间轴数据
__Data: [], //当前的年月(日历)
__xData: [], //当前的年月(时间轴)
isFastSearch: false, // 是否是快速查找任务
status: '', //任务状态(0未完成,1已完成,2已预约)
searchTask: '', //快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访,5、复诊)
searchTaskName: '全部', //快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访,5、复诊)
planId: httpData['planId'],
patientCode: httpData['patientCode'],
taskArr: [
{ code: '', name: '全部' },
{ code: 2, name: '康复咨询' },
{ code: 4, name: '上门服务' },
{ code: 1, name: '电话/短信关怀' },
{ code: 3, name: '健康监测' },
{ code: 5, name: '康复指导' },
{ code: 6, name: '康复随访' },
{ code: 7, name: '康复复诊' }
],
statusArr: [
{ code: '', name: '全部' },
{ code: 0, name: '未完成' },
{ code: 1, name: '已完成' },
{ code: 2, name: '已预约' }
],
curTask: '', //快速查找是否点击了搜索按钮
curTaskName: '', //快速查找是否点击了搜索按钮
tabStatus: null,
planInfo: {},
docList: [],
diagnosisInformation: null,
searchData: [], // 搜索计划安排(去年、今年、明年)
medicalRecordsList: [], //病历列表
limitlessItems: [],
showServerItemDetail: false,
serverItemInfo: undefined,
islimit: false,
scList: [],
lastPlan: null
},
mounted: function () {
if (!this.planId) {
layer.msg('未传入计划id(planId)', { icon: 2 })
} else {
this.tabStatus = 1
}
this.planSchedule()
// this.serviceDoctorList();//获取服务医生列表
this.selectPlanServerDoctor() //获取服务医生列表
this.bindEvents()
// 获取最新的诊疗信息1条
this.findDiagnosisInformationByPlanId()
},
methods: {
gotoCheck: function () {
var obj = {
patientName: this.planInfo.patientName,
patientCode: this.planInfo.patientCode
}
window.location.href = '../../jbsc/html/statistics.html?scListItem=' + encodeURIComponent(JSON.stringify(obj))
},
view: function (code) {
var vm = this
layer.open({
type: 2,
// offset: ['100px'], //右下角弹出
area: ['568px', '100%'],
shade: 0.5,
title: '查看筛选结果',
fixed: true, //不固定
maxmin: true,
closeBtn: 1,
shift: 5,
shadeClose: false, //点击遮罩关闭层
content: '../../jbsc/html/view_screening_results.html?isView=true&resultCode=' + code
})
},
gotoSc: function () {
top.layer.open({
type: 2,
area: ['820px', '648px'],
shade: 0.5,
title: 'ASCVD风险评估',
fixed: true, //不固定
maxmin: true,
closeBtn: 1,
shift: 5,
shadeClose: false, //点击遮罩关闭层
content: `../../jbsc/html/questionnaire.html?fliter_code=6bcd306aaafb4e4381071346d86fadbb1&fliter_title=ASCVD风险评估&resident_code=${this.planInfo.patientCode}&resident_name=${this.planInfo.patientName}&sex=${this.planInfo.sex}&age=${this.planInfo.age}&idcard=${this.planInfo.idcard}&mobile=${this.planInfo.mobile}&surveyStatus=2&noswitch=1`
})
},
getList: function () {
var vm = this
rehaAPI
.getList({
doctor: docInfo.code,
diseaseType: vm.planInfo.disease,
type: '',
patientName: '',
patientCode: this.patientCode,
isDanger: '',
pageNo: 1,
pageSize: 1,
filterType: 1,
isAscvd: vm.planInfo.disease == '3' ? 1 : ''
})
.then(function (res) {
vm.scList = res.data
})
},
// 刷新
refresh: function () {
this.planSchedule()
this.timeAxis()
},
// 获取服务医生列表
selectPlanServerDoctor: function () {
var vm = this,
params = {
planId: vm.planId
}
rehaAPI.selectPlanServerDoctor(params).then(function (res) {
if (res.status == 200) {
vm.docList = res.data
} else {
layer.msg(res.msg, { icon: 5 })
}
})
},
//获取计划表
planSchedule: function () {
var vm = this
var params = {
planId: this.planId,
patientCode: this.patientCode
}
rehaAPI.planSchedule(params).then(function (res) {
if (res.status == 200) {
vm.planInfo = res.data
vm.getList()
vm.planInfo.tagClass = 'tag-' + res.data.healthyConditionType
//patientImg:居民签名照/证件照,如果不为null的话说明居民已确认,显示康复完成明细
if (vm.planInfo.status == 2 && !vm.planInfo.patientImg) {
//任务全部完成时,显示完成提示框
vm.showCompleteDailog()
} else if (vm.planInfo.status == 2 && vm.planInfo.patientImg) {
//居民已确认计划完成
vm.tabStatus = 3
$('#framePage').attr('src', 'stop_special_service.html?planids=' + vm.planId + '&planStatus=' + vm.planInfo.status)
}
vm.selectByMedicalCode(res.data.medicalRecordsCode)
} else {
layer.msg(res.msg, { icon: 5 })
}
})
},
// 获取住院病历
selectByMedicalCode: function (medicalRecordsCode) {
var vm = this
var params = {
medical: medicalRecordsCode
}
rehaAPI.selectByMedicalCode(params).then(function (res) {
if (res.status == 200) {
vm.medicalRecordsList = res.data
} else {
showErrorMessage(res.msg)
}
})
},
// 查看住院病历详情
viewMedicalDetail: function (o) {
var vm = this
if (o.event) {
var loading = layer.load(0, { shade: false })
recoverAPI.getPatientAccetokenByIdcard({ idcard: vm.planInfo.idcard }).then(function (res) {
layer.close(loading)
if (res.status == 200) {
layer.open({
type: 2,
area: ['75%', '650px'],
shade: 0.5,
title: '住院病历',
closeBtn: 1,
shift: 5,
shadeClose: false, //点击遮罩关闭层
content: httpRequest.server + 'profileweb/#/zhuyuan?patientCode=' + res.data.patientCode + '&hospital=' + docInfo.hospital + '&event=' + o.event
})
} else {
showErrorMessage(res.msg)
}
})
} else {
layer.open({
type: 2,
area: ['600px', '600px'],
shade: 0.5,
title: '住院病历详情',
fixed: true, //不固定
maxmin: true,
closeBtn: 1,
shift: 5,
shadeClose: false, //点击遮罩关闭层
content: '../../rehabilitation/html/medical-records-detail.html?medicalRecordsCode=' + o.code
})
}
},
formatter: function (time) {
return new Date(time).format('yyyy-MM-dd')
},
// 获取最新的诊疗消息
findDiagnosisInformationByPlanId: function () {
var vm = this,
loading = layer.load(0, { shade: false }),
params = {
planId: vm.planId
}
recoverAPI.findDiagnosisInformationByPlanId(params).then(function (res) {
layer.close(loading)
if (res.status == 200) {
vm.diagnosisInformation = res.data
} else {
showErrorMessage(res.msg)
}
})
},
serviceDoctorList: function () {
var vm = this
rehaAPI.serviceDoctorList({ patientCode: this.patientCode }).then(function (res) {
if (res.status == 200) {
vm.docList = res.data
} else {
layer.msg(res.msg, { icon: 5 })
}
})
},
weiXinConfirmClick: function () {
var vm = this
rehaAPI.sendWxMsg({ planId: this.planId }).then(function (res) {
if (res.status == 200) {
layer.msg('发送成功,等待居民确认')
setTimeout(function () {
vm.tabStatus = 3
$('#framePage').attr('src', 'stop_special_service.html?planids=' + vm.planId + '&planStatus=' + vm.planInfo.status)
}, 1000)
} else {
layer.msg(res.msg, { icon: 5 })
}
})
},
setImgSrc: function (src) {
var str = httpRequest.getImgUrl(src)
return str
},
showCompleteDailog: function () {
layer.confirm(
'
',
{
btn: [],
area: ['400px', '340px'],
title: '完成提示'
},
function (index) {
// layer.close(index);
}
)
},
refreshPage: function () {
if (!this.planId) {
layer.msg('未传入计划id(planId)', { icon: 2 })
return
}
this.goToLoadData(true)
},
bindEvents: function () {
var vm = this
$('body')
.on('click', '.div-patient-comfirm', function () {
layer.closeAll()
vm.weiXinConfirmClick()
})
.on('click', '.div-patient-home', function () {
location.href = '../../recover/html/personal-manage.html?patientCode=' + vm.patientCode + '&planId=' + vm.planId
})
},
viewDetail: function (planids, type, item) {
var vm = this
if (!planids) {
layer.msg('无服务项', { icon: 5 })
return
}
console.log(planids, type, item,"item");
if (vm.planInfo.disease == '3' && vm.scList.length == 0 && item && item.code == '6' && vm.loginDoctor.doctorType != '1') {
this.$confirm('提示该居民近一年没有进行冠心病风险评估,请先进行评估,再进行随访登记', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
vm.gotoSc()
})
return false
}
if (type == 1) {
// 单个服务项
layer.open({
type: 2,
area: ['800px', '700px'],
shade: 0.5,
title: '服务项目内容',
fixed: true, //不固定
maxmin: true,
closeBtn: 1,
shift: 5,
shadeClose: false, //点击遮罩关闭层
content:
'../../rehabilitation/html/guide_the_message.html?planid=' +
planids +
'&pId=' +
httpData['planId'] +
'&patient=' +
vm.patientCode +
'&patientName=' +
vm.planInfo.patientName,
end: function () {
vm.goToLoadData(true)
}
})
return
}
layer.open({
// 康复计划的所有服务项
type: 2,
area: ['800px', '700px'],
shade: 0.5,
title: '服务项目内容',
fixed: true, //不固定
maxmin: true,
closeBtn: 1,
shift: 5,
shadeClose: false, //点击遮罩关闭层
content:
'../../rehabilitation/html/service_item_content.html?planids=' +
planids +
'&planId=' +
httpData['planId'] +
'&patient=' +
vm.patientCode +
'&patientName=' +
vm.planInfo.patientName +
'&disease=' +
vm.planInfo.disease +
'&scLenght=' +
vm.scList.length,
end: function () {
vm.goToLoadData(true)
}
})
},
changeStatus: function (val) {
this.status = val.code
},
changeTask: function (val) {
this.searchTask = val.code
this.searchTaskName = val.name
},
monDetail: function () {
this.currentDay = this.ynow + '年' + (this.mnow + 1) + '月'
this.currentDayForEn = this.ynow + '/' + (this.mnow >= 9 ? this.mnow + 1 : '0' + (this.mnow + 1)) + '/' + (this.dnow >= 9 ? this.dnow : '0' + this.dnow)
},
is_leap: function (year) {
//判断是否为闰年
return year % 100 == 0 ? (res = year % 400 == 0 ? 1 : 0) : (res = year % 4 == 0 ? 1 : 0)
},
preMonth: function () {
//上一个月
if (this.mnow <= 0) {
this.mnow = 11
this.ynow = this.ynow - 1
} else {
this.mnow--
}
this.monDetail()
this.goToLoadData(true)
},
getPreMouth: function () {
var pMnow, pYnow
if (this.mnow <= 0) {
pMnow = 11
pYnow = this.ynow - 1
} else {
pMnow = this.mnow - 1
pYnow = this.ynow
}
var m_days = new Array(31, 28 + this.is_leap(pYnow), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) //每个月的天数
return {
days: m_days[pMnow],
date: pYnow + '-' + (++pMnow >= 10 ? pMnow : '0' + pMnow)
}
},
nextMonth: function () {
//下一个月
if (this.mnow >= 11) {
this.mnow = 0
this.ynow = this.ynow + 1
} else {
this.mnow++
}
this.monDetail()
this.goToLoadData(true)
},
getNextMouth: function () {
var nMnow, nYnow
if (this.mnow >= 11) {
nMnow = 0
nYnow = this.ynow + 1
} else {
nMnow = this.mnow + 1
nYnow = this.ynow
}
var m_days = new Array(31, 28 + this.is_leap(nYnow), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) //每个月的天数
return {
days: m_days[nMnow],
date: nYnow + '-' + (++nMnow >= 10 ? nMnow : '0' + nMnow)
}
},
goToLoadData: function (flag) {
//flag是否更新数据
this.tabStatus == 1 && (!this.calendarData.length || flag) && this.calendar()
this.tabStatus == 2 && (!this.timeAxisData.length || flag) && this.timeAxis()
// this.changeSearch(-1)
},
calendar: function () {
var nlstr = new Date(this.ynow, this.mnow, 1) //当月第一天
var firstday = nlstr.getDay() - 1 //第一天星期几,默认是周日 我们改成周一
firstday = firstday == -1 ? 6 : firstday //如果是-1,说明当月的第一天是周日
var m_days = new Array(31, 28 + this.is_leap(this.ynow), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) //每个月的天数
var tr_str = Math.ceil((m_days[this.mnow] + firstday) / 7) //当前月天数+第一天是星期几的数值 获得 表格行数
var c_days = m_days[this.mnow] //当前月份的天数
var p_arr = this.getPreMouth()
var n_arr = this.getNextMouth()
var i, k, idx, date_str
var dataArr = [] //天数/年月
for (i = 0; i < tr_str; i++) {
//表格的行
for (k = 0; k < 7; k++) {
//表格每行的单元格
idx = i * 7 + k //单元格自然序列号
date_str = idx - firstday + 1 //计算日期
var __ym
if (date_str <= 0) {
//过滤无效日期(小于等于零的、大于月总天数的)
date_str = date_str + p_arr['days'] //当前日期+上个月的天数就是上个月的日期
__ym = p_arr['date']
} else if (date_str > c_days) {
date_str = date_str - c_days //下个月的日期就是这个月的天数-当月的天数
__ym = n_arr['date']
} else {
__ym = this.ynow + '-' + (this.mnow >= 9 ? '' : '0') + (this.mnow + 1)
}
dataArr.push({
day: date_str,
date: __ym
})
}
}
this.__Data = dataArr
this.monDetail()
this.calenderPlanDetail()
},
daysSort: function (arr) {
var getArr = JSON.parse(JSON.stringify(arr)),
returnArr = []
for (var i = 1; i < 31; i++) {
for (var j = 0, len = getArr.length; j < len; j++) {
var stri = i > 9 + '' ? i : '0' + i
if (getArr[j].day == stri) {
returnArr.push(getArr[j])
getArr.splice(j, 1)
break
}
}
}
return returnArr
},
// 日历有计划数据处理
planHandleData: function (data, day, mounth) {
var item = data
item.day = day
if (mounth) {
item.mounth = mounth
}
var finishFlag = false
var sFlag = false
var fFlag = false
if (item.specialist) {
if (item.specialist.all == item.specialist.finish) {
sFlag = true
}
} else {
sFlag = true
}
if (item.family) {
if (item.family.all == item.family.finish) {
fFlag = true
}
} else {
fFlag = true
}
finishFlag = sFlag && fFlag
item.finishFlag = finishFlag
return item
},
// 日历请求
calenderPlanDetail: function () {
var vm = this
var __days = vm.__Data
var lastDay = __days.concat().pop().day
lastDay = lastDay > 9 ? lastDay : '0' + lastDay
if (vm.searchTask != '' || vm.status != '') {
vm.isFastSearch = true
} else {
vm.isFastSearch = false
}
var params = {
executeStartTime: vm.isFastSearch ? '' : __days[0].date + '-' + __days[0].day + ' 00:00:00', //日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
executeEndTime: vm.isFastSearch ? '' : __days.concat().pop().date + '-' + lastDay + ' 23:59:59', //日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
planId: vm.planId, //计划id
searchTask: vm.searchTask, //快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访)
status: vm.status //任务状态(0未完成,1已完成,2已预约)
}
rehaAPI.calendarPlanDetail(params).then(function (res) {
vm.curTask = vm.searchTask
vm.curTaskName = vm.searchTaskName
vm.calendarData = []
var list = []
if (res.status == 200) {
var data = res.data
// 快速查找
if (vm.isFastSearch) {
vm.searchData = []
var searchData0 = [],
searchData1 = [],
searchData2 = []
for (var setM = 1; setM <= 12; setM++) {
var _setM = setM > 9 ? setM : '0' + setM,
_setY = new Date().getFullYear()
var data0 = [],
data1 = [],
data2 = []
for (var i in data) {
var getY = i.split('-')[0],
getM = i.split('-')[1],
getD = i.split('-')[2]
// 去年
if (_setY - 1 == getY && _setM == getM) {
var item = vm.planHandleData(data[i], getD, getM)
data0.push(item)
data.length && data.splice(i, 1)
} else if (_setY == getY && _setM == getM) {
// 今年
var item = vm.planHandleData(data[i], getD, getM)
data1.push(item)
data.length && data.splice(i, 1)
} else if (_setY + 1 == getY && _setM == getM) {
// 明年
var item = vm.planHandleData(data[i], getD, getM)
data2.push(item)
data.length && data.splice(i, 1)
}
}
if (data0.length) {
var dataSort = vm.daysSort(data0)
var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
for (var i = 0; i < 7 - addlen; i++) {
dataSort.push({
noService: true
})
}
searchData0.push(dataSort)
}
if (data1.length) {
var dataSort = vm.daysSort(data1)
var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
for (var i = 0; i < 7 - addlen; i++) {
dataSort.push({
noService: true
})
}
searchData1.push(dataSort)
}
if (data2.length) {
var dataSort = vm.daysSort(data2)
var addlen = (dataSort.length + 1) % 7 ? (dataSort.length + 1) % 7 : 7
for (var i = 0; i < 7 - addlen; i++) {
dataSort.push({
noService: true
})
}
searchData2.push(dataSort)
}
}
if (searchData0.length) {
vm.searchData.push(searchData0)
}
if (searchData1.length) {
vm.searchData.push(searchData1)
}
if (searchData2.length) {
vm.searchData.push(searchData2)
}
return false
}
// 正常日历
var _currentTimeStamp = +new Date(new Date().setHours(0, 0, 0, 0))
for (var i in __days) {
var _key = __days[i].date + '-' + (__days[i].day > 9 ? __days[i].day : '0' + __days[i].day)
var item = {
noService: true,
day: __days[i].day
}
for (var j in data) {
if (_key == j) {
item = vm.planHandleData(data[j], __days[i].day)
data.length && data.splice(j, 1)
break
}
}
var thatTime = +new Date(_key) - 8 * 60 * 60 * 1000
var future = _currentTimeStamp > thatTime ? 0 : _currentTimeStamp == thatTime ? 1 : 2
item.future = future
list.push(item)
// vm.calendarData.push(item);
}
vm.calendarData = _.chunk(list, 7)
}
})
},
// 时间轴请求
timeAxis: function () {
var m_days = new Array(31, 28 + this.is_leap(this.ynow), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) //每个月的天数
var c_days = m_days[this.mnow] //当前月份的天数
var __ym = this.ynow + '-' + (this.mnow >= 9 ? '' : '0') + (this.mnow + 1)
var dataArr = [] //天数/年月
for (; c_days > 0; c_days--) {
dataArr.push({
day: c_days,
date: __ym
})
}
this.__xData = dataArr
this.monDetail()
this.calendarPlanDetailList()
this.calendarPlanDetailItems()
},
//时间轴请求
calendarPlanDetailList: function () {
var vm = this
var __days = vm.__xData
var lastDay = __days.concat().pop().day
lastDay = lastDay > 9 ? lastDay : '0' + lastDay
var params = {
executeEndTime: __days[0].date + '-' + __days[0].day + ' 23:59:59', //日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
executeStartTime: __days.concat().pop().date + '-' + lastDay + ' 00:00:00', //日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
planId: vm.planId, //计划id
searchTask: vm.searchTask, //快速查找任务:(1、我的任务,2、随访,3、复诊,4、健康教育)
status: vm.status //任务状态(0未完成,1已完成,2已预约)
}
rehaAPI.calendarPlanDetailList(params).then(function (res) {
if (res.status == 200) {
// var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
var list =
_.map(res.data || {}, function (o) {
// var _time=o.executeTime.split(' ');
// var thatTime=+new Date(_time[0]);
// var future=_currentTimeStamp>thatTime?0:(_currentTimeStamp==thatTime?1:2);
// (o.status==0 && _currentTimeStamp>thatTime) && (future=-1)
// var _html=o.status==2?'预':(future==-1?'逾':'');
// _html=future==1?'今':_html;
// if(_html=='预') future=3;
var _time = o.executeTime.split(' ')
var _html = ''
var d = new Date(o.execute_time)
if (d.format('yyyy-MM-dd') == new Date().format('yyyy-MM-dd')) {
o.firstSort = '1'
future = 1
_html = '今'
if (o.status) {
o.secondSort = '2'
} else {
o.secondSort = '1'
}
} else if (d > new Date()) {
o.firstSort = '3'
future = 2
if (o.status) {
o.secondSort = '2'
} else {
o.secondSort = '1'
}
} else {
o.firstSort = '2'
future = 0
if (o.status == 0) {
future = -1
_html = '逾'
o.secondSort = '1'
} else {
o.secondSort = '2'
}
}
o.html = _html
o.date = _time[0]
o.time = _time[1]
o.future = future
o.doctorName = o.doctor_name
o.hospitalName = o.hospital_name
return o
}) || []
var nowTime = new Date().getTime()
vm.timeAxisData = _.sortBy(list, function (o) {
return o.firstSort + o.secondSort + nowTime / o.execute_time
})
}
})
},
viewServerItemsDetail: function (o) {
if (o.code == '2') {
showInfoMessage('请从“消息-患者消息列表”中查看患者的康复咨询记录')
return
}
if (o.code == '3') {
layer.open({
type: 2,
area: ['700px', '700px'],
shade: 0.5,
title: '健康记录',
fixed: true, //不固定
maxmin: true,
closeBtn: 1,
// shift: 5,
shadeClose: false, //点击遮罩关闭层
content: '../html/healthMonitor.html?patient=' + this.patientCode
})
return
}
this.serverItemInfo = o
this.showServerItemDetail = true
this.islimit = o.frequency_code ? true : false
},
calendarPlanDetailItems: function () {
var vm = this
var __days = vm.__xData
var lastDay = __days.concat().pop().day
lastDay = lastDay > 9 ? lastDay : '0' + lastDay
var params = {
executeEndTime: __days[0].date + '-' + __days[0].day + ' 23:59:59', //日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
executeStartTime: __days.concat().pop().date + '-' + lastDay + ' 00:00:00', //日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
planId: vm.planId, //计划id
searchTask: vm.searchTask, //快速查找任务:(1、我的任务,2、随访,3、复诊,4、健康教育)
status: vm.status //任务状态(0未完成,1已完成,2已预约)
}
rehaAPI.calendarPlanDetailItems(params).then(function (res) {
if (res.status == 200) {
vm.lastPlan = res.json
var arr = []
$.each(res.data, function (i, o) {
if (o.code == '3' && o.type) {
if (o.type == 2) {
o.levelClazz = vm.getLevelClazz(o.value1, 139, 90) || vm.getLevelClazz(o.value2, 89, 60)
o.levelClazz1 = vm.getLevelClazz(o.value1, 139, 90)
o.levelClazz2 = vm.getLevelClazz(o.value2, 89, 60)
o.levelClazz3 = vm.getLevelClazz(o.value3, 100, 60)
} else {
var num = parseInt(o.value2)
var max = normalLevel[num][0],
min = normalLevel[num][1]
o.levelClazz1 = vm.getLevelClazz(o.value1, max, min)
o.levelName = xuetangDuring[o.value2]
}
}
arr.push(o)
})
vm.limitlessItems = arr
}
})
},
getLevelClazz: function (value, max, min) {
if (!value || (!max && !min)) {
return ''
}
var value = parseFloat(value)
if (value < min) {
return 'low'
} else if (value > max) {
return 'high'
} else {
return ''
}
},
getNormalLevel: function (index) {
return [[], [7, 4], [11.1, 4], [7, 4], [11.1, 4], [7, 4], [11.1, 4], [7, 4]][index]
},
confirmSearch: function () {
this.changeSearch(-1)
this.goToLoadData(true)
},
changeSearch: function (status) {
var i = status == 1 ? -400 : 0
var timer1 = setInterval(function () {
i += 5 * status
$('.search-left').css('right', i + 'px')
if (status == 1 && i >= 0) {
clearInterval(timer1)
}
if (status == -1 && i <= -400) {
clearInterval(timer1)
}
}, 5)
},
//邀请视频聊天
openVideoChat: function (otherDoc) {
var vm = this
var loading = layer.load(0)
var participants = []
var participantsMobile = {}
//发起人
participants.push({ mobile: docInfo.mobile, name: docInfo.name, sex: docInfo.sex == 1 ? 1 : 2, birthdate: '', level: 3, hospital_name: docInfo.hospitalName, idcard: '' })
participantsMobile[docInfo.mobile] = 1
if (otherDoc) {
//被邀请人
participants.push({
mobile: otherDoc.doctorMobile,
name: otherDoc.doctorName,
sex: otherDoc.doctorSex == 1 ? 1 : 2,
birthdate: '',
level: 3,
hospital_name: otherDoc.doctorHospitalName,
idcard: otherDoc.doctorIdcard
})
participantsMobile[otherDoc.doctorMobile] = 0
}
videoChatAPI
.addDoctor({ participants: JSON.stringify(participants) })
.then(function (res) {
if (res.status == 200) {
videoChatAPI
.sessions({
sessionId: httpRequest.uuid(24, 16),
sessionType: 4,
sessionName: vm.planInfo.patientName + '的远程门诊',
participants: JSON.stringify(participantsMobile),
videoconferencing: 1,
idcard: vm.planInfo.idcard
})
.then(function (res1) {
layer.close(loading)
if (res1.status == 200) {
layer.msg('发起会话成功', { icon: 6 })
} else {
layer.msg('发起会话失败', { icon: 5 })
}
})
.catch(function () {
layer.close(loading)
layer.msg('系统繁忙', { icon: 5 })
})
} else {
layer.close(loading)
layer.msg(res.msg, { icon: 5 })
}
})
.catch(function () {
layer.close(loading)
layer.msg('系统繁忙', { icon: 5 })
})
},
toLastPlan(){
window.location.href = `${window.location.pathname}?planId=${this.lastPlan.id}&patientCode=${this.patientCode}`
}
},
watch: {
tabStatus: function () {
this.goToLoadData()
}
}
})
})()