123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929 |
- !(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: []
- },
- 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(
- '<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>',
- {
- 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, 01, 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) {
- 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 })
- })
- }
- },
- watch: {
- tabStatus: function () {
- this.goToLoadData()
- }
- }
- })
- })()
|