yinshi.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. function queryYinshiList(page,pagesize,begindate,enddate) {
  2. //拼请求内容
  3. //显示进度条
  4. plus.nativeUI.showWaiting();
  5. var params = {};
  6. params.patient = patientCode;
  7. params.page = page;
  8. params.pagesize = pagesize;
  9. params.start = begindate+" 00:00:00";
  10. params.end = enddate+" 23:59:59";
  11. //发送ajax请求
  12. sendPost("doctor/health_record/list_diet", params, queryListFailed, queryYinshiListSuccesss);
  13. }
  14. /**
  15. * 健康指标图表查询成功处理方法
  16. */
  17. function queryYinshiListSuccesss(res) {
  18. if (res.status == 200) {
  19. plus.nativeUI.closeWaiting();
  20. if (res.list.length > 0) {
  21. showYinshiList(res.list);
  22. if(res.list.length<10){
  23. $("#view_more_yinshi").hide();
  24. }else{
  25. $("#view_more_yinshi").show();
  26. }
  27. }else{
  28. $("#view_more_yinshi").hide();
  29. }
  30. } else {
  31. queryListFailed(res);
  32. }
  33. }
  34. /**
  35. * 显示查询结果
  36. * @param {Object} list
  37. */
  38. function showYinshiList(list) {
  39. page = page+1;
  40. for (var i = 0; i < list.length; i++) {
  41. var data = list[i];
  42. if (!data) {
  43. continue;
  44. }
  45. //data.date.substr(5, 5) --只有月-日
  46. addRowYinshi(data.record_date, data.content,data.images);
  47. }
  48. setTimeout(function () {
  49. scroller1.refresh();
  50. }, 1000);
  51. }
  52. /**
  53. * 清空tbody
  54. */
  55. function clearHTML() {
  56. $("#diet_list").html("");
  57. }
  58. /**
  59. * tbody添加一行tr
  60. * @param {Object} dateStr
  61. * @param {Object} value1
  62. * @param {Object} value2
  63. */
  64. function addRowYinshi(record_date, content,images) {
  65. // if(dateStr.length > 5){
  66. // dateStr = dateStr.substr(5, 5);
  67. // }
  68. var tb = document.querySelector("#diet_list");
  69. var tr = document.createElement("tr");
  70. if(record_date.length > 5){
  71. record_date = record_date.substr(5, 5);
  72. }
  73. if(record_date){
  74. record_date = record_date.replace("-",".");
  75. }
  76. var pict= new Array(); //定义一数组
  77. pict=images.split(","); //字符分割
  78. var img_html="";
  79. for (i=0;i<pict.length ;i++ )
  80. {
  81. // document.write(+"<br/>"); //分割后的字符输出
  82. img_html+="<img src='"+pict[i]+"' width='40' height='40' style='display:inline-block; vertical-align:middle; margin-right:10px;' onclick='viewImg(this)'/>"
  83. }
  84. var html ="";
  85. html+="<tr>"
  86. html+= "<td class='width-40 c-color'>"+record_date+"</td>"
  87. html+= "<td class='width-60 c-color' style='text-align:left;'>"+img_html+content+"</td>"
  88. html+="</tr>"
  89. tr.innerHTML = html;
  90. tb.appendChild(tr);
  91. }
  92. //查看图片
  93. function viewImg(dom) {
  94. var $img = $(dom);
  95. var thissrc = $img.attr("src");
  96. var mWid = $(window).width();
  97. var mHei = $(window).height();
  98. var nHtml = '<div class="delimgpop"><div class="del-img-box"><div class="del-img-con"><img class="del-pop-img" src="' + thissrc + '" style="max-width:' + mWid + 'px; max-height:' + mHei + 'px;"></div></div></div>';
  99. $("body").append(nHtml);
  100. $(".delimgpop").click(function() {
  101. $(this).remove()
  102. });
  103. };