fuwujilu.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. var fuwujilu = {
  2. getInfo: function(){
  3. var url = "/patient/sign/sign_service_info",
  4. params = {doctor: request.doctor};
  5. d.show();
  6. getReqPromise(url, params, "json", "post").then(function(res){
  7. if(res.status == 200){
  8. fuwujilu.fillRespData(res.data);
  9. }else{
  10. fuwujilu.queryFailed(res);
  11. }
  12. });
  13. },
  14. fillRespData: function(data){
  15. d.close();
  16. $(".done-count").text(data.activeAmount || 0);
  17. var doingAmount = isNaN(data.amount-data.activeAmount) ? 0 : data.amount-data.activeAmount;
  18. $(".doing-count").text(doingAmount);
  19. var list = _.map(data.list, function(o){
  20. o.type = parseInt(o.type);
  21. o.jsonStr = JSON.stringify(o);
  22. return o;
  23. });
  24. var html = template("item2_tmp", {list: list});
  25. $("#recordList").empty().append(html);
  26. },
  27. queryFailed: function(res){
  28. d.close();
  29. if(res && res.msg) {
  30. dialog({
  31. contentType: 'tipsbox',
  32. skin: 'bk-popup',
  33. content: res.msg
  34. }).show();
  35. } else {
  36. dialog({
  37. contentType: 'tipsbox',
  38. skin: 'bk-popup',
  39. content: '加载失败'
  40. }).show();
  41. }
  42. },
  43. bindEvents: function(){
  44. $("body").on('tap', "#recordList .record-item", function(){
  45. var jsonData = $(this).attr("data-json");
  46. jsonData = JSON.parse(jsonData);
  47. var type = jsonData.type;
  48. var direct = "";
  49. switch (type){
  50. case 1:
  51. var userAgent = window.localStorage.getItem(agentName);
  52. var userInfo = JSON.parse(userAgent);
  53. var rep = userInfo.represented?userInfo.represented:userInfo.uid;
  54. //判断咨询是否结束
  55. if(jsonData.status == "0"){
  56. //进行中的咨询
  57. var parent = window.parent;
  58. parent.clickTab(0);
  59. }else{
  60. //已结束的咨询
  61. direct = "../../yszx/html/consulting-doctor.html?consult="+jsonData.consult+"&type=1&toUser="+rep+"&doctor=null"
  62. }
  63. break;
  64. case 2:
  65. break;
  66. case 3:
  67. var id = jsonData.code,
  68. orgCode = jsonData.org_code;
  69. direct = "../../wdyy/html/detail-appointment.html?id="+id+"&orgCode="+orgCode;
  70. break;
  71. case 4:
  72. var id = jsonData.article;
  73. direct = "../../jkjy/html/article2.html?dataId="+id;
  74. break;
  75. case 5:
  76. var id = jsonData.id;
  77. direct = "../../yszd/html/guidance-detail.html?id="+id;
  78. break;
  79. default:
  80. break;
  81. }
  82. if(direct){
  83. window.parent.location.href = direct;
  84. }else{
  85. if(type == 2){
  86. dialog({
  87. contentType: 'tipsbox',
  88. skin: 'bk-popup',
  89. content: "对不起,随访暂时无法查看详情"
  90. }).show();
  91. }
  92. }
  93. });
  94. }
  95. };
  96. template.helper("getTypeName", function(type){
  97. var typeName = "";
  98. type = parseInt(type);
  99. switch(type){
  100. case 1:
  101. typeName = "医生咨询";
  102. break;
  103. case 2:
  104. typeName = '随访';
  105. break;
  106. case 3:
  107. typeName = "待预约";
  108. break;
  109. case 4:
  110. typeName = "健康教育";
  111. break;
  112. case 5:
  113. typeName = "健康指导";
  114. break;
  115. }
  116. return typeName;
  117. });
  118. template.helper('formatDateTime', function(str){
  119. return str.substr(0, 19);
  120. });