123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- var selectKey = 0 ;
- var selectName="";
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var id = 0;
- var pageSize = 10;
- var pagetype=4;
- var status = 0;
- var tab_s =0;
- var scroller1;
- Request = GetRequest();
- var openid = Request["openid"];
- var tabType = Request['type'];
- //下拉刷新
- function pullDownAction(theScrollerTemp) {
- d.show();
- setTimeout(function () {
- $("#publicul").html("");
- id=0;
- fillList();
- }, 100);
- }
- //上拉加载数据
- function pullUpAction(theScrollerTemp) {
- d.show();
- setTimeout(function () {
- fillList();
- }, 100);
- }
- appendFamilyMember($('#memberContainer'),function(){
- id=0;
- $("#publicul").empty();
- selectKey = 0;
- selectName = '全部';
- $('.div-type').html(selectName);
- fillList();
- },function(){
- //判断有授权家人,修改样式
- if($('#memberContainer').is(':hidden')){
- $('#wrapper').css('top','41px');
- }else{
- $('#wrapper').css('top','130px');
- $('.div-no-info').css('padding-top','200px');
- $('.div-condition').css('top','90px');
- }
- });
- var userAgent = window.localStorage.getItem(agentName);
- checkUserAgent();
-
- $(function(){
- scroller1 = new IScrollPullUpDown('wrapper',{
- probeType:2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel:false,
- scrollbars:true,
- click:true,
- fadeScrollbars:true,
- interactiveScrollbars:false
- },pullDownAction,pullUpAction);
-
- //选择全部
- $('.div-type').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- formatValue: function(d) {
- return d.join(',');
- },
- customWheels: true,
- wheels: [
- [{
- keys: ['0', '1', '2'],
- values: ['全部', '高血压', '糖尿病']
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- $('.div-type').html(dd[0].values);
- selectKey = dd[0].keys;
- selectName = dd[0].values;
- //公共咨询
- if(tab_s==0){
- id=0;
- $("#publicul").html("");
- fillList();
- }
- //病友圈
- if(tab_s==1){
- id=0;
- $("#patinetsul").html("");
- fillList2();
- }
- }
- });
-
- bindEvents();
-
- var diseaseType = "";
- setTimeout(function(){
- if(diseaseType){
- tabType = diseaseType;
- }
- if(tabType==2){
- $("#patientsLi").click();
- }else{
- fillList();
- }
- },200);
- })
- function bindEvents() {
- //点击新增事件
- $(".timper-addfix").click(function(){
- window.location.href ="public-consult-add.html?openid="+openid;
- });
-
- //标签切换
- $(".pt-tab li").click(function(){
- var tabid = $(this).attr("id");
- $(".pt-tab li").removeClass("hit");
- $(this).addClass("hit");
- if(tabid=="publicLi"){
- window.localStorage.setItem("diseaseType","1");
- id=0;
- tab_s=0;
- $("#publicul").show();
- $("#patinetsList").hide();
- $("#publicul").html("");
- fillList();
- }
- })
- }
- function fillList() {
- var data = {};
- data.id = id;
- data.pagesize = pageSize;
- var dis = selectKey;
- if(dis&&dis!=0) data.disease = dis;
- var userAgent = window.localStorage.getItem(agentName);
- $.ajax(server + "patient/consult/public/list", {
- data: data,
- type: 'POST',
- dataType: 'json',
- beforeSend: function(request) {
- request.setRequestHeader("userAgent", userAgent);
- },
- error: function(res) {
- d.close();
- if(res.status == 999 || res.status == 998 || res.status == 997){
- loginUrl(res.status);
- return;
- }
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
- },
- success: function(res) {
- if(res.status == 999 || res.status == 998 || res.status == 997){
- loginUrl(res.status);
- }
- else if (res.status == 200) {
- if (res.list.length > 0) {
- var list = res.list;
- var $list = $("#publicul");
- id=res.list[list.length-1].id;
- $("#nopubliclist").hide();
- $('#publicul').show();
- for (var i = 0; i < list.length; i++) {
- var consultCode = list[i].consult;
- var diseaseName = list[i].diseaseName;
- var photo = list[i].photo;
-
- if(!photo){
- photo = "../../../images/p-default.png";
- }
- if(!diseaseName) diseaseName = "";
- var content = '<li data-code="'+consultCode+'">'+
- '<div class="div-title">【'+
- list[i].diseaseName+'】'+list[i].title+
- '</div>' +
- '<div class="div-content">'+
- list[i].content+
- '</div>'+
- '<div class="div-remark-info">'+
- '<div class="n-avatar-l img-round pr10">'+
- '<img src="'+getImgUrl(photo)+'">'+
- '</div>'+
- '<div class="lab-user-name">'+list[i].name+'</div>'+
- '<div class="lab-time">'+list[i].czrq.substring(0,19)+'</div>'+
- '<div class="div-right">'+
- '<img src="../images/huifu_icon.png"/>'+
- ' <label class="lab-count">'+list[i].amount+'</label>'+
- '</div>'+
- '</div>'+
- '</li>';
- $list.append(content);
- }
- $("#publicul li").on("tap",function(){
- var code = this.getAttribute("data-code");
- window.open("public-consult-detail.html?code=" + code);
- })
- scroller1.myScroll.refresh();
- } else {
- if(id==0){
- $("#nopubliclist").show();
- $('#publicul').hide();
- }else{
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'无更多数据!'}).show();
- }
- }
- d.close();
- } else {
- d.close();
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show();
- }
- }
- });
- }
- function publicdetail(code){
- window.open("public-consult-detail.html?code=" + code);
- }
|