///管理端调用
mui.plusReady(function(){
var self = plus.webview.currentWebview(),
prescriptionCode = self.prescriptionCode;
var $patiInfo = $('#patient-info');
var strOriginalData;
queryData();
bindEvent();
function queryData(){
plus.nativeUI.showWaiting();
var params ={
code:prescriptionCode,
type: 0 //非团队长权限查看信息
}
sendPost("doctor/prescriptionInfo/getContinuedPrescriptionAsDoctor",params, function(){
plus.nativeUI.closeWaiting();
mui.toast("请求失败");
}, function(res){
plus.nativeUI.closeWaiting();
if(res.status == 200){
strOriginalData = res.data;
var html = template('pati_tmp',{data:res.data,isLeader:0})
$patiInfo.html(html);
}else{
mui.toast("获取数据失败");
}
},'get')
}
function bindEvent(){
$patiInfo.on('click','#old-data',function(){
mui.openWindow({
id: "chufangxiangqing",
url: "chufangxiangqing.html",
extras: {
code:strOriginalData.prescription.jwCode,
patient:strOriginalData.prescription.patient
}
})
})
}
template.helper('setStatus',function(o){
if(o == -5){return '线下取消'}
if(o == -4){return '线下退费'}
if(o == -3){ return '续方取消(24小时未支付)' }
if(o == -2){ return '续方取消(居民主动取消)' }
if(o == -1){ return '审核未通过' }
if(o == 0 || o == 10){ return '审核中' }
if(o == 2){ return '调整中' }
if(o == 3){ return '调整成功/待ca认证' }
if(o == 4){ return '调整失败' }
if(o == 20){ return '药师审核中' }
if(o == 21){ return '药师审核失败' }
if(o == 30){ return '开方中' }
if(o == 31){ return '开方失败' }
if(o == 40 || o == 41){ return '待支付' }
if(o == 50){ return '配药中' }
if(o == 60){ return '等待领药' }
if(o == 61 || o == 62 || o == 65 || o == 69){ return '配送中' }
if(o == 100){ return '已完成' }
})
template.helper('setReview',function(o){
if(o == 0){ return '审核中' }
if(o == 1){ return '审核通过' }
if(o == -1){ return '审核未通过' }
if(o == -2){ return '审核无效' }
})
template.helper('setPrescription',function(array){
var arr=[];
$.map(array,function(item,index){
arr.push(item.name)
})
return arr.join(',')
})
template.helper('setRestTime',function(minDate,sDate){
var now = getNowDate();
var createDate = sDate.split(' ');
var diff = getDays(createDate[0],now);
if(diff'+(minDate-diff)+'天'
}else{
return '已用完'
}
})
//相隔几天
function getDays(sDate,eDate){
var oDate1;
var oDate2;
var iDays;
oDate1= sDate.split("-");
oDate2= eDate.split("-");
var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]);
var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]);
iDays = parseInt(Math.abs(strDateE - strDateS ) / 1000 / 60 / 60 /24)
return iDays ;
}
//现在时间
function getNowDate() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hour = date.getHours();
var minute = date.getMinutes();
var second = date.getSeconds();
return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
}
function reloadPageData(){
queryData()
}
window.addEventListener("refreshXufang", function(){
reloadPageData()
})
})