|
@ -3,41 +3,15 @@ var baseInfo = null,
|
|
|
// 基础环境信息(包括当前webview)
|
|
|
baseEnv = null;
|
|
|
|
|
|
// 搜索框
|
|
|
var $searchbar = $('.searchbar'),
|
|
|
// 搜索输入框
|
|
|
$searchbarInput = $('.searchbar .search-input'),
|
|
|
// 搜索取消按钮
|
|
|
$searchCancelBtn = $('.searchbar-cancel'),
|
|
|
// 搜索框下面悬浮的搜索提示
|
|
|
$searchSuggest = $('#search_suggest_text'),
|
|
|
// 搜索结果展示容器
|
|
|
$searchtResult = $('#search_result'),
|
|
|
// 搜索无结果时显示
|
|
|
$noResultWrap = $('#no_result_wrap'),
|
|
|
// 患者分组列表
|
|
|
$patiList = $('#pati_list'),
|
|
|
// 所选团队的团队名称显示位置
|
|
|
$selectedTeamName = $('.demo-comtop h1'),
|
|
|
// 当医生是当前所选团队的团队长时,如果有居民未分配健管师则显示顶部信息提示
|
|
|
$topMsgBar = $('#top_msg_bar'),
|
|
|
// 居民未分配健管师数量显示位置
|
|
|
$unassignedNum = $('#unassigned_num'),
|
|
|
// 页面顶部分类标签列表(四个列表项)
|
|
|
$groupLabelList = $('#group_label_list'),
|
|
|
// 居民未分配健管师“点击处理”
|
|
|
$handleLink = $('#handle_link'),
|
|
|
$patiList = $('#n-list'),
|
|
|
|
|
|
$wfp = $('.div-wfp'),
|
|
|
$qbjm = $('.div-qbjm'),
|
|
|
$back = $('.mui-action-back');
|
|
|
// 从缓存取出所选团队
|
|
|
var lastTeamId,
|
|
|
activeGroupType = "";
|
|
|
var self;
|
|
|
var docInfo;
|
|
|
|
|
|
var myScroll;
|
|
|
var self;
|
|
|
var docInfo;
|
|
|
var myScroll;
|
|
|
function initScroller(){
|
|
|
//阻尼系数
|
|
|
var deceleration = mui.os.ios?0.003:0.0009;
|
|
@ -93,7 +67,7 @@ updateLastTeamId = function(id) {
|
|
|
plus.storage.setItem("selectedTeamId",lastTeamId+"");
|
|
|
},
|
|
|
// 初始化选择团队
|
|
|
initTeams = function (){
|
|
|
//initTeams = function (){
|
|
|
|
|
|
// 判断缓存中的团队是否在团队列表中
|
|
|
// var isExist = _.some(baseInfo.teamInfo.data,function(t) {
|
|
@ -101,52 +75,52 @@ initTeams = function (){
|
|
|
// });
|
|
|
//
|
|
|
// if(!isExist) {
|
|
|
updateLastTeamId(baseInfo.teamInfo.data[0].id);
|
|
|
// updateLastTeamId(baseInfo.teamInfo.data[0].id);
|
|
|
// }
|
|
|
|
|
|
|
|
|
template.helper("setChecked", function(id, i) {
|
|
|
if(lastTeamId && lastTeamId==id)
|
|
|
return "checked";
|
|
|
return "";
|
|
|
});
|
|
|
|
|
|
$('.lin-sel-group').html(template('teams_tmpl', baseInfo.teamInfo));
|
|
|
|
|
|
var $selected;
|
|
|
if(!lastTeamId && baseInfo.teamInfo.data && baseInfo.teamInfo.data.length) {
|
|
|
updateLastTeamId(baseInfo.teamInfo.data[0].id);
|
|
|
setTitle(baseInfo.teamInfo.data[0].name);
|
|
|
$selected = $('.lin-sel-group li').eq(0);
|
|
|
$selected.addClass("checked");
|
|
|
} else {
|
|
|
$selected = $('.lin-sel-group').find("li.checked");
|
|
|
setTitle($selected.attr("data-name"));
|
|
|
}
|
|
|
getTeamPatientCount();
|
|
|
$qbjm.toggle($selected.attr('data-leadercode') == docInfo.code);
|
|
|
},
|
|
|
getTeamPatientCount = function(){
|
|
|
sendPost("/doctor/patient_label_info/team_amount", {teamCode: lastTeamId}, null, function(res){
|
|
|
if(res.status == 200){
|
|
|
$('.div-qbjm label').html("("+ res.data.focusAmount +"/"+ res.data.amount+")");
|
|
|
} else {
|
|
|
mui.toast("获取居民总数失败!");
|
|
|
}
|
|
|
},'POST','',true)
|
|
|
},
|
|
|
setTitle = function(title){
|
|
|
if(self.type == 1)
|
|
|
$selectedTeamName.html(title + "签约居民管理");
|
|
|
else
|
|
|
$selectedTeamName.html(title + '签约居民<label class="lin-down-arrow"></label>');
|
|
|
},
|
|
|
// template.helper("setChecked", function(id, i) {
|
|
|
// if(lastTeamId && lastTeamId==id)
|
|
|
// return "checked";
|
|
|
// return "";
|
|
|
// });
|
|
|
//
|
|
|
// $('.lin-sel-group').html(template('teams_tmpl', baseInfo.teamInfo));
|
|
|
//
|
|
|
// var $selected;
|
|
|
// if(!lastTeamId && baseInfo.teamInfo.data && baseInfo.teamInfo.data.length) {
|
|
|
// updateLastTeamId(baseInfo.teamInfo.data[0].id);
|
|
|
// setTitle(baseInfo.teamInfo.data[0].name);
|
|
|
// $selected = $('.lin-sel-group li').eq(0);
|
|
|
// $selected.addClass("checked");
|
|
|
// } else {
|
|
|
// $selected = $('.lin-sel-group').find("li.checked");
|
|
|
// setTitle($selected.attr("data-name"));
|
|
|
// }
|
|
|
// getTeamPatientCount();
|
|
|
// $qbjm.toggle($selected.attr('data-leadercode') == docInfo.code);
|
|
|
//},
|
|
|
//getTeamPatientCount = function(){
|
|
|
// sendPost("/doctor/patient_label_info/team_amount", {teamCode: lastTeamId}, null, function(res){
|
|
|
// if(res.status == 200){
|
|
|
// $('.div-qbjm label').html("("+ res.data.focusAmount +"/"+ res.data.amount+")");
|
|
|
// } else {
|
|
|
// mui.toast("获取居民总数失败!");
|
|
|
// }
|
|
|
// },'POST','',true)
|
|
|
//},
|
|
|
//setTitle = function(title){
|
|
|
// if(self.type == 1)
|
|
|
// $selectedTeamName.html(title + "签约居民管理");
|
|
|
// else
|
|
|
// $selectedTeamName.html(title + '签约居民<label class="lin-down-arrow"></label>');
|
|
|
//},
|
|
|
//显示选中的分组
|
|
|
showGroup = function(type) {
|
|
|
if(type){
|
|
|
activeGroupType = type;
|
|
|
}
|
|
|
},
|
|
|
//showGroup = function(type) {
|
|
|
// if(type){
|
|
|
// activeGroupType = type;
|
|
|
// }
|
|
|
//},
|
|
|
showGroupSel = function() {
|
|
|
if(self.type == 1)
|
|
|
return;
|
|
@ -155,21 +129,45 @@ showGroupSel = function() {
|
|
|
$('.lin-sel-group').toggle(isShow);
|
|
|
},
|
|
|
// 初始化画面患者分组列表
|
|
|
initPatientGroupsList = function() {
|
|
|
initPatientListByGroup = function() {
|
|
|
plus.nativeUI.showWaiting();
|
|
|
var url = self.type == 1 ? "/doctor/patient_label_info/label_team_amount" : "doctor/patient_label_info/label_patient_amount";
|
|
|
getReqPromise(url,{labelType: 1, teamCode: lastTeamId},'POST',true)
|
|
|
// var url = self.type == 1 ? "/doctor/patient_label_info/label_team_amount" : "doctor/patient_label_info/label_patient_amount";
|
|
|
var queryType = self.type == 1 ? "POST" : "GET";
|
|
|
var url = self.type == 1 ? "/doctor/patient_label_info/label_team_amount" : "/doctor/concern/getConcernPatients";
|
|
|
getReqPromise(url,{page: 0, pageSize: 10},queryType,true)
|
|
|
.then(function(res) {
|
|
|
if(res.status == 200) {
|
|
|
var data = _.filter(res.data,function(o) {
|
|
|
return o.labelCode != 0 || (o.labelCode==0 && o.amount > 0);
|
|
|
});
|
|
|
data=[
|
|
|
{
|
|
|
"code":"915cc456-5b1d-11e6-8344-fa163e8aee56",
|
|
|
"name":"ceshi",
|
|
|
"photo":"../../../images/p-female.png",
|
|
|
"sex":1,
|
|
|
"age":76,
|
|
|
"isWX":true,
|
|
|
"concernTime":"2018-04-04 15:17:52"
|
|
|
},
|
|
|
{
|
|
|
"code":"915cc456-5b1d-11e6-8344-fa163e8aee56",
|
|
|
"name":"ceshi",
|
|
|
"photo":"../../../images/p-female.png",
|
|
|
"sex":1,
|
|
|
"age":76,
|
|
|
"isWX":false,
|
|
|
"concernTime":"2018-04-04 15:17:52"
|
|
|
}
|
|
|
]
|
|
|
console.log(data)
|
|
|
if(data && data.length) {
|
|
|
var html = template("pati_group_tmpl", {list: data});
|
|
|
$patiList.empty().append(html);
|
|
|
if(activeGroupType) {
|
|
|
$patiList.find('.patient-list[data-group="'+activeGroupType+'"]').trigger("tap");
|
|
|
}
|
|
|
// var html = template("pati_group_tmpl", {list: data});
|
|
|
var html = template("pati_list_tmpl", {list: data});
|
|
|
$('ul.n-list').empty().append(html);
|
|
|
// if(activeGroupType) {
|
|
|
// $patiList.find('.patient-list[data-group="'+activeGroupType+'"]').trigger("tap");
|
|
|
// }
|
|
|
$noResultWrap.hide();
|
|
|
$searchtResult.show();
|
|
|
} else {
|
|
@ -192,26 +190,28 @@ showLoadMore = function($el) {
|
|
|
$loadMore.hide();
|
|
|
}
|
|
|
},
|
|
|
initPatientListByGroup = function(code) {
|
|
|
var url = self.type == 1 ? "doctor/patient_label_info/team_patient" : "doctor/patient_label_info/patients_by_label";
|
|
|
|
|
|
plus.nativeUI.showWaiting();
|
|
|
var $group = $patiList.find('.patient-list[data-group="'+code+'"]');
|
|
|
getReqPromise(url, {labelType:1, teamCode: lastTeamId, labelCode: code, page: 1, pagesize: 50},'POST',true)
|
|
|
.then(function(res) {
|
|
|
if(res.status == 200) {
|
|
|
var html = template("pati_list_tmpl", {list: _.map(res.data,function(o) {
|
|
|
o.jsonStr = JSON.stringify(o);
|
|
|
return o;
|
|
|
})});
|
|
|
$group.find('ul.n-list').empty().append(html);
|
|
|
showLoadMore($group);
|
|
|
} else {
|
|
|
plus.nativeUI.toast(res.msg);
|
|
|
}
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
}).catch(function(e){ console && console.error(e); plus.nativeUI.closeWaiting(); });
|
|
|
},
|
|
|
//initPatientListByGroup = function(code) {
|
|
|
//// var url = self.type == 1 ? "doctor/patient_label_info/team_patient" : "doctor/patient_label_info/patients_by_label";
|
|
|
// var queryType = self.type == 1 ? "POST" : "GET";
|
|
|
// var url = self.type == 1 ? "/doctor/patient_label_info/label_team_amount" : "/doctor/concern/getConcernPatients";
|
|
|
//
|
|
|
// plus.nativeUI.showWaiting();
|
|
|
// var $group = $patiList.find('.patient-list[data-group="'+code+'"]');
|
|
|
// getReqPromise(url, {labelType:1, teamCode: lastTeamId, labelCode: code, page: 0, pagesize: 10},queryType,true)
|
|
|
// .then(function(res) {
|
|
|
// if(res.status == 200) {
|
|
|
// var html = template("pati_list_tmpl", {list: _.map(res.data,function(o) {
|
|
|
// o.jsonStr = JSON.stringify(o);
|
|
|
// return o;
|
|
|
// })});
|
|
|
// $group.find('ul.n-list').empty().append(html);
|
|
|
// showLoadMore($group);
|
|
|
// } else {
|
|
|
// plus.nativeUI.toast(res.msg);
|
|
|
// }
|
|
|
// plus.nativeUI.closeWaiting();
|
|
|
// }).catch(function(e){ console && console.error(e); plus.nativeUI.closeWaiting(); });
|
|
|
//},
|
|
|
|
|
|
togglePatientListShow = function($el) {
|
|
|
var isOpen = $el.hasClass("current"),
|
|
@ -256,19 +256,19 @@ showTopMsgBar = function() {
|
|
|
refreshPage = function(){
|
|
|
baseInfo = getBaseInfo();
|
|
|
lastTeamId = plus.storage.getItem("selectedTeamId");
|
|
|
initPatientGroupsList();
|
|
|
getTeamPatientCount();
|
|
|
initPatientListByGroup();
|
|
|
// getTeamPatientCount();
|
|
|
},
|
|
|
// 绑定页面事件
|
|
|
bindEvents = function () {
|
|
|
|
|
|
$patiList.on('tap','.load-more',function() {
|
|
|
console.log("你点到了")
|
|
|
plus.nativeUI.showWaiting();
|
|
|
var $wrap = $(this).closest(".patient-list"),
|
|
|
code = $wrap.attr("data-group"),
|
|
|
page = parseInt($wrap.attr("data-page"));
|
|
|
var url = self.type == 1 ? "doctor/patient_label_info/team_patient" : "doctor/patient_label_info/patients_by_label";
|
|
|
|
|
|
page = $('ul.n-list').length/10 | 0;
|
|
|
var queryType = self.type == 1 ? "POST" : "GET";
|
|
|
var url = self.type == 1 ? "/doctor/patient_label_info/label_team_amount" : "/doctor/concern/getConcernPatients";
|
|
|
|
|
|
getReqPromise(url,{labelType: 1,labelCode: code, teamCode: lastTeamId, page: page + 1, pagesize: 50},'POST',true)
|
|
|
.then(function(res) {
|
|
|
if(res.status == 200) {
|
|
@ -276,22 +276,12 @@ bindEvents = function () {
|
|
|
o.jsonStr = JSON.stringify(o);
|
|
|
return o;
|
|
|
})});
|
|
|
$wrap.find('ul.n-list').append(html);
|
|
|
$wrap.attr("data-page",page+1);
|
|
|
$('ul.n-list').append(html);
|
|
|
showLoadMore($wrap);
|
|
|
}
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
}).catch(function(e){ console && console.error(e); plus.nativeUI.closeWaiting(); });
|
|
|
return false;
|
|
|
}).on('tap','.patient-list',function() {
|
|
|
if($(".patient-list.current").length>0 && !$(this).hasClass('current')){
|
|
|
mui('.mui-scroll-wrapper').scroll().scrollTo(0,0,0);
|
|
|
}
|
|
|
var code = $.trim($(this).attr("data-group")),
|
|
|
isOpen = togglePatientListShow($(this)),
|
|
|
isEmpty = !$(this).find('ul.n-list li').length;
|
|
|
$patiList.find(".patient-type").css({position: "relative", top: "initial", "z-index": "initial"});
|
|
|
code && !isOpen && isEmpty && initPatientListByGroup(code);
|
|
|
}).on('tap','li[data-patient-code]',function(e) {
|
|
|
var patiInfo = $(this).attr("data-json");
|
|
|
var info = JSON.parse(patiInfo);
|
|
@ -336,7 +326,7 @@ bindEvents = function () {
|
|
|
$(this).addClass('checked').siblings().removeClass('checked');
|
|
|
}
|
|
|
showTopMsgBar();
|
|
|
getTeamPatientCount();
|
|
|
// getTeamPatientCount();
|
|
|
refreshPage();
|
|
|
});
|
|
|
|
|
@ -479,9 +469,9 @@ new Promise(function(resolve, reject) {
|
|
|
lastTeamId = plus.storage.getItem("selectedTeamId");
|
|
|
// 绑定页面事件
|
|
|
bindEvents();
|
|
|
initTeams();
|
|
|
// initTeams();
|
|
|
showTopMsgBar();
|
|
|
initPatientGroupsList();
|
|
|
initPatientListByGroup();
|
|
|
if(baseEnv.webview.message){//“转发给”功能,需要返回按钮
|
|
|
$(".mui-action-back").show();
|
|
|
}
|