yongyao.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. function queryYongyaoList(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. sendPost("doctor/health_record/list_medication", params, queryListFailed, queryYongyaoListSuccesss);
  12. }
  13. /**
  14. * 健康指标图表查询成功处理方法
  15. */
  16. function queryYongyaoListSuccesss(res) {
  17. if (res.status == 200) {
  18. plus.nativeUI.closeWaiting();
  19. if (res.list.length > 0) {
  20. showYongyaoList(res.list);
  21. if(res.list.length<10){
  22. $("#view_more_yongyao").hide();
  23. }else{
  24. $("#view_more_yongyao").show();
  25. }
  26. }else{
  27. $("#view_more_yongyao").hide();
  28. }
  29. } else {
  30. //非200则为失败
  31. queryListFailed(res);
  32. }
  33. }
  34. /**
  35. * 显示查询结果
  36. * @param {Object} list
  37. */
  38. function showYongyaoList(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. addRowYongyao(data.record_date, data.medicines);
  46. }
  47. setTimeout(function () {
  48. scroller1.refresh();
  49. }, 1000);
  50. }
  51. /**
  52. * tbody添加一行tr
  53. * @param {Object} dateStr
  54. * @param {Object} value1
  55. * @param {Object} value2
  56. */
  57. function addRowYongyao(date, medicines) {
  58. if(date.length > 5){
  59. date = date.substr(5, 5);
  60. }
  61. if(date){
  62. date = date.replace("-",".");
  63. }
  64. var tb = document.querySelector("#drug_list");
  65. var tr = document.createElement("tr");
  66. var html ="";
  67. html+="<tr>"
  68. html+= "<td class='width-40 c-color'>"+date+"</td>"
  69. html+= "<td class='width-60 c-color'>"+medicines+"</td>"
  70. html+="</tr>"
  71. tr.innerHTML = html;
  72. tb.appendChild(tr);
  73. }