device.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>设备</title>
  7. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  9. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  10. <link rel="stylesheet" href="../../../plugins/toastr/toastr.min.css" />
  11. <link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/date.css" />
  13. <link rel="stylesheet" href="../css/common.css" />
  14. <style>
  15. #app {
  16. padding: 20px;
  17. position: relative;
  18. height: 100%;
  19. }
  20. .box {
  21. display: flex;
  22. flex-wrap: wrap;
  23. padding: 12px;
  24. }
  25. .item {
  26. display: flex;
  27. flex-direction: column;
  28. align-items: center;
  29. }
  30. .item .img-box {
  31. width: 200px;
  32. height: 200px;
  33. background-color: #fff;
  34. display: flex;
  35. align-items: center;
  36. justify-content: center;
  37. }
  38. .item img {
  39. width: 100px;
  40. }
  41. .device-info {
  42. display: flex;
  43. flex-direction: column;
  44. align-items: center;
  45. font-size: 18px;
  46. }
  47. .device-info img {
  48. width: 180px;
  49. margin: 10px 0;
  50. }
  51. .form-item {
  52. display: flex;
  53. align-items: center;
  54. margin-bottom: 10px;
  55. }
  56. .form-item .form-label {
  57. width: 70px;
  58. }
  59. .title {
  60. font-size: 18px;
  61. position: relative;
  62. margin-left: 6px;
  63. margin-bottom: 10px;
  64. }
  65. .title::before {
  66. content: '';
  67. width: 3px;
  68. height: 14px;
  69. position: absolute;
  70. left: -8px;
  71. top: 50%;
  72. transform: translateY(-50%);
  73. background-color: #17b3ec;
  74. }
  75. .ml6 {
  76. margin-left: 6px;
  77. }
  78. .add-device-btn {
  79. position: absolute;
  80. bottom: 28px;
  81. left: 50%;
  82. transform: translateX(-50%);
  83. width: 400px;
  84. }
  85. .back-btn{
  86. position: absolute;
  87. bottom: 80px;
  88. left: 50%;
  89. transform: translateX(-47.5%);
  90. width: 400px;
  91. }
  92. </style>
  93. </head>
  94. <body>
  95. <div id="app" v-cloak>
  96. <template v-if="step==1">
  97. <el-tabs v-model="active" type="card" @tab-click="tabChange">
  98. <el-tab-pane label="血压计" name="xueya" class="box">
  99. <div v-for="item in xueyaList" :id="item.id" class="item" @click="selectItem(item)">
  100. <div class="img-box">
  101. <img :src="item.photo" alt="" v-if="item.photo!=''" />
  102. <img src="../../../images/img.png" alt="" v-else />
  103. </div>
  104. <span>{{item.name}}</span>
  105. </div>
  106. </el-tab-pane>
  107. <el-tab-pane label="智能手表" name="watch" class="box">
  108. <div v-for="item in watchList" :id="item.id" class="item" @click="selectItem(item)">
  109. <div class="img-box">
  110. <img :src="item.photo" alt="" v-if="item.photo!=''" />
  111. <img src="../../../images/img.png" alt="" v-else />
  112. </div>
  113. <span>{{item.name}}</span>
  114. </div>
  115. </el-tab-pane>
  116. <el-tab-pane label="血糖仪" name="xuetang" class="box">
  117. <div v-for="item in xuetangList" :id="item.id" class="item" @click="selectItem(item)">
  118. <div class="img-box">
  119. <img :src="item.photo" alt="" v-if="item.photo!=''" />
  120. <img src="../../../images/img.png" alt="" v-else />
  121. </div>
  122. <span>{{item.name}}</span>
  123. </div>
  124. </el-tab-pane>
  125. </el-tabs>
  126. </template>
  127. <template v-else>
  128. <div class="device-info">
  129. <span>{{deviceObj.name}}</span>
  130. <img :src="deviceObj.photo" alt="" />
  131. </div>
  132. <div v-if="deviceObj.categoryCode == 2">
  133. <div class="form-item">
  134. <div class="form-label">SN码</div>
  135. <el-input v-model="query.deviceSn" :disabled="dataId" placeholder="请输入设备唯一码"></el-input>
  136. </div>
  137. <div class="form-item" v-if="deviceObj.deviceId == 6">
  138. <div class="form-label">SIM码</div>
  139. <el-input v-model="query.sim" :disabled="dataId" placeholder="请输入SIM码"></el-input>
  140. </div>
  141. <div v-if="deviceObj.isMultiUser == 1">
  142. <div class="title">绑定快捷键</div>
  143. <div v-for="(value, key) in deviceObj.multiUser">
  144. <el-radio v-model="query.userType" :disabled="dataId" :label="key" class="ml6">{{value}}</el-radio>
  145. </div>
  146. </div>
  147. 绑定后,从该快捷键上传的数据将导入您的健康记录中!
  148. </div>
  149. <div v-else-if="deviceObj.categoryCode == 4">
  150. <div class="form-item">
  151. <div class="form-label">IMEI码</div>
  152. <el-input v-model="query.deviceSn" :disabled="dataId" placeholder="请输入设备唯一码"></el-input>
  153. </div>
  154. 绑定后,智能手表监测的心率数据将自动同步导入您的健康记录中!
  155. </div>
  156. <div v-else>
  157. <div class="form-item">
  158. <div class="form-label">SN码</div>
  159. <el-input v-model="query.deviceSn" :disabled="dataId" placeholder="请输入设备唯一码"></el-input>
  160. </div>
  161. 绑定后,血氧仪测量的数据将自动同步导入您的健康记录中!
  162. </div>
  163. <el-button class="back-btn" v-if="!dataId" @click="backFn">返回</el-button>
  164. <el-button class="add-device-btn" v-if="!dataId" type="primary" @click="bindDeviceFn">立即绑定</el-button>
  165. </template>
  166. </div>
  167. <script type="text/javascript" src="../../../js/vue.js"></script>
  168. <script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
  169. <script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
  170. <script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
  171. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  172. <script type="text/javascript" src="../../../api/http-request.js"></script>
  173. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  174. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  175. <script type="text/javascript" src="../../../api/recover_api.js"></script>
  176. <script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
  177. <script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
  178. <script>
  179. new Vue({
  180. el: '#app',
  181. data() {
  182. return {
  183. active: 'xueya',
  184. patient: '',
  185. step: 1,
  186. query: {},
  187. xueyaList: [],
  188. watchList: [],
  189. xuetangList: [],
  190. deviceObj: {},
  191. deviceId: null,
  192. dataId: null
  193. }
  194. },
  195. methods: {
  196. initData() {
  197. const vm = this
  198. httpRequest.get('common/device/DeviceInfo', { data: { id: this.deviceId } }).then(function (res) {
  199. vm.deviceObj = res.data
  200. if(vm.deviceObj.isMultiUser == 1){
  201. vm.deviceObj.multiUser = JSON.parse(res.data.multiUser)
  202. }
  203. })
  204. httpRequest.get('doctor/device/PatientDeviceInfo',{data:{id: this.dataId}}).then(function(res){
  205. vm.query = {
  206. deviceSn: res.data.deviceSn,
  207. sim: res.data.sim,
  208. userType: res.data.userType
  209. }
  210. console.log(vm.query);
  211. })
  212. },
  213. tabChange(val) {
  214. switch (val.name) {
  215. case 'xueya':
  216. this.getXueyaList()
  217. break
  218. case 'watch':
  219. this.getWatchList()
  220. break
  221. case 'xuetang':
  222. this.getXuetangList()
  223. break
  224. }
  225. },
  226. getXueyaList() {
  227. const vm = this
  228. httpRequest.get('common/device/DeviceList', { data: { category_code: 2 } }).then(function (res) {
  229. vm.xueyaList = res.data
  230. })
  231. },
  232. getWatchList() {
  233. const vm = this
  234. httpRequest.get('common/device/DeviceList', { data: { category_code: 4 } }).then(function (res) {
  235. vm.watchList = res.data
  236. })
  237. },
  238. getXuetangList() {
  239. const vm = this
  240. httpRequest.get('common/device/DeviceList', { data: { category_code: 1 } }).then(function (res) {
  241. vm.xuetangList = res.data
  242. })
  243. },
  244. selectItem(item) {
  245. const vm = this
  246. httpRequest.get('common/device/DeviceInfo', { data: { id: item.id } }).then(function (res) {
  247. vm.step++
  248. vm.deviceObj = res.data
  249. if(vm.deviceObj.isMultiUser == 1){
  250. vm.deviceObj.multiUser = JSON.parse(res.data.multiUser)
  251. }
  252. vm.query = {}
  253. })
  254. },
  255. bindDeviceFn() {
  256. return
  257. const vm = this
  258. var b = /^[0-9a-zA-Z]*$/g
  259. if (!b.test(this.device_sn)) {
  260. this.$message.warning('对不起,您输入的SN有误,请重新输入')
  261. }
  262. let params = {
  263. device_sn: this.query.deviceSn,
  264. patient: this.patient,
  265. type: this.deviceObj.categoryCode
  266. }
  267. httpRequest.get('doctor/device/PatientDeviceIdcard', { data: params }).then(function (res) {
  268. })
  269. },
  270. backFn(){
  271. this.step = 1
  272. }
  273. },
  274. mounted() {
  275. this.getXueyaList()
  276. this.patient = GetRequest().patient
  277. this.deviceId = GetRequest().deviceId
  278. this.dataId = GetRequest().id
  279. if (this.dataId) {
  280. this.step = 2
  281. this.initData()
  282. }
  283. }
  284. })
  285. </script>
  286. </body>
  287. </html>