signZkTeam.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>扫码下转</title>
  6. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  7. <link rel="stylesheet" type="text/css" href="../../../css/cross.ui.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  9. <link href="../../../plugins/toastr/toastr.min.css" rel="stylesheet">
  10. <link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
  11. <link rel="stylesheet" type="text/css" href="../css/common.css" />
  12. <style>
  13. body{height: auto}
  14. .c-t-center{text-align: center;}
  15. .teamGroupImg{}
  16. </style>
  17. </head>
  18. <body>
  19. <div id="app" v-cloak>
  20. <div class="qrcode-wrap">
  21. <div class="qrcode-inner c-t-center">
  22. <div>
  23. <img :src="getTeamPhoto(photo)" class="teamGroupImg" width="60px" height="60px" style="border-radius: 100%"/>
  24. <div class="c-333 mt20">{{name}}</div>
  25. </div>
  26. <div class="mt20">
  27. <img :src="qrCodeImg" width="250px" height="250px"/>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  33. <script src="../../../js/jquery-2.2.4.js"></script>
  34. <script src="../../../plugins/layer/layer.min.js"></script>
  35. <script src="../../../plugins/toastr/toastr.min.js"></script>
  36. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  37. <script src="../../../js/bootstrap.min.js"></script>
  38. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  39. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  40. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  41. <script src="../../../api/http-request.js" type="text/javascript"></script>
  42. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  43. <script type="text/javascript" src="../../../api/recover_api.js"></script>
  44. <script type="text/javascript">
  45. var doctorType = (JSON.parse(window.localStorage.getItem('wlyyAgent'))||{}).doctorType
  46. var httpData=GetRequest()
  47. var docInfo = JSON.parse(window.localStorage.getItem("wlyyAgent"));
  48. function showSuccessMessage(msg) {
  49. layer.msg(msg, {
  50. icon: 1
  51. })
  52. }
  53. function showErrorMessage(msg) {
  54. layer.msg(msg, {
  55. icon: 5
  56. })
  57. }
  58. function showWarningMessage(msg) {
  59. layer.msg(msg, {
  60. icon: 2
  61. })
  62. }
  63. function showInfoMessage(msg) {
  64. layer.msg(msg, {
  65. icon: 6
  66. })
  67. }
  68. selectVue = new Vue({
  69. el: "#app",
  70. data: {
  71. id: httpData['id'], // 专科团队code
  72. name: decodeURI(httpData['name']), // 专科团队名称
  73. photo: httpData['photo'], // 专科团队头像
  74. qrCodeImg: '',
  75. is_sign_specialist: false,
  76. is_sign_my: false,
  77. signTeamInfo: {}
  78. },
  79. mounted: function() {
  80. var vm = this
  81. vm.loadSocket()
  82. vm.createSpecialDoctorQrCode()
  83. },
  84. methods: {
  85. loadSocket:function(){
  86. var vm =this;
  87. var imurl = httpRequest.socketUrl;
  88. jQuery.getScript(imurl+"/socket.io/socket.io.js").done(function() {
  89. var socket = io.connect(imurl);
  90. var sessionId = 'system';
  91. socket.emit('login', {userId: docInfo.uid, password: docInfo.uid,sessionId:sessionId,clientType:"doctor"});
  92. socket.on('message', function (data) {
  93. var content=JSON.parse(data.content)
  94. if(content.teamCode){
  95. vm.dialogShow(content)
  96. }else{
  97. layer.alert('居民签约授权失败,请重新扫描下转二维码或选择手动下转', {icon: 5, title: '授权失败'});
  98. }
  99. });
  100. socket.on('error', function (data) {
  101. console.log(data);
  102. });
  103. socket.on('ack', function (data) {
  104. console.log(data);
  105. });
  106. })
  107. .fail(function() {
  108. layer.msg('医生实时对话连接失败!',{icon:5});
  109. });
  110. },
  111. dialogShow: function(data){
  112. var vm = this
  113. if(data.is_sign){ //已家签,要判断居民是否签约该专医团队
  114. var text = "请问您是否确认为"+data.patient_name+"患者进行康复下转?"
  115. var current=layer.confirm(text, {
  116. btn: ['确定', '取消'],
  117. title: "提示"
  118. }, function (index) {
  119. vm.findPatientTeamList(data)
  120. layer.close(current); //再执行关闭
  121. })
  122. } else {
  123. var text = data.patient_name+"患者暂未家签,请先提醒居民签约家庭医生"
  124. var current=layer.confirm(text, {
  125. btn: ['好, 我知道了', '取消'],
  126. title: "提示"
  127. }, function (index) {
  128. top.addRecoveryDownVue.isSignSpecialist(false)
  129. layer.close(current); //再执行关闭
  130. })
  131. }
  132. },
  133. getTeamPhoto: function(photo){
  134. return httpRequest.getImgUrl(photo);
  135. },
  136. //获取团队二维码
  137. createSpecialDoctorQrCode:function(){
  138. var vm=this
  139. var params = {
  140. doctorCode: docInfo.uid,
  141. teamName: vm.name,
  142. teamCode: vm.id,
  143. };
  144. rehaAPI.createSpecialDoctorQrCode(params).then(function(res){
  145. if(res.status == 200) {
  146. vm.qrCodeImg = res.data
  147. } else {
  148. showErrorMessage(res.msg)
  149. }
  150. });
  151. },
  152. // 获取居民签约的专科团队
  153. findPatientTeamList: function(data){
  154. var vm = this,
  155. params = {
  156. patient: data.patient_code
  157. }
  158. rehaAPI.findPatientTeamList(params).then(function(res){
  159. if(res.status == 200) {
  160. var num=0;
  161. $.each(res.data, function(index,item){
  162. if(Number(item.teamCode)==Number(vm.id)){ //签约团队与二维码团队一致
  163. num++
  164. vm.signTeamInfo = item
  165. }
  166. })
  167. if(num>0){//签约团队与二维码团队一致
  168. if(vm.signTeamInfo&&vm.signTeamInfo.doctor != docInfo.uid){
  169. vm.is_sign_specialist = true
  170. vm.is_sign_my = true
  171. } else {
  172. var text = vm.signTeamInfo.patientName+"已签约该专科团队【"+vm.signTeamInfo.doctorName+"】医生,请通过原医生创建康复计划"
  173. layer.alert(text, {icon: 5, title: '提示'});
  174. vm.is_sign_specialist = true
  175. vm.is_sign_my = false
  176. }
  177. top.addRecoveryDownVue.signSpecialist(vm.is_sign_specialist, vm.is_sign_my, data.patient_code)
  178. } else {
  179. vm.createPatientInSpeciaRelation(data)
  180. }
  181. } else {
  182. showErrorMessage(res.msg)
  183. }
  184. })
  185. },
  186. //居民签约专科医生
  187. createPatientInSpeciaRelation:function(data){
  188. var vm = this,
  189. params = {
  190. patient: data.patient_code,
  191. doctor: docInfo.uid,
  192. patientName: data.patient_name,
  193. doctorName: docInfo.name,
  194. teamCode:data.teamCode
  195. }
  196. rehaAPI.createPatientInSpeciaRelation({jsonData:JSON.stringify(params)}).then(function(res){
  197. if(res.status == 200) {
  198. vm.is_sign_specialist = true
  199. vm.is_sign_my = true
  200. top.addRecoveryDownVue.signSpecialist(vm.is_sign_specialist,vm.is_sign_my,data.patient_code)
  201. } else {
  202. showErrorMessage(res.msg);
  203. }
  204. })
  205. },
  206. }
  207. })
  208. </script>
  209. </body>
  210. </html>