re-prescription_detail.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. var d = dialog({
  2. contentType: 'load',
  3. skin: 'bk-popup'
  4. });
  5. var request = GetRequest();
  6. var code = request.code; //从链接中获得处方code
  7. $(function(){
  8. getDetail();
  9. bindEvents();
  10. });
  11. //获取续方详情信息
  12. function getDetail(){
  13. d.show();
  14. var url = "/patient/prescriptionInfo/getContinuedPrescription",
  15. params = {code: code};
  16. sendPost(url, params, 'json', 'get', queryFailed, function(res){
  17. if(res.status == 200){
  18. d.close();
  19. $("#dateTime").text(res.data.prescription.createTime);
  20. $("#docName").text(res.data.prescription.doctorName);
  21. $("#deptName").text(res.data.prescription.hospitalName);
  22. $("#caDoc").text(res.data.prescription.doctorName);
  23. var deseaseText = "";
  24. for(i=0; i<res.data.prescriptionDt.length; i++){
  25. var item = res.data.prescriptionDt[i];
  26. deseaseText += item.healthProblemName + ' ';
  27. }
  28. $("#deseaseDetail").text(deseaseText);
  29. //填充药品信息
  30. var html = template('rp_tmp', {list: res.data.prescriptionInfo});
  31. $("#rpList").empty().append(html);
  32. //获取CA认证的信息
  33. getCAInfo(res.data.prescription.doctor);
  34. }else{
  35. queryFailed(res);
  36. }
  37. });
  38. }
  39. //获取CA认证信息
  40. function getCAInfo(docCode){
  41. var url = '/patient/prescriptionInfo/doctor/isAuthentication',
  42. params = {doctorCode: docCode};
  43. sendPost(url, params, 'json', 'post', queryFailed, function(res){
  44. if(res.status == 200){
  45. //type:1、有证书,并有效;2、有证书,已过期;3、无证书,4
  46. if(res.data.type == 4){
  47. $("#caType").text('已认证');
  48. }else{
  49. $("#caType").text('未认证');
  50. }
  51. }else{
  52. queryFailed(res);
  53. }
  54. });
  55. }
  56. function bindEvents(){
  57. $("#xfRecord").on('click', function(){
  58. //跳转去续方记录页面
  59. var userAgent = window.localStorage.getItem(agentName),
  60. userInfo = JSON.parse(userAgent);
  61. window.location.href = "re-prescription_info.html?code="+code+"&toUser="+userInfo.uid;
  62. });
  63. }
  64. function queryFailed(res){
  65. d.close();
  66. if(res && res.msg) {
  67. dialog({
  68. contentType: 'tipsbox',
  69. skin: 'bk-popup',
  70. content: res.msg
  71. }).show();
  72. } else {
  73. dialog({
  74. contentType: 'tipsbox',
  75. skin: 'bk-popup',
  76. content: '加载失败'
  77. }).show();
  78. }
  79. }