yongyao.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. function queryYongyaoList(page,pagesize,begindate,enddate) {
  2. //拼请求内容
  3. d.show();
  4. var params = {};
  5. params.page = page;
  6. params.pagesize = pagesize;
  7. params.start = begindate+" 00:00:00";
  8. params.end = enddate+" 23:59:59";
  9. sendPost("patient/health_record/list_medication", params, "json", "post", queryListFailed, queryYongyaoListSuccesss);
  10. }
  11. /**
  12. * 健康指标图表查询成功处理方法
  13. */
  14. function queryYongyaoListSuccesss(res) {
  15. if (res.status == 200) {
  16. d.close();
  17. if (res.list.length > 0) {
  18. showYongyaoList(res.list);
  19. if(res.list.length<10){
  20. $("#view_more_yongyao").hide();
  21. }else{
  22. $("#view_more_yongyao").show();
  23. }
  24. }else{
  25. $("#view_more_yongyao").hide();
  26. }
  27. } else {
  28. //非200则为失败
  29. queryListFailed(res);
  30. }
  31. }
  32. /**
  33. * 显示查询结果
  34. * @param {Object} list
  35. */
  36. function showYongyaoList(list) {
  37. page = page+1;
  38. for (var i = 0; i < list.length; i++) {
  39. var data = list[i];
  40. if (!data) {
  41. continue;
  42. }
  43. addRowYongyao(data.record_date, data.medicines);
  44. }
  45. setTimeout(function () {
  46. scroller1.myScroll.refresh();
  47. }, 1000);
  48. }
  49. /**
  50. * tbody添加一行tr
  51. * @param {Object} dateStr
  52. * @param {Object} value1
  53. * @param {Object} value2
  54. */
  55. function addRowYongyao(date, medicines) {
  56. if(date.length > 5){
  57. date = date.substr(5, 5);
  58. }
  59. if(date){
  60. date = date.replace("-",".");
  61. }
  62. var tb = document.querySelector("#drug_list");
  63. var tr = document.createElement("tr");
  64. var html ="";
  65. html+="<tr>"
  66. html+= "<td class='width-40 c-color'>"+date+"</td>"
  67. html+= "<td class='width-60 c-color'>"+medicines+"</td>"
  68. html+="</tr>"
  69. tr.innerHTML = html;
  70. tb.appendChild(tr);
  71. }