|
@ -0,0 +1,424 @@
|
|
|
var self; //当前页面对象
|
|
|
var patiCode; //居民标识
|
|
|
var concernCode; //居民关注标识
|
|
|
var currDays = 7; //默认日期类型
|
|
|
var indexType = "1"; //指标类型
|
|
|
var currIndexCode = "" //当前要显示的指标类型
|
|
|
var docType=""//医生类别
|
|
|
var signType = "";
|
|
|
var oPatiInfo =null;
|
|
|
var iscroller = null;
|
|
|
var doctorCode = null;
|
|
|
var qyRelation;
|
|
|
var overdue; //判断患者与医生的签约状态是否已过期
|
|
|
var currService;
|
|
|
var jtServerCode=[];//服务类型名称
|
|
|
var jtAdminTeamId; // 标记患者的签约团队id
|
|
|
|
|
|
mui.plusReady(function() {
|
|
|
self = plus.webview.currentWebview();
|
|
|
concernCode = self.concernCode;
|
|
|
patiCode = self.code;
|
|
|
doctorCode = JSON.parse(plus.storage.getItem("docInfo")).code;
|
|
|
overdue = self.overdue;
|
|
|
$("#pati_info").attr("code",patiCode);
|
|
|
localStorage.removeItem('updateService');
|
|
|
getPatiInfo();
|
|
|
initScroller();
|
|
|
});
|
|
|
|
|
|
mui.back = function(){
|
|
|
// self.opener().reload(true);
|
|
|
//如果父窗口为im, 更新im
|
|
|
if(self.opener().id=='p2dzixun'){
|
|
|
mui.fire(self.opener(), 'update');
|
|
|
}
|
|
|
self.close();
|
|
|
}
|
|
|
//获取病人信息
|
|
|
function getPatiInfo(code){
|
|
|
sendGet("/doctor/concern/findByCode",
|
|
|
{concernCode: concernCode}, null,
|
|
|
function(res){
|
|
|
if(res.status == 200){
|
|
|
oPatiInfo = res.data;
|
|
|
bindEvents();
|
|
|
dealPatiInfoTmpl(oPatiInfo);
|
|
|
} else {
|
|
|
mui.toast("获取病人信息失败");
|
|
|
}
|
|
|
},'POST','',true);
|
|
|
}
|
|
|
|
|
|
function sendWeixinRemind() {
|
|
|
sendPost("doctor/family_contract/wechat_focus_remind",
|
|
|
{patient: patiCode,isAll:0}, null,
|
|
|
function(res){
|
|
|
if(res.status == 200){
|
|
|
oPatiInfo.wechatFocusRemind = 1;
|
|
|
showRemindBtn(true);
|
|
|
} else {
|
|
|
oPatiInfo.wechatFocusRemind = 1;
|
|
|
showRemindBtn(true);
|
|
|
mui.toast(res.msg);
|
|
|
}
|
|
|
},'POST','',true);
|
|
|
}
|
|
|
|
|
|
function showRemindBtn(isReminded) {
|
|
|
var $remind = $("#remind_gz");
|
|
|
$remind.show();
|
|
|
if(isReminded) {
|
|
|
$remind.addClass("ytx");
|
|
|
$remind.find("a").text("已提醒关注");
|
|
|
} else {
|
|
|
$remind.removeClass("ytx");
|
|
|
$remind.find("a").text("提醒关注微信");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function checkWeixinRemind(data) {
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
sendPost("doctor/family_contract/is_patient_remind_focus",
|
|
|
{patient: patiCode}, null,
|
|
|
function(res){
|
|
|
if(res.status == 200){
|
|
|
if(res.data==0) { // 0: 当日未提醒
|
|
|
isWeiXinRemind(data);
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
mui.toast(res.msg);
|
|
|
}
|
|
|
},'POST','',true)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function isWeiXinRemind (data) {
|
|
|
|
|
|
if(data) {
|
|
|
var isReminded = data.wechatFocusRemind=="1"? true: false,
|
|
|
// 签约类型: 1-->三师 2-->家庭 3-->三师 、家庭两者都有
|
|
|
signType = data.signType,
|
|
|
// 缴费状态: 2-->已退费 1-->已缴费 0-->未交费
|
|
|
expensesStatus = data.expensesStatus,
|
|
|
openid = data.openid;
|
|
|
|
|
|
if(!openid) {
|
|
|
// 有签约家庭医生,但未交费,则有该悬浮按钮
|
|
|
if((signType=="2" || signType=="3") && expensesStatus=="1") {
|
|
|
showRemindBtn(isReminded);
|
|
|
}
|
|
|
// 2、如只有三师签约,但无openid,则有该悬浮按钮
|
|
|
else if(signType == "1") {
|
|
|
showRemindBtn(isReminded);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 滚动条实例初始化
|
|
|
function initScroller() {
|
|
|
//阻尼系数
|
|
|
var deceleration = mui.os.ios?0.003:0.0009;
|
|
|
mui('.mui-scroll-wrapper').scroll({
|
|
|
bounce: false,
|
|
|
indicators: true, //是否显示滚动条
|
|
|
deceleration:deceleration
|
|
|
});
|
|
|
|
|
|
iscroller = mui(".mui-scroll").pullToRefresh({
|
|
|
down: {
|
|
|
callback: function() {
|
|
|
var self = this;
|
|
|
setTimeout(function() {
|
|
|
refreshPage();
|
|
|
self.endPullDownToRefresh();
|
|
|
}, 1000);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
/*
|
|
|
* 拼接居民信息模板
|
|
|
*/
|
|
|
function dealPatiInfoTmpl(patiInfoObj) {
|
|
|
$("#pati_info_wrap").html(template("pati_info_tmpl", patiInfoObj));
|
|
|
$('#view_wrap').show();
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 查看居民资料
|
|
|
*/
|
|
|
function toInfo() {
|
|
|
var $el = $(this);
|
|
|
mui.openWindow("huanzeziliao.html", "huanzeziliao", {
|
|
|
extras: {
|
|
|
patiPhoto: $el.find('.doc-avatar img').attr('src'),
|
|
|
patiCode: patiCode,
|
|
|
signType: signType,
|
|
|
teamCode: self.teamCode,
|
|
|
//添加续签状态值
|
|
|
qyRelation: qyRelation,
|
|
|
renewable: oPatiInfo.isRenewable
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function openwdsb(){
|
|
|
// var params={};
|
|
|
// params.patient = patiCode;
|
|
|
// openWebviewExtras("../../wdsb/html/my-equipments.html",params);
|
|
|
mui.openWindow('../../jkjl/html/health-record.html', 'health-record', {
|
|
|
extras: {
|
|
|
patientCode: patiCode,
|
|
|
patientName: oPatiInfo.name,
|
|
|
qyRelation: qyRelation
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 服务记录
|
|
|
*/
|
|
|
|
|
|
function fwjl() {
|
|
|
mui.openWindow('fuwujilu.html', 'fuwujilu', {
|
|
|
extras: {
|
|
|
patientCode: patiCode,
|
|
|
patientName: oPatiInfo.name,
|
|
|
qyRelation: qyRelation
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 健康指导
|
|
|
*/
|
|
|
function jkzd() {
|
|
|
// diaAdd.close();
|
|
|
mui.openWindow('../../hzzd/html/guidance_list.html', 'jkzd', {
|
|
|
extras: {
|
|
|
code: patiCode
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
/*
|
|
|
* 体征预警
|
|
|
*/
|
|
|
function tzyj() {
|
|
|
// diaAdd.close();
|
|
|
mui.openWindow('tzyj.html', 'tzyj', {
|
|
|
extras: {
|
|
|
code: patiCode
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 健康记录点击事件
|
|
|
*/
|
|
|
/*
|
|
|
* 药物记录
|
|
|
*/
|
|
|
function ywjl(dom) {
|
|
|
var text = $(dom).find("p").eq(0).text();
|
|
|
if(text == "-") {
|
|
|
mui.toast("暂无健康记录");
|
|
|
return;
|
|
|
}
|
|
|
mui.openWindow('../../hzgl/html/health-record-drug.html', 'health-record-drug', {
|
|
|
extras: {
|
|
|
pCode: patiCode
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
/*
|
|
|
* 饮食记录
|
|
|
*/
|
|
|
function ysjl(dom) {
|
|
|
var text = $(dom).find("p").eq(0).text();
|
|
|
if(text == "-") {
|
|
|
mui.toast("暂无健康记录");
|
|
|
return;
|
|
|
}
|
|
|
mui.openWindow('../../hzgl/html/health-record-diet.html', 'health-record-diet', {
|
|
|
extras: {
|
|
|
pCode: patiCode
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
/*
|
|
|
* 运动记录
|
|
|
*/
|
|
|
function ydjl(dom) {
|
|
|
var text = $(dom).find("p").eq(0).text();
|
|
|
if(text == "-") {
|
|
|
mui.toast("暂无健康记录");
|
|
|
return;
|
|
|
}
|
|
|
mui.openWindow('../../hzgl/html/health-record-sport.html', 'health-record-sport', {
|
|
|
extras: {
|
|
|
pCode: patiCode
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 分组
|
|
|
*/
|
|
|
function fz() {
|
|
|
mui.openWindow('../../zxyy/html/xuanzeyiyuan.html', 'xuanzeyiyuan', {
|
|
|
extras: {
|
|
|
pCode: patiCode
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function toSelectJb(){
|
|
|
var self = plus.webview.currentWebview();
|
|
|
var update = localStorage.getItem('updateService');
|
|
|
var oldData = jtServerCode.join(',');
|
|
|
mui.openWindow({
|
|
|
url: 'disease-label-edit.html',
|
|
|
id: 'disease-label-edit',
|
|
|
extras: {
|
|
|
patientCode: patiCode,
|
|
|
viewId: self.id,
|
|
|
signCode:oPatiInfo.signCode,//变更服务类型用
|
|
|
serviceCode: update?update:oldData,
|
|
|
isChange:$("#smallTipSev").is(":hidden")?false:true//判断是否处于变更
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
function dial(){
|
|
|
var moblie = $(".div-dianhua").attr("data-mobile");
|
|
|
var phone = $(".div-dianhua").attr("data-phone");
|
|
|
var type = $(this).attr("data-type");
|
|
|
//观察者模式下,不可以拨打被观察者患者的电话
|
|
|
var userAgent = plus.navigator.getUserAgent(),
|
|
|
index = userAgent.indexOf("}"),
|
|
|
s = userAgent.substr(0, index+1),
|
|
|
item = JSON.parse(s);
|
|
|
if(item.observer){
|
|
|
mui.toast("观察者模式无法拨打患者电话");
|
|
|
}else{
|
|
|
if(type==1){
|
|
|
if(moblie){
|
|
|
dialog({
|
|
|
content: moblie,
|
|
|
okValue:'立即拨号',
|
|
|
ok: function (){
|
|
|
window.location.href = "tel:"+moblie;
|
|
|
},
|
|
|
cancelValue: '不了,谢谢',
|
|
|
cancel: function () {
|
|
|
return;
|
|
|
}
|
|
|
}).showModal();
|
|
|
}else{
|
|
|
if(phone){
|
|
|
dialog({
|
|
|
content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,是否拨打联系人电话?",
|
|
|
okValue:'立即拨号',
|
|
|
ok: function (){
|
|
|
window.location.href = "tel:"+phone;
|
|
|
},
|
|
|
cancelValue: '不了,谢谢',
|
|
|
cancel: function () {
|
|
|
return;
|
|
|
}
|
|
|
}).showModal();
|
|
|
}else{
|
|
|
dialog({
|
|
|
content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,无法电话联系",
|
|
|
okValue:'我知道了',
|
|
|
ok: function (){
|
|
|
return;
|
|
|
},
|
|
|
}).showModal();
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
if(phone){
|
|
|
dialog({
|
|
|
content: phone,
|
|
|
okValue:'立即拨号',
|
|
|
ok: function (){
|
|
|
window.location.href = "tel:"+moblie;
|
|
|
},
|
|
|
cancelValue: '不了,谢谢',
|
|
|
cancel: function () {
|
|
|
return;
|
|
|
}
|
|
|
}).showModal();
|
|
|
}else{
|
|
|
if(moblie){
|
|
|
dialog({
|
|
|
content: "对不起,"+$(".patient-name").html()+"未填写联系人电话,是否拨打绑定的手机号码?",
|
|
|
okValue:'立即拨号',
|
|
|
ok: function (){
|
|
|
window.location.href = "tel:"+phone;
|
|
|
},
|
|
|
cancelValue: '不了,谢谢',
|
|
|
cancel: function () {
|
|
|
return;
|
|
|
}
|
|
|
}).showModal();
|
|
|
}else{
|
|
|
dialog({
|
|
|
content: "对不起,"+$(".patient-name").html()+"未绑定手机号码,无法电话联系",
|
|
|
okValue:'我知道了',
|
|
|
ok: function (){
|
|
|
return;
|
|
|
},
|
|
|
}).showModal();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function refreshPage () {
|
|
|
labelName =[];
|
|
|
jtServerCode = [];
|
|
|
localStorage.removeItem('updateService');
|
|
|
getPatiInfo();
|
|
|
}
|
|
|
window.addEventListener("refresh1", function(){
|
|
|
refreshPage();
|
|
|
var xxWv = plus.webview.getWebviewById("huanzhe-by-type");
|
|
|
// 如果有打开分组列表也要刷新列表
|
|
|
if(xxWv){
|
|
|
mui.fire(xxWv, "refresh");
|
|
|
}
|
|
|
var xxindex = plus.webview.getWebviewById("huanzhe.html");
|
|
|
// 如果有打开分组列表也要刷新列表
|
|
|
if(xxindex){
|
|
|
mui.fire(xxindex, "refresh");
|
|
|
}
|
|
|
})
|
|
|
|
|
|
window.addEventListener("setDiseaseTypes", function(e){
|
|
|
$('#diseases').html(e.detail.names);
|
|
|
oPatiInfo.diseases = e.detail.diseases;
|
|
|
})
|
|
|
|
|
|
function toInfo() {
|
|
|
var $el = $(this);
|
|
|
mui.openWindow("../../huanzhe/html/huanzhexinxi.html", "huanzhexinxi", {
|
|
|
extras: {
|
|
|
patiCode: patiCode
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
/* 事件绑定*/
|
|
|
function bindEvents(){
|
|
|
//查看居民详情
|
|
|
$("#pati_info_wrap").on('tap', '#pati_info', toInfo);
|
|
|
//拨打电话
|
|
|
$("#pati_info_wrap").on('tap','.div-dianhua',dial)
|
|
|
}
|