|
@ -0,0 +1,916 @@
|
|
|
|
|
|
var currentGMT=new Date();//当前时间GMT
|
|
|
function showSuccessMessage(msg) {
|
|
|
layer.msg(msg, {
|
|
|
icon: 1
|
|
|
})
|
|
|
}
|
|
|
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
|
|
|
})
|
|
|
}
|
|
|
function closeFollowUpLayer(planDetaiId, relationCode){
|
|
|
_vm.closeAllLayer('创建随访计划', planDetaiId, 6, relationCode)
|
|
|
}
|
|
|
function closeKFZDlayer(planDetaiId){
|
|
|
_vm.closeAllLayer('发送康复指导', planDetaiId, 5)
|
|
|
}
|
|
|
|
|
|
var _vm
|
|
|
Vue.component('server-items-detail', {
|
|
|
template: '<div class="p15 ui-grid ui-grid-vertical" style="height:calc(100%);position: relative;">\
|
|
|
<div class="icon-group">\
|
|
|
<i class="icon-edit el-icon-edit-outline mr15"></i>\
|
|
|
<i class="icon-close el-icon-close" @click="onClose"></i>\
|
|
|
</div>\
|
|
|
<div class="c-t-center c-f18 c-333 mt15">服务内容-{{serveriteminfo.name}}</div>\
|
|
|
<div class="c-t-center c-f17 c-666 mt10">{{patientname}}患者{{serveriteminfo.name}}计划</div>\
|
|
|
<div class="c-333 ptb10 c-f17 mt10">指导留言</div>\
|
|
|
<div class="c-f14 c-666" v-if="!message.isImg">{{message.content}}</div>\
|
|
|
<div class="mt10" v-else><img :src="message.content" @click="previewImg(message.content)" style="width:60px;height:60px;" :data-preview-src="message.content" data-preview-group="1"/></div>\
|
|
|
<div v-if="islimit" class="mtb15 ui-grid">\
|
|
|
<div class="ui-col-1">\
|
|
|
<i class="icon icon-prev icon-20" @click="preMonth"></i>\
|
|
|
<span class="currentDay">{{currentDay}}</span>\
|
|
|
<i class="icon icon-next icon-20" @click="nextMonth"></i></span>\
|
|
|
</div>\
|
|
|
<div class="pull-right switch-list" style="text-align:center">\
|
|
|
<span class="rili" :class="{active:(tabStatus==1)}" @click="tabStatus=1"><i class="icon icon-rili icon-20"></i></span>\
|
|
|
<span class="shijianzhou" :class="{active:(tabStatus==2)}" @click="tabStatus=2"><i class="icon icon-liebiao icon-20"></i></span>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
<div v-if="islimit&&tabStatus==1" class="ui-col-1" style="overflow: hidden; overflow-y: scroll;">\
|
|
|
<div class="calendar-week">\
|
|
|
<div class="flex-box text-center">\
|
|
|
<div class="flex-box-item">周一</div>\
|
|
|
<div class="flex-box-item">周二</div>\
|
|
|
<div class="flex-box-item">周三</div>\
|
|
|
<div class="flex-box-item">周四</div>\
|
|
|
<div class="flex-box-item">周五</div>\
|
|
|
<div class="flex-box-item">周六</div>\
|
|
|
<div class="flex-box-item">周日</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
<div class="calendar-days">\
|
|
|
<div v-for="items in calendarData" class="flex-box">\
|
|
|
<div class="calendar-day" v-for="item in items" @click="viewDetail(item.planDetailIds)" :is-future="item.future">\
|
|
|
<span class="day-number">{{item.day}}</span>\
|
|
|
<div class="task-icon">\
|
|
|
<i v-if="item.myTaskFlag" class="icon icon-flag icon-20"></i>\
|
|
|
<i v-if="item.finishFlag" class="icon icon-check"></i>\
|
|
|
</div>\
|
|
|
<div class="coloured-box">\
|
|
|
<span v-if="item.specialist" class="coloured-ribbon coloured-ribbon-blue">专<br />科</span>\
|
|
|
<span v-if="item.family" class="coloured-ribbon coloured-ribbon-green">家<br />医</span>\
|
|
|
</div>\
|
|
|
<div class="progress-box">\
|
|
|
<div class="progress" :style="{opacity:item.specialist?\'1\':\'0\'}">\
|
|
|
<span>{{(item.specialist && item.specialist.finish)}}/{{(item.specialist && item.specialist.all)}}</span>\
|
|
|
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" :style="{width: (item.specialist?(item.specialist.finish/item.specialist.all):0)*100+\'%\'}"></div>\
|
|
|
</div>\
|
|
|
<div class="progress" :style="{opacity:item.family?\'1\':\'0\'}">\
|
|
|
<span>{{(item.family && item.family.finish)}}/{{(item.family && item.family.all)}}</span>\
|
|
|
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="2" aria-valuemin="0" aria-valuemax="100" :style="{width: (item.family?(item.family.finish/item.family.all):0)*100+\'%\'}"></div>\
|
|
|
</div>\
|
|
|
<p v-if="!item.noService" class="mb0 f12" :class="{\'visibility-hide\':!curTask}" style="line-height: 1;">{{curTaskName || \' \'}}</p>\
|
|
|
</div>\
|
|
|
<p v-if="item.noService" class="no-server">无服务项</p>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
<div v-show="tabStatus==2" class="ui-col-1 mt10" style="overflow-y: auto">\
|
|
|
<div class="time-axis">\
|
|
|
<div>\
|
|
|
<table class="table">\
|
|
|
<tr>\
|
|
|
<th style="padding-right: 50px;text-align: right;">时间</th>\
|
|
|
<th>项目</th>\
|
|
|
<th>执行人员</th>\
|
|
|
<th>执行地点</th>\
|
|
|
<th class="text-center">相关记录</th>\
|
|
|
<th class="text-center">状态</th>\
|
|
|
</tr>\
|
|
|
<tr v-for="item in timeAxisData" :is-future="item.future">\
|
|
|
<td class="time text-right time-box">\
|
|
|
<p class="mb5">{{item.date}}</p>\
|
|
|
<p class="mb0">{{item.time}}</p>\
|
|
|
<span class="cur-status">{{item.html}}</span>\
|
|
|
</td>\
|
|
|
<td class="project-name mw400">\
|
|
|
<p class="mb5">{{item.name}}</p>\
|
|
|
<p class="ellipsis mb0">{{item.content}}</p>\
|
|
|
</td>\
|
|
|
<td class="executor">{{item.doctorName}}</td>\
|
|
|
<td class="place-of-execution">{{item.hospitalName}}</td>\
|
|
|
<td class="view-task" @click="onViewDetail(item,1)">查看</td>\
|
|
|
<td class="task-status" :class="item.future==-1?\'c-ff3b30\':(item.status==0?\'c-666\':\'\')">{{item.status==0?\'未完成\':(item.status==1?\'已完成\':\'已预约\')}}</td>\
|
|
|
</tr>\
|
|
|
<tr v-if="!timeAxisData.length">\
|
|
|
<td colspan="6" class="f16 ptb10 text-center">\
|
|
|
<img src="../../../images/wushuju_img.png" class="mt50"/>\
|
|
|
<p class="c-666">暂无数据</p>\
|
|
|
</td>\
|
|
|
</tr>\
|
|
|
</table>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
<div class="c-t-center mt15">\
|
|
|
<button v-if="service.isZk&&service.executeDoctorCode!=docInfo.uid" class="btn btn-12b7f5" @click="zdly(service)">指导留言</button>\
|
|
|
<button v-else-if="!service.isZk&&service.executeDoctorCode==docInfo.uid" class="btn btn-12b7f5" @click="zdly(service)">查看留言</button>\
|
|
|
<button v-if="!service.isZk&&serveriteminfo.code==\'1\'" class="btn btn-yuyue" @click="addCompleteRecord()">添加完成记录</button>\
|
|
|
<button v-if="!service.isZk&&serveriteminfo.code==\'4\'" class="btn btn-yuyue" @click="sendSpecialistWeixinMessage(planDetaiId,4)">发送提醒</button>\
|
|
|
<button v-if="!service.isZk&&serveriteminfo.code==\'5\'" class="btn btn-yuyue" @click="kfzd()">发送康复指导</button>\
|
|
|
<button v-if="!service.isZk&&serveriteminfo.code==\'6\'" class="btn btn-yuyue" @click="excuteServerItem(6)">创建随访计划</button>\
|
|
|
<button v-if="!service.isZk&&serveriteminfo.code==\'7\'" class="btn btn-yuyue" @click="sendSpecialistWeixinMessage(planDetaiId,7)">发送提醒</button>\
|
|
|
<button v-if="!service.isZk&&serveriteminfo.code==\'7\'" class="btn btn-12b7f5" @click="qwapp">代预约</button>\
|
|
|
</div>\
|
|
|
<div id="completeRecord" style="display: none; padding: 15px 15px 0;">\
|
|
|
<div class="note-info pt10">\
|
|
|
<p class="f14 c-333">服务完成笔记</p>\
|
|
|
<textarea class="form-control" style="resize: none;" rows="4" placeholder="可备注您的服务记录" v-model="node"></textarea>\
|
|
|
</div>\
|
|
|
<div class="note-info ptb10">\
|
|
|
<p class="f14 c-333">相关记录</p>\
|
|
|
<ul class="upload-box">\
|
|
|
<li class="flex-box" v-for="(img,index) in upImgs">\
|
|
|
<div class="upload-img-box">\
|
|
|
<img :src="img.baseUrl" @click="previewImg(img.baseUrl)"/>\
|
|
|
</div>\
|
|
|
<a class="delete-img" @click="deleteImg(index)">×</a>\
|
|
|
</li>\
|
|
|
<li class="flex-box" v-if="upImgs.length<5">\
|
|
|
<span class="add-img">+</span>\
|
|
|
<input type="file" @change="upLoadImgToBase64" class="upload-img" />\
|
|
|
</li>\
|
|
|
</ul>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>',
|
|
|
props: ['patientname','patientcode', 'planid', 'serveriteminfo'],
|
|
|
data: function() {
|
|
|
return {
|
|
|
ynow: currentGMT.getFullYear(),//年份
|
|
|
mnow: currentGMT.getMonth(),//月份(比实际少一个月---0开始至11)
|
|
|
dnow: currentGMT.getDate(),//当前日
|
|
|
currentDay:null,//带中文格式的当前年月
|
|
|
calendarData:[],//日历数据
|
|
|
timeAxisData: [], //时间轴数据
|
|
|
tabStatus: 1,
|
|
|
title: '',
|
|
|
docInfo: JSON.parse(window.localStorage.getItem('wlyyAgent')),
|
|
|
upImgs: [],
|
|
|
upImgArr: [],
|
|
|
imgData: {
|
|
|
accept: 'image/gif, image/jpeg, image/png, image/jpg',
|
|
|
},
|
|
|
node: '',
|
|
|
layerIndex: undefined,
|
|
|
planDetaiId:'',
|
|
|
service:{
|
|
|
relationRecordImg:{},
|
|
|
messageList:{},
|
|
|
},
|
|
|
message:{isImg:false,content:""},
|
|
|
KFZDlayerIndex: undefined,
|
|
|
islimit: false
|
|
|
}
|
|
|
},
|
|
|
watch:{
|
|
|
tabStatus:function(){
|
|
|
if(this.islimit){
|
|
|
this.goToLoadData(true);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
mounted: function() {
|
|
|
_vm = this
|
|
|
this.initData()
|
|
|
},
|
|
|
methods: {
|
|
|
initData: function(){
|
|
|
var vm = this
|
|
|
this.planDetaiId = this.serveriteminfo.id
|
|
|
this.getServiceItem()
|
|
|
},
|
|
|
getServiceItem: function() {
|
|
|
var vm = this;
|
|
|
var loadding = top.layer.load(0, {
|
|
|
shade: false
|
|
|
}); //0代表加载的风格,支持0-2
|
|
|
rehaAPI.serviceItem({
|
|
|
planDetailId: vm.planDetaiId
|
|
|
}).then(function(res) {
|
|
|
top.layer.close(loadding);
|
|
|
if(res.status == 200) {
|
|
|
vm.service = res.data;
|
|
|
var isZK=vm.docInfo.doctorType==1?true:false;
|
|
|
vm.service.isZK=isZK;
|
|
|
if(vm.service.isMyTask==1){//执行者
|
|
|
vm.service.isCK=true;//无法显示按钮
|
|
|
if(vm.docInfo.uid==vm.service.specialistDoctorCode){//说明我自己是创建者
|
|
|
vm.service.isCK=false;
|
|
|
vm.service.isCreate=true;
|
|
|
}
|
|
|
}else{
|
|
|
if(vm.docInfo.uid==vm.service.specialistDoctorCode){//说明我自己是创建者
|
|
|
vm.service.isCreate=true;
|
|
|
}
|
|
|
}
|
|
|
var messageIndex = _.findLastIndex(vm.service.messageList, {doctorType: 1});
|
|
|
if(messageIndex>-1){
|
|
|
var message = vm.service.messageList[messageIndex]
|
|
|
vm.message = vm.getContent(message.content,message.contentType)
|
|
|
}else{
|
|
|
vm.message.content = "无"
|
|
|
}
|
|
|
if(vm.service.frequencyCode){
|
|
|
vm.islimit = true
|
|
|
vm.calendar()
|
|
|
vm.monDetail()
|
|
|
} else {
|
|
|
vm.islimit = false
|
|
|
vm.tabStatus = 2
|
|
|
vm.selectByPlanDetaiId()
|
|
|
}
|
|
|
} else {
|
|
|
showErrorMessage(res.msg)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
closeAllLayer: function(name, planDetaiId, type, relationCode){
|
|
|
if(name=='预览康复指导'){
|
|
|
layer.close()
|
|
|
} else if(name=='创建随访计划'){
|
|
|
this.saveRehabilitationOperateRecord(planDetaiId, type, relationCode)
|
|
|
layer.close()
|
|
|
} else if(name=='发送康复指导'){
|
|
|
this.saveRehabilitationOperateRecord(planDetaiId, type)
|
|
|
layer.close(this.KFZDlayerIndex)
|
|
|
}
|
|
|
},
|
|
|
// 提醒患者 num 1康复指导2康复下转3复诊提醒4上门服务提醒5家签提醒
|
|
|
sendSpecialistWeixinMessage: function(planDetaiId, type){
|
|
|
var vm = this
|
|
|
var text = ''
|
|
|
var patientName = vm.patientname
|
|
|
var patientCode = vm.patientcode
|
|
|
if(type==4){ // 上门服务
|
|
|
text = '请问您是否确认提醒'+patientName+'居民预约上门护理服务?'
|
|
|
} else if(type==7){ // 康复复诊
|
|
|
text = '请问您是否确认提醒'+patientName+'居民进行复诊?'
|
|
|
}
|
|
|
var current=layer.confirm(text, {
|
|
|
btn: ['确定', '取消'],
|
|
|
title: "提示"
|
|
|
}, function (index) {
|
|
|
var _type = type == 4? 4:type==7?3:''
|
|
|
var loading = layer.load(0, {shade: false})
|
|
|
var params = {
|
|
|
patient: patientCode,
|
|
|
doctor: vm.docInfo.uid,
|
|
|
type: _type,
|
|
|
relationCode: planDetaiId,
|
|
|
planId: vm.planid
|
|
|
}
|
|
|
rehaAPI.sendSpecialistWeixinMessage(params).then(function(res){
|
|
|
layer.close(loading)
|
|
|
if(res.status == 200){
|
|
|
showSuccessMessage('提交成功!')
|
|
|
if(_type==3 || _type==4){ // 提醒患者后,即认为是已完成
|
|
|
vm.saveRehabilitationOperateRecord(planDetaiId, type)
|
|
|
}
|
|
|
} else {
|
|
|
showErrorMessage(res.msg)
|
|
|
}
|
|
|
})
|
|
|
layer.close(current); //再执行关闭
|
|
|
})
|
|
|
|
|
|
},
|
|
|
// 添加完成记录
|
|
|
addCompleteRecord: function(){
|
|
|
var vm = this
|
|
|
var detailId = this.planDetaiId
|
|
|
var type = vm.serveriteminfo.code
|
|
|
$("#completeRecord").css('display','block')
|
|
|
this.layerIndex = layer.open({
|
|
|
type: 1,
|
|
|
area: ['500px', '450px'],
|
|
|
shade: 0.5,
|
|
|
title: '添加完成记录',
|
|
|
btn: ['确定', '关闭'], //只是为了演示
|
|
|
shadeClose: false, //点击遮罩关闭层
|
|
|
content: $("#completeRecord"),
|
|
|
yes: function(){
|
|
|
vm.saveRehabilitationOperateRecord(detailId, 1)
|
|
|
layer.close(vm.layerIndex)
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
monDetail:function(){
|
|
|
this.currentDay = this.ynow + '年'+ (this.mnow + 1) +'月';
|
|
|
},
|
|
|
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();
|
|
|
},
|
|
|
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.calenderPlanDetail();
|
|
|
},
|
|
|
// 日历有计划数据处理
|
|
|
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.status == 0) {
|
|
|
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.serveriteminfo.code,//快速查找任务:(1、我的任务,2、健康教育,3、健康指导,4、随访)
|
|
|
status: null,//任务状态(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.calendarPlanDetailList();
|
|
|
},
|
|
|
//限频次 时间轴请求
|
|
|
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+' 00:00:00',//日历开始时间(格式:yyyy-MM-dd HH:mm:ss)
|
|
|
executeStartTime:(__days.concat()).pop().date+'-'+lastDay+' 23:59:59',//日历结束时间(格式:yyyy-MM-dd HH:mm:ss)
|
|
|
planId:vm.planid,//计划id
|
|
|
searchTask:vm.serveriteminfo.code, // 服务项
|
|
|
status: null, //任务状态(0未完成,1已完成,2已预约)
|
|
|
}
|
|
|
rehaAPI.calendarPlanDetailList(params).then(function(res){
|
|
|
if(res.status==200){
|
|
|
var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
|
|
|
vm.timeAxisData=_.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;
|
|
|
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;
|
|
|
})||[];
|
|
|
} else {
|
|
|
showErrorMessage(res.msg)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
//不限频次 时间轴请求
|
|
|
selectByPlanDetaiId: function(){
|
|
|
var vm = this
|
|
|
var params = {
|
|
|
planId: this.planid,
|
|
|
code: vm.serveriteminfo.code,
|
|
|
page: 1,
|
|
|
pagesize: 10000
|
|
|
}
|
|
|
rehaAPI.selectByPlanDetaiId(params).then(function(res){
|
|
|
if(res.status == 200){
|
|
|
var arr = []
|
|
|
if(res.data.list&&res.data.list.length>0){
|
|
|
var list = res.data.list
|
|
|
var _currentTimeStamp=+new Date(new Date().setHours(0, 0, 0, 0))
|
|
|
console.log('_currentTimeStamp=======', _currentTimeStamp)
|
|
|
arr=_.map(list||[],function(o){
|
|
|
var _time=o.completeTime.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;
|
|
|
o.html=_html
|
|
|
o.date=_time[0];
|
|
|
o.time=_time[1];
|
|
|
o.future=future;
|
|
|
return o;
|
|
|
})||[];
|
|
|
}
|
|
|
vm.timeAxisData = arr
|
|
|
} else {
|
|
|
showErrorMessage(res.msg)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
zdly: function(data) {
|
|
|
var vm = this
|
|
|
var otherCode, otherName;
|
|
|
var planDetailId = data.planDetaiId;
|
|
|
if(vm.docInfo.doctorType == 1) {
|
|
|
otherCode = data.familyDoctorCode;
|
|
|
otherName = data.familyDoctorName;
|
|
|
} else {
|
|
|
otherCode = data.specialistDoctorCode;
|
|
|
otherName = data.specialistDoctorName;
|
|
|
}
|
|
|
top.layer.open({
|
|
|
type: 2,
|
|
|
area: ['80%', '600px'],
|
|
|
shade: 0.5,
|
|
|
title: '指导留言',
|
|
|
fixed: true, //不固定
|
|
|
maxmin: true,
|
|
|
closeBtn: 1,
|
|
|
shift: 5,
|
|
|
shadeClose: false, //点击遮罩关闭层
|
|
|
content: '../../consulting/html/consulting.html?otherCode=' + otherCode + '&otherName=' + encodeURI(otherName) + '&planDetailId=' + planDetailId,
|
|
|
end: function() { // 未点击确定按钮,点击关闭按钮
|
|
|
vm.initData()
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//康复指导
|
|
|
kfzd:function(){
|
|
|
var vm=this
|
|
|
this.KFZDlayerIndex = layer.open({
|
|
|
type: 2,
|
|
|
// offset: ['100px'], //右下角弹出
|
|
|
area: ['660px', '650px'],
|
|
|
shade: 0.5,
|
|
|
title: '康复指导',
|
|
|
fixed: true, //不固定
|
|
|
maxmin: true,
|
|
|
closeBtn: 1,
|
|
|
shift: 5,
|
|
|
shadeClose: false, //点击遮罩关闭层
|
|
|
content:'../../rehabilitation/html/rehabilitation_guidance.html?patient='+vm.patientcode+'&planDetaiId='+vm.planDetaiId+'&planId='+vm.planid,
|
|
|
end: function() { // 未点击确定按钮,点击关闭按钮
|
|
|
vm.initData()
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
upLoadImgToBase64: function() {
|
|
|
var vm = this;
|
|
|
var img1 = event.target.files[0];
|
|
|
var reader = new FileReader();
|
|
|
var type = img1.type; //文件的类型,判断是否是图片
|
|
|
var size = img1.size; //文件的大小,判断图片的大小
|
|
|
if(this.imgData.accept.indexOf(type) == -1) {
|
|
|
alert('请选择我们支持的图片格式!');
|
|
|
return false;
|
|
|
}
|
|
|
if(size > 3145728) {
|
|
|
alert('请选择3M以内的图片!');
|
|
|
return false;
|
|
|
}
|
|
|
reader.readAsDataURL(img1);
|
|
|
reader.onload = function(e) {
|
|
|
vm.upImgs.push({
|
|
|
baseUrl: e.target.result
|
|
|
});
|
|
|
vm.upImgArr.push(img1);
|
|
|
vm.uploadImg(vm.upImgArr);
|
|
|
}
|
|
|
},
|
|
|
//上传图片
|
|
|
uploadImg: function(data) {
|
|
|
var vm = this;
|
|
|
var len = data.length;
|
|
|
if(len==0) {
|
|
|
return
|
|
|
} else {
|
|
|
var file = data[len - 1];
|
|
|
var formData = new FormData();
|
|
|
formData.append('file', file);
|
|
|
rehaAPI.upload(formData).then(function(res) {
|
|
|
if(res.status == 200) {
|
|
|
vm.upImgs[len - 1].img = res.data;
|
|
|
data.pop();
|
|
|
vm.$forceUpdate()
|
|
|
vm.uploadImg(data);
|
|
|
} else {
|
|
|
layer.msg(res.msg, {
|
|
|
icon: 5
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
saveRehabilitationOperateRecord:function(planDetailId, type, relationCode){
|
|
|
var vm=this
|
|
|
var patientName = vm.patientname
|
|
|
var patientCode = vm.patientcode
|
|
|
var _image = [];
|
|
|
for(var i in vm.upImgs) {
|
|
|
_image.push(vm.upImgs[i].img);
|
|
|
}
|
|
|
var params={
|
|
|
rehabilitationDetailId: planDetailId,
|
|
|
node: vm.node||'',
|
|
|
patientCode: patientCode,
|
|
|
doctorCode: vm.docInfo.uid,
|
|
|
relationRecordType: type,
|
|
|
relationRecordCode: '',
|
|
|
relationRecordImg: '',
|
|
|
status: 0
|
|
|
}
|
|
|
rehaAPI.saveRehabilitationOperateRecord({dataJson:JSON.stringify(params)}).then(function(res){
|
|
|
if(res.status==200){
|
|
|
if(type==1){
|
|
|
vm.updateNoteAndImageRehabilitationOperate(planDetailId)
|
|
|
}else if(type==6){
|
|
|
vm.updateRelationCodeByDetailId(planDetailId, relationCode)
|
|
|
} else {
|
|
|
vm.updateNoteAndImageRehabilitationOperate(planDetailId)
|
|
|
}
|
|
|
}else {
|
|
|
showErrorMessage(res.msg)
|
|
|
}
|
|
|
})
|
|
|
|
|
|
},
|
|
|
updateNoteAndImageRehabilitationOperate: function(planDetailId, relationCode) {
|
|
|
var vm = this;
|
|
|
var _image = [];
|
|
|
for(var i in vm.upImgs) {
|
|
|
_image.push(vm.upImgs[i].img);
|
|
|
}
|
|
|
var params = {
|
|
|
planDetailId: planDetailId,
|
|
|
node: vm.node||'',
|
|
|
image: JSON.stringify(_image)||''
|
|
|
}
|
|
|
if(relationCode){
|
|
|
params['relationCode'] = relationCode
|
|
|
}
|
|
|
var loadding = top.layer.load(0, {
|
|
|
shade: false
|
|
|
}); //0代表加载的风格,支持0-2
|
|
|
rehaAPI.updateNoteAndImageRehabilitationOperate(params).then(function(res) {
|
|
|
top.layer.close(loadding);
|
|
|
if(res.status == 200) {
|
|
|
vm.initData()
|
|
|
}else {
|
|
|
showErrorMessage(res.msg)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
onViewDetail: function(item, type){
|
|
|
var planids, recordId;
|
|
|
if(this.islimit){
|
|
|
planids = item.id
|
|
|
} else {
|
|
|
planids = item.id
|
|
|
recordId = item.recordId
|
|
|
}
|
|
|
this.viewDetail(planids,type, recordId)
|
|
|
},
|
|
|
viewDetail:function(planids,type, recordId){
|
|
|
var vm=this;
|
|
|
if(!planids){
|
|
|
layer.msg('无服务项',{icon:5})
|
|
|
return ;
|
|
|
}
|
|
|
if(type==1){ // 单个服务项
|
|
|
top.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+'&oprateType=1'+'&pId='+vm.planid+'&patient='+vm.patientcode+'&patientName='+vm.patientname+'&recordId='+recordId,
|
|
|
});
|
|
|
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='+vm.planid+'&patient='+vm.patientcode+'&patientName='+vm.patientname,
|
|
|
end:function(){
|
|
|
vm.goToLoadData(true);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
},
|
|
|
onClose: function(){
|
|
|
this.$emit('onclose')
|
|
|
},
|
|
|
qwapp:function(){
|
|
|
layer.msg('请前往app处理',{icon:5});
|
|
|
},
|
|
|
getContent: function(value,type) {
|
|
|
var res=value;
|
|
|
if(type==2 || type==9){
|
|
|
res = "<img src='"+httpRequest.getImgUrl(res)+"' width='100px'>";
|
|
|
}else if(type==3){
|
|
|
res = '【语音】';
|
|
|
}else if(type==19){
|
|
|
res = '【聊天记录】';
|
|
|
}else if(type==12){
|
|
|
res = '【视频】';
|
|
|
}
|
|
|
return res;
|
|
|
},
|
|
|
previewImg: function(url){
|
|
|
imgShow("#outerdiv", "#innerdiv", "#bigimg", url);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
function imgShow(outerdiv, innerdiv, bigimg, _this){
|
|
|
var src = _this.attr("src");//获取当前点击的pimg元素中的src属性
|
|
|
$(bigimg).attr("src", src);//设置#bigimg元素的src属性
|
|
|
/*获取当前点击图片的真实大小,并显示弹出层及大图*/
|
|
|
$("<img/>").attr("src", src).load(function(){
|
|
|
var windowW = $(window).width();//获取当前窗口宽度
|
|
|
var windowH = $(window).height();//获取当前窗口高度
|
|
|
var realWidth = this.width;//获取图片真实宽度
|
|
|
var realHeight = this.height;//获取图片真实高度
|
|
|
var imgWidth, imgHeight;
|
|
|
var scale = 0.8;//缩放尺寸,当图片真实宽度和高度大于窗口宽度和高度时进行缩放
|
|
|
|
|
|
if(realHeight>windowH*scale) {//判断图片高度
|
|
|
imgHeight = windowH*scale;//如大于窗口高度,图片高度进行缩放
|
|
|
imgWidth = imgHeight/realHeight*realWidth;//等比例缩放宽度
|
|
|
if(imgWidth>windowW*scale) {//如宽度扔大于窗口宽度
|
|
|
imgWidth = windowW*scale;//再对宽度进行缩放
|
|
|
}
|
|
|
} else if(realWidth>windowW*scale) {//如图片高度合适,判断图片宽度
|
|
|
imgWidth = windowW*scale;//如大于窗口宽度,图片宽度进行缩放
|
|
|
imgHeight = imgWidth/realWidth*realHeight;//等比例缩放高度
|
|
|
} else {//如果图片真实高度和宽度都符合要求,高宽不变
|
|
|
imgWidth = realWidth;
|
|
|
imgHeight = realHeight;
|
|
|
}
|
|
|
$(bigimg).css("width",imgWidth);//以最终的宽度对图片缩放
|
|
|
|
|
|
var w = (windowW-imgWidth)/2;//计算图片与窗口左边距
|
|
|
var h = (windowH-imgHeight)/2;//计算图片与窗口上边距
|
|
|
$(innerdiv).css({"top":h, "left":w});//设置#innerdiv的top和left属性
|
|
|
$(outerdiv).fadeIn("fast");//淡入显示#outerdiv及.pimg
|
|
|
});
|
|
|
$(outerdiv).click(function(){//再次点击淡出消失弹出层
|
|
|
$(this).fadeOut("fast");
|
|
|
});
|
|
|
}
|