online-consulting.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. var d = dialog({contentType:'load', skin:'bk-popup'});
  2. var pagetype = 1;
  3. $(function(){
  4. switchTab(".pt-tab li",".pt-tab-list",".pt-tab-a");
  5. checkUserAgent();
  6. })
  7. function queryInit(){
  8. doctorList();
  9. }
  10. //选择项切换
  11. function switchTab(tab,con,a) {
  12. $(tab).click(function(){
  13. $(tab).removeClass("hit");
  14. $(this).addClass("hit");
  15. $(con).hide().eq($(this).index()).show();
  16. $(a).hide().eq($(this).index()).show();
  17. })
  18. }
  19. //跳转医生咨询
  20. function doctorConsult(){
  21. checkSign(1);
  22. }
  23. //公共咨询和病友圈跳转
  24. function jumpPage(type1){
  25. window.location.href = "public-patients-consult.html?type=" + type1;
  26. }
  27. //咨询记录
  28. function doctorList(){
  29. d.show();
  30. var data = {};
  31. var uid = "";
  32. var userAgent = window.localStorage.getItem(agentName);
  33. if(userAgent){
  34. var jsonstr = $.parseJSON(userAgent);
  35. uid = jsonstr.uid;
  36. }
  37. data.patient = uid;
  38. data.id = 0;
  39. data.pagesize = 10;
  40. sendPost('user/guaihao/appoDoctor', data, 'json', 'post', queryFailed, queryRecordSuccess1);
  41. }
  42. //咨询记录
  43. function consultRecord(){
  44. var data = {};
  45. data.id = 0;
  46. data.pagesize = 10;
  47. sendPost('patient/consult/records', data, 'json', 'post', queryFailed, queryRecordSuccess);
  48. }
  49. function queryFailed(res) {
  50. d.close();
  51. if (res && res.msg) {
  52. dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg}).show();
  53. } else {
  54. dialog({contentType:'tipsbox', skin:'bk-popup' , content:'加载失败'}).show();
  55. }
  56. }
  57. function queryRecordSuccess1(res) {
  58. if (res.status == 200) {
  59. if (res.list.length > 0) {
  60. var list = res.list;
  61. var $list = document.querySelector("#online_doc_list");
  62. for (var i = 0; i < list.length; i++) {
  63. var $li = document.createElement("li");
  64. var doctorCode = list[i].doctorCode;
  65. $li.setAttribute('data-code', doctorCode);
  66. var content = '<div class="pic"><img style="border-radius: 100px;" src="../../../images/d-default.png"></div>';
  67. content += '<p class="c-333 c-f15 pt5">' + list[i].doctorName + '</p>';
  68. $li.innerHTML = content;
  69. $list.appendChild($li);
  70. }
  71. } else {
  72. document.querySelector("#view_more_1").removeAttribute("style");
  73. }
  74. consultRecord();
  75. } else {
  76. queryFailed(res);
  77. }
  78. }
  79. function queryRecordSuccess(res) {
  80. if (res.status == 200) {
  81. if (res.list.length > 0) {
  82. var list = res.list;
  83. var $list = document.querySelector("#divRecoder");
  84. for (var i = 0; i < list.length; i++) {
  85. var $li = document.createElement("div");
  86. var consultCode = list[i].code;
  87. var symptoms = list[i].symptoms;
  88. var type = list[i].type;
  89. var czrq = list[i].czrq;
  90. var typeName = "";
  91. switch (type) {
  92. case 1:
  93. typeName = "三师咨询";
  94. break;
  95. case 2:
  96. typeName = "家庭咨询";
  97. break;
  98. case 3:
  99. typeName = "图文咨询";
  100. break;
  101. case 4:
  102. typeName = "公共咨询";
  103. break;
  104. case 5:
  105. typeName = "病友圈";
  106. break;
  107. default:
  108. break;
  109. }
  110. $li.setAttribute('data-type', type);
  111. $li.setAttribute('data-code', consultCode);
  112. $li.className = "n-list c-border-b";
  113. var content = '<div class="n-list-li n-list-link ptb12">';
  114. content += '<div class="n-list-info">';
  115. content += '<h4 class="c-333 c-f17">'+ typeName + '</h4>';
  116. content += '<p class="c-nowrap c-909090 c-f15" style="word-break: break-word;">症&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp状:' + symptoms + '</p>';
  117. content += '<p class="c-909090 c-f15">咨询时间:' + czrq + '</p>';
  118. content += ' </div>';
  119. content += ' </div>';
  120. $li.innerHTML = content;
  121. $list.appendChild($li);
  122. }
  123. $(".n-list").click(function() {
  124. var code = this.getAttribute("data-code");
  125. var type = Number(this.getAttribute("data-type"));
  126. switch (type) {
  127. case 1:
  128. window.location.href = "consulting-doctor.html?consult=" + code;
  129. break;
  130. case 2:
  131. window.location.href = "consulting-doctor.html?consult=" + code;
  132. break;
  133. case 3:
  134. break;
  135. case 4:
  136. window.location.href = "public-consult-detail.html?code=" + code;
  137. break;
  138. case 5:
  139. window.location.href = "patients-consult-detail.html?code=" + code;
  140. break;
  141. default:
  142. break;
  143. }
  144. });
  145. } else {
  146. document.querySelector("#view_more").removeAttribute("style");
  147. }
  148. d.close();
  149. } else {
  150. queryFailed(res);
  151. }
  152. }
  153. //查询更多约过的医生
  154. function yueguoMore(){
  155. window.location.href = "yuyueguo-record-more.html";
  156. }
  157. //查询更多咨询记录
  158. function recordMore(){
  159. window.location.href = "consult-record-more.html";
  160. }
  161. function notOnline(){
  162. dialog({
  163. title:'提示',
  164. skin:"ui-dialog ax-popup pror",
  165. content:"该功能暂未上线",
  166. ok: function (){}
  167. }).showModal();
  168. }