addRecoveryDown.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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. </head>
  13. <body class="m0">
  14. <div id="app" class="p15 c-333" v-cloak>
  15. <div class="ui-row flex">
  16. <div class="ui-row-item flex mr50">
  17. <label class="c-999 w-80">专科团队:</label>
  18. <select v-model="curTeamId" class="form-control w-180 h30">
  19. <option :value="o.id" v-for="(o, i) in teamList">{{o.name}}</option>
  20. </select>
  21. </div>
  22. <div class="ui-row-item flex">
  23. <label class="c-999 w-80">患者身份证:</label>
  24. <div>
  25. <input type="text" v-model="searchKey" placeholder="请输入患者身份证查询" class="form-control w-220 h30">
  26. </div>
  27. </div>
  28. <div class="ui-row-item flex">
  29. <button class="btn btn-12B7F5 btn-size-s ml10" @click="onSearch">搜索</button>
  30. <button class="btn btn-12B7F5 btn-size-s ml10" @click="viewQrcodeBox">扫码下转</button>
  31. </div>
  32. </div>
  33. <div v-if="patientInfo" >
  34. <h4 class="m0 h30 c-f14 c-border-b f-w500">家签信息</h4>
  35. <div class="flex mt20">
  36. <div class="flex1 flex c-f14">
  37. <label class="c-999 w-80">患者信息:</label>
  38. <div class="flex1 c-333">{{patientInfo.patientName}}&emsp;{{patientInfo.sex=='1'?'男':'女'}}&emsp;{{patientInfo.age}}岁</div>
  39. </div>
  40. <div class="flex1 flex c-f14">
  41. <label class="c-999 w-80">家签社区:</label>
  42. <div class="flex1 c-333">{{patientInfo.hospitalName}}</div>
  43. </div>
  44. <div class="flex1 flex c-f14">
  45. <label class="c-999 w-80">家签医生:</label>
  46. <div class="flex1 c-333">{{patientInfo.doctorName}}{{patientInfo.doctorHealthName?'、'+patientInfo.doctorHealthName:''}}</div>
  47. </div>
  48. </div>
  49. <h4 class="m0 h30 c-f14 c-border-b f-w500 mt30">患者分类</h4>
  50. <div class="mt20">
  51. <div class="flex vc">
  52. <label class="c-999 w-80">健康情况:</label>
  53. <select v-model="curHealthStatu" class="form-control w-180 h30">
  54. <option v-for="(o, i) in healthLabel" v-bind:value="o.labelCode">{{o.labelName}}</option>
  55. </select>
  56. </div>
  57. <div class="flex mt20">
  58. <label class="c-999 w-80">疾病类型:</label>
  59. <div class="flex1">
  60. <div v-for="(o, i) in diseaseLabel" class="row-line-item w-180">
  61. <label class="checkbox-inline">
  62. <input type="checkbox" v-model="o.flag"/>
  63. <span>{{o.diseaseName}}</span>
  64. </label>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="flex mt20">
  69. <label class="c-999 w-80">自定义分组:</label>
  70. <div class="flex1">
  71. <div v-for="(o, i) in customLabel" class="row-line-item w-180">
  72. <label class="checkbox-inline">
  73. <input type="checkbox" v-model="o.flag"/>
  74. <span>{{o.labelName}}</span>
  75. </label>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="c-t-center mt50">
  81. <button type="button" class="btn btn-12B7F5 btn-size-m" @click="judgePatientInSpecia">保存</button>
  82. </div>
  83. </div>
  84. <div v-else class="c-t-center mt50"><img src="../images/wushuju_img.png" alt=""> <p class="c-999 mt10">{{emptyText}}</p></div>
  85. </div>
  86. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  87. <script src="../../../js/jquery-2.2.4.js"></script>
  88. <script src="../../../plugins/layer/layer.min.js"></script>
  89. <script src="../../../plugins/toastr/toastr.min.js"></script>
  90. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  91. <script src="../../../js/bootstrap.min.js"></script>
  92. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  93. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  94. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  95. <script src="../../../api/http-request.js" type="text/javascript"></script>
  96. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  97. <script type="text/javascript" src="../../../api/sign_api.js"></script>
  98. <script type="text/javascript">
  99. var doctorType = (JSON.parse(window.localStorage.getItem('wlyyAgent'))||{}).level
  100. var httpData=GetRequest()
  101. var docInfo = JSON.parse(window.localStorage.getItem("wlyyAgent"));
  102. var qrcodeBoxIndex;
  103. console.log(httpData)
  104. function showSuccessMessage(msg) {
  105. layer.msg(msg, {
  106. icon: 1
  107. })
  108. }
  109. function showErrorMessage(msg) {
  110. layer.msg(msg, {
  111. icon: 5
  112. })
  113. }
  114. function showWarningMessage(msg) {
  115. layer.msg(msg, {
  116. icon: 2
  117. })
  118. }
  119. function showInfoMessage(msg) {
  120. layer.msg(msg, {
  121. icon: 6
  122. })
  123. }
  124. function signSpecialist(flag, signSpecialist){
  125. console.log('signSpecialist', flag, signSpecialist)
  126. }
  127. top.addRecoveryDownVue = new Vue({
  128. el: "#app",
  129. data: {
  130. pickerOptions1: {
  131. disabledDate: function(time) {
  132. return time.getTime() < Date.now() - 8.64e7;
  133. }
  134. },
  135. patientInfo: undefined,
  136. searchKey: '',
  137. allLabel: {},
  138. customLabel: [],
  139. diseaseLabel: [],
  140. healthLabel: [],
  141. teamList: [], // 专科团队列表
  142. curTeamId: '',
  143. curTeamInfo: {},
  144. teamListObj: {},
  145. curHealthStatu: '',
  146. emptyText: '暂无数据',
  147. is_sign_specialist: false,
  148. is_sign_my: false,
  149. signTeamInfo: {}
  150. },
  151. mounted: function() {
  152. this.getSpecialistTeamList()
  153. },
  154. watch: {
  155. curTeamId: function(){
  156. var vm = this
  157. this.getSpecialistPatientLabel(this.curTeamId)
  158. this.curTeamInfo = this.teamListObj[this.curTeamId]
  159. vm.patientInfo = undefined
  160. }
  161. },
  162. methods: {
  163. signSpecialist: function(is_sign_specialist, is_sign_my, patientCode){
  164. this.is_sign_specialist = is_sign_specialist
  165. this.is_sign_my = is_sign_my
  166. if(patientCode){
  167. this.getPatient(patientCode)
  168. }
  169. layer.close(qrcodeBoxIndex)
  170. },
  171. // 显示二维码窗口
  172. viewQrcodeBox: function(){
  173. var vm=this
  174. qrcodeBoxIndex = layer.open({
  175. type: 2,
  176. // offset: ['100px'], //右下角弹出
  177. area: ['500px', '500px'],
  178. shade: 0.5,
  179. title: '康复下转',
  180. fixed: true, //不固定
  181. maxmin: true,
  182. closeBtn: 1,
  183. shift: 5,
  184. shadeClose: false, //点击遮罩关闭层
  185. content:'../../rehabilitation/html/signZkTeam.html?id=' + vm.curTeamInfo.id + '&name='+ vm.curTeamInfo.name+'&photo='+vm.curTeamInfo.photo,
  186. end: function() { // 未点击确定按钮,点击关闭按钮
  187.   
  188. }
  189. });
  190. },
  191. // 获取下转居民列表
  192. onSearch: function(){
  193. if(this.searchKey.trim().length==0){
  194. showWarningMessage('请输入居民身份证进行查询!')
  195. return false;
  196. }
  197. this.getRehabilitationPatientList(this.searchKey)
  198. },
  199. // 根据身份证号码获取家签居民
  200. getRehabilitationPatientList: function(value){
  201. var vm = this,
  202. loading = layer.load(0, {shade: false})
  203. var params = {
  204. idcard: value
  205. }
  206. rehaAPI.getRehabilitationPatientList(params).then(function(res){
  207. layer.close(loading)
  208. if(res.status == 200) {
  209. if(res.data.length>0){
  210. vm.patientInfo = res.data[0]
  211. vm.getPatientLabelInfo()
  212. // 获取签约专科信息
  213. vm.findPatientTeamList()
  214. } else {
  215. vm.patientInfo = undefined
  216. vm.emptyText = '患者暂未家签,请先提醒患者完成家庭医生签约'
  217. }
  218. } else {
  219. showErrorMessage(res.msg);
  220. }
  221. })
  222. },
  223. // 根据居民code 查找居民
  224. getPatient: function(patient){
  225. var vm = this
  226. var params = {
  227. patient: patient
  228. }
  229. signAPI.getPatient(params).then(function(res){
  230. if(res.status==200){
  231. if(res.data){
  232. var result = res.data
  233. vm.patientInfo = {}
  234. vm.patientInfo['patient'] = result.code
  235. vm.patientInfo['patientName'] = result.name
  236. vm.patientInfo['sex'] = result.sex
  237. vm.patientInfo['age'] = result.age
  238. vm.patientInfo['hospitalName'] = result.jtHospitalName
  239. vm.patientInfo['doctorName'] = result.jtDoctorName
  240. vm.patientInfo['doctorHealthName'] = result.jtDoctorHealthName
  241. vm.$forceUpdate()
  242. vm.getPatientLabelInfo()
  243. // 获取签约专科信息
  244. vm.findPatientTeamList()
  245. }
  246. console.log('res', res)
  247. } else {
  248. showErrorMessage('获取居民信息失败!')
  249. }
  250. })
  251. },
  252. getSpecialistTeamList: function(){
  253. var vm = this,
  254. loading = layer.load(0, {shade: false})
  255. var params = {
  256. doctor: docInfo.uid
  257. }
  258. rehaAPI.getSpecialistTeamList(params).then(function(res){
  259. layer.close(loading)
  260. if(res.status == 200) {
  261. vm.teamList = res.data || []
  262. vm.curTeamId = vm.teamList[0].id
  263. vm.curTeamInfo = vm.teamList[0]
  264. vm.teamListObj = {}
  265. $.each(res.data, function(index, o){
  266. vm.teamListObj[o.id] = o
  267. })
  268. } else {
  269. showErrorMessage(res.msg);
  270. }
  271. })
  272. },
  273. // 获取居民标签(健康情况、疾病类型、自定义分组)
  274. getPatientLabelInfo: function(){
  275. var vm = this,
  276. loading = layer.load(0, {shade: false})
  277. var params = {
  278. patient: vm.patientInfo.patient // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  279. }
  280. rehaAPI.getPatientLabelInfo(params).then(function(res){
  281. layer.close(loading)
  282. if(res.status == 200) {
  283. var healthLabel = res.data['healthLabel']||[],
  284. diseaseLabel = res.data['diseaseServer']||[],
  285. customLabel = res.data['customLabel']||[];
  286. vm.patientInfo.healthLabel = healthLabel
  287. vm.patientInfo.diseaseLabel = diseaseLabel
  288. vm.patientInfo.customLabel = customLabel
  289. vm.initLabelData()
  290. } else {
  291. showErrorMessage(res.msg);
  292. }
  293. })
  294. },
  295. initLabelData: function(){
  296. var vm = this
  297. var dLabel = [], cLabel = [];
  298. $.each(vm.allLabel['diseaseLabel'], function(index, o){
  299. o.flag = false
  300. o.disease = o.code
  301. o.diseaseName = o.name
  302. $.each(vm.patientInfo.diseaseLabel, function(index1, o1){
  303. if(o1.disease == o.code){
  304. o.flag = true
  305. }
  306. })
  307. dLabel.push(o)
  308. })
  309. $.each(vm.allLabel['customLabel'], function(index, o){
  310. o.flag = false
  311. o.labelCode = o.labelCode
  312. o.labelName = o.labelName
  313. $.each(vm.patientInfo.customLabel, function(index1, o1){
  314. if(o1.label == o.labelCode){
  315. o.flag = true
  316. }else{
  317. }
  318. })
  319. if(o.isSystem!=1){
  320. cLabel.push(o)
  321. }
  322. })
  323. vm.healthLabel = vm.allLabel['healthLabel'] || []
  324. vm.curHealthStatu = vm.patientInfo.healthLabel&&vm.patientInfo.healthLabel.length>0?vm.patientInfo.healthLabel[0].label:res.data['healthLabel'][0].labelCode
  325. vm.diseaseLabel = dLabel
  326. vm.customLabel = cLabel
  327. },
  328. // 获取居民标签字典(健康情况、疾病类型、自定义分组)
  329. getSpecialistPatientLabel: function(teamId){
  330. var vm = this,
  331. loading = layer.load(0, {shade: false})
  332. var params = {
  333. teamCode: teamId
  334. }
  335. rehaAPI.getSpecialistPatientLabel(params).then(function(res){
  336. layer.close(loading)
  337. if(res.status==200){
  338. vm.allLabel = res.data
  339. }else{
  340. showErrorMessage(res.msg);
  341. }
  342. })
  343. },
  344. // 获取居民签约的专科团队
  345. findPatientTeamList: function(){
  346. var vm = this,
  347. params = {
  348. patient: vm.patientInfo.patient
  349. }
  350. rehaAPI.findPatientTeamList(params).then(function(res){
  351. if(res.status == 200) {
  352. var num = 0
  353. $.each(res.data, function(index,item){
  354. if(item.teamCode==vm.curTeamInfo.id){ //签约团队与二维码团队一致
  355. num++
  356. vm.signTeamInfo = item
  357. }
  358. })
  359. if(num>0){
  360. if(vm.signTeamInfo&&vm.signTeamInfo.doctor == docInfo.uid){
  361. vm.is_sign_specialist = true
  362. vm.is_sign_my = true
  363. } else {
  364. var text = vm.patientInfo.patientName+"已签约该专科团队【"+vm.signTeamInfo.doctorName+"】医生,请通过原医生创建康复计划"
  365. layer.alert(text, {icon: 5, title: '提示'});
  366. vm.is_sign_specialist = true
  367. vm.is_sign_my = false
  368. }
  369. } else {
  370. vm.is_sign_specialist = false
  371. vm.is_sign_my = false
  372. }
  373. } else {
  374. showErrorMessage(res.msg)
  375. }
  376. })
  377. },
  378. //居民未与扫描的二维码团队对应
  379. createPatientInSpeciaRelation:function(data){
  380. return new Promise(function (resolve, reject) {
  381. var vm = this,
  382. params = {
  383. patient: data.patient_code,
  384. doctor: docInfo.uid,
  385. patientName: data.patient_name,
  386. doctorName: docInfo.name,
  387. teamCode:data.teamCode
  388. }
  389. rehaAPI.createPatientInSpeciaRelation({jsonData:JSON.stringify(params)}).then(function(res){
  390. // if(res.data&&res.data.status == 200) {
  391. // resolve(res)
  392. // } else {
  393. // showErrorMessage(res.msg);
  394. // reject(res)
  395. // }
  396. resolve(res)
  397. })
  398. })
  399. },
  400. judgePatientInSpecia: function(){
  401. var vm = this
  402. if(!vm.patientInfo){return false}
  403. if(!vm.is_sign_specialist){
  404. var text = "请问您是否确认为"+vm.patientInfo.patientName+"患者进行康复下转?"
  405. var current=layer.confirm(text, {
  406. btn: ['确定', '取消'],
  407. title: "提示"
  408. }, function (index) {
  409. vm.createPatientInSpeciaRelation({
  410. patient_code: vm.patientInfo.patient,
  411. patient_name: vm.patientInfo.patientName,
  412. teamCode: vm.curTeamInfo.id
  413. }).then(function(res){
  414. vm.is_sign_specialist = true
  415. vm.is_sign_my = true
  416. setTimeout(function(){
  417. vm.saveBtn()
  418. }, 500)
  419. })
  420. })
  421. } else {
  422. if(vm.is_sign_my){
  423. vm.saveBtn()
  424. } else {
  425. var text = vm.patientInfo.patientName+"已签约该专科团队【"+vm.signTeamInfo.doctorName+"】医生,请通过原医生创建康复计划"
  426. layer.alert(text, {icon: 5, title: '签约失败'});
  427. return
  428. }
  429. }
  430. },
  431. saveBtn: function(){
  432. var vm = this, num1 = 0, num2 = 0,
  433. health = {}, disease = [], custom = []
  434. if(!vm.curHealthStatu){
  435. showWarningMessage('请选择健康情况!')
  436. return false
  437. }
  438. $.each(vm.healthLabel, function(index, o){
  439. if(o.labelCode == vm.curHealthStatu){
  440. health = {
  441. label: o.labelCode,
  442. labelName: o.labelName,
  443. labelType: o.labelType
  444. }
  445. }
  446. })
  447. for(var i=0; i<vm.diseaseLabel.length; i++){
  448. var o = vm.diseaseLabel[i]
  449. if(!o.flag){
  450. num1++
  451. } else {
  452. disease.push({
  453. disease: o.disease,
  454. diseaseName: o.diseaseName
  455. })
  456. }
  457. if(num1==vm.diseaseLabel.length){
  458. showWarningMessage('请选择疾病类型!')
  459. return false
  460. }
  461. }
  462. for(var i=0; i<vm.customLabel.length; i++){
  463. var o = vm.customLabel[i]
  464. if(!o.flag){
  465. num2++
  466. } else {
  467. custom.push({
  468. label: o.labelCode,
  469. labelName: o.labelName,
  470. labelType: o.labelType
  471. })
  472. }
  473. // if(num2==vm.customLabel.length){
  474. // showWarningMessage('请选择自定义分组!')
  475. // return false
  476. // }
  477. }
  478. var data = {
  479. health: health,
  480. disease: disease,
  481. custom: custom
  482. }
  483. var params = {
  484. patient: vm.patientInfo.patient, // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  485. patientName: vm.patientInfo.patientName,
  486. json: JSON.stringify(data),
  487. teamCode: vm.curTeamInfo.id
  488. }
  489. var loading = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  490. rehaAPI.updatePatientLabelInfo(params).then(function(res){
  491. layer.close(loading);
  492. if(res.status==200){
  493. layer.confirm('康复下转基本信息保存成功,请为患者创建康复计划', { btn: ['创建康复计划', '取消'], title: "康复下转" }, function (index) {
  494. window.location.href="../../recover/html/new_recover.html?patient="+vm.patientInfo.patient + '&teamCode='+vm.curTeamInfo.id
  495. })
  496. }else{
  497. showErrorMessage(res.msg)
  498. }
  499. })
  500. }
  501. }
  502. })
  503. </script>
  504. </body>
  505. </html>