addRecoveryDown.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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'))||{}).doctorType
  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. top.addRecoveryDownVue = new Vue({
  125. el: "#app",
  126. data: {
  127. pickerOptions1: {
  128. disabledDate: function(time) {
  129. return time.getTime() < Date.now() - 8.64e7;
  130. }
  131. },
  132. patientInfo: undefined,
  133. searchKey: '',
  134. allLabel: {},
  135. customLabel: [],
  136. diseaseLabel: [],
  137. healthLabel: [],
  138. teamList: [], // 专科团队列表
  139. curTeamId: '',
  140. curTeamInfo: {},
  141. teamListObj: {},
  142. curHealthStatu: '',
  143. emptyText: '暂无数据',
  144. is_sign_specialist: false,
  145. is_sign_my: false,
  146. signTeamInfo: {}
  147. },
  148. mounted: function() {
  149. this.getSpecialistTeamList()
  150. },
  151. watch: {
  152. curTeamId: function(){
  153. var vm = this
  154. this.getSpecialistPatientLabel(this.curTeamId)
  155. this.curTeamInfo = this.teamListObj[this.curTeamId]
  156. vm.patientInfo = undefined
  157. }
  158. },
  159. methods: {
  160. signSpecialist: function(is_sign_specialist, is_sign_my, patientCode){
  161. this.is_sign_specialist = is_sign_specialist
  162. this.is_sign_my = is_sign_my
  163. if(patientCode){
  164. this.getPatient(patientCode)
  165. }
  166. layer.close(qrcodeBoxIndex)
  167. },
  168. // 显示二维码窗口
  169. viewQrcodeBox: function(){
  170. var vm=this
  171. qrcodeBoxIndex = layer.open({
  172. type: 2,
  173. // offset: ['100px'], //右下角弹出
  174. area: ['500px', '500px'],
  175. shade: 0.5,
  176. title: '康复下转',
  177. fixed: true, //不固定
  178. maxmin: true,
  179. closeBtn: 1,
  180. shift: 5,
  181. shadeClose: false, //点击遮罩关闭层
  182. content:'../../rehabilitation/html/signZkTeam.html?id=' + vm.curTeamInfo.id + '&name='+ vm.curTeamInfo.name+'&photo='+vm.curTeamInfo.photo,
  183. end: function() { // 未点击确定按钮,点击关闭按钮
  184.   
  185. }
  186. });
  187. },
  188. // 获取下转居民列表
  189. onSearch: function(){
  190. if(this.searchKey.trim().length==0){
  191. showWarningMessage('请输入居民身份证进行查询!')
  192. return false;
  193. }
  194. this.getRehabilitationPatientList(this.searchKey)
  195. },
  196. // 根据身份证号码获取家签居民
  197. getRehabilitationPatientList: function(value){
  198. var vm = this,
  199. loading = layer.load(0, {shade: false})
  200. var params = {
  201. idcard: value
  202. }
  203. rehaAPI.getRehabilitationPatientList(params).then(function(res){
  204. layer.close(loading)
  205. if(res.status == 200) {
  206. if(res.data.length>0){
  207. vm.patientInfo = res.data[0]
  208. vm.getPatientLabelInfo()
  209. // 获取签约专科信息
  210. vm.findPatientTeamList()
  211. } else {
  212. vm.patientInfo = undefined
  213. vm.emptyText = '患者暂未家签,请先提醒患者完成家庭医生签约'
  214. }
  215. } else {
  216. showErrorMessage(res.msg);
  217. }
  218. })
  219. },
  220. // 根据居民code 查找居民
  221. getPatient: function(patient){
  222. var vm = this
  223. var params = {
  224. patient: patient
  225. }
  226. signAPI.getPatient(params).then(function(res){
  227. if(res.status==200){
  228. if(res.data){
  229. var result = res.data
  230. vm.patientInfo = {}
  231. vm.patientInfo['patient'] = result.code
  232. vm.patientInfo['patientName'] = result.name
  233. vm.patientInfo['sex'] = result.sex
  234. vm.patientInfo['age'] = result.age
  235. vm.patientInfo['hospitalName'] = result.jtHospitalName
  236. vm.patientInfo['doctorName'] = result.jtDoctorName
  237. vm.patientInfo['doctorHealthName'] = result.jtDoctorHealthName
  238. vm.$forceUpdate()
  239. vm.getPatientLabelInfo()
  240. // 获取签约专科信息
  241. vm.findPatientTeamList()
  242. }
  243. console.log('res', res)
  244. } else {
  245. showErrorMessage('获取居民信息失败!')
  246. }
  247. })
  248. },
  249. getSpecialistTeamList: function(){
  250. var vm = this,
  251. loading = layer.load(0, {shade: false})
  252. var params = {
  253. doctor: docInfo.uid
  254. }
  255. rehaAPI.getSpecialistTeamList(params).then(function(res){
  256. layer.close(loading)
  257. if(res.status == 200) {
  258. vm.teamList = res.data || []
  259. vm.curTeamId = vm.teamList[0].id
  260. vm.curTeamInfo = vm.teamList[0]
  261. vm.teamListObj = {}
  262. $.each(res.data, function(index, o){
  263. vm.teamListObj[o.id] = o
  264. })
  265. } else {
  266. showErrorMessage(res.msg);
  267. }
  268. })
  269. },
  270. // 获取居民标签(健康情况、疾病类型、自定义分组)
  271. getPatientLabelInfo: function(){
  272. var vm = this,
  273. loading = layer.load(0, {shade: false})
  274. var params = {
  275. patient: vm.patientInfo.patient // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  276. }
  277. rehaAPI.getPatientLabelInfo(params).then(function(res){
  278. layer.close(loading)
  279. if(res.status == 200) {
  280. var healthLabel = res.data['healthLabel']||[],
  281. diseaseLabel = res.data['diseaseServer']||[],
  282. customLabel = res.data['customLabel']||[];
  283. vm.patientInfo.healthLabel = healthLabel
  284. vm.patientInfo.diseaseLabel = diseaseLabel
  285. vm.patientInfo.customLabel = customLabel
  286. vm.initLabelData()
  287. } else {
  288. showErrorMessage(res.msg);
  289. }
  290. })
  291. },
  292. initLabelData: function(){
  293. var vm = this
  294. var dLabel = [], cLabel = [];
  295. $.each(vm.allLabel['diseaseLabel'], function(index, o){
  296. o.flag = false
  297. o.disease = o.code
  298. o.diseaseName = o.name
  299. $.each(vm.patientInfo.diseaseLabel, function(index1, o1){
  300. if(o1.disease == o.code){
  301. o.flag = true
  302. }
  303. })
  304. dLabel.push(o)
  305. })
  306. $.each(vm.allLabel['customLabel'], function(index, o){
  307. o.flag = false
  308. o.labelCode = o.labelCode
  309. o.labelName = o.labelName
  310. $.each(vm.patientInfo.customLabel, function(index1, o1){
  311. if(o1.label == o.labelCode){
  312. o.flag = true
  313. }else{
  314. }
  315. })
  316. if(o.isSystem!=1){
  317. cLabel.push(o)
  318. }
  319. })
  320. vm.healthLabel = vm.allLabel['healthLabel'] || []
  321. vm.curHealthStatu = vm.patientInfo.healthLabel&&vm.patientInfo.healthLabel.length>0?vm.patientInfo.healthLabel[0].label:res.data['healthLabel'][0].labelCode
  322. vm.diseaseLabel = dLabel
  323. vm.customLabel = cLabel
  324. },
  325. // 获取居民标签字典(健康情况、疾病类型、自定义分组)
  326. getSpecialistPatientLabel: function(teamId){
  327. var vm = this,
  328. loading = layer.load(0, {shade: false})
  329. var params = {
  330. teamCode: teamId
  331. }
  332. rehaAPI.getSpecialistPatientLabel(params).then(function(res){
  333. layer.close(loading)
  334. if(res.status==200){
  335. vm.allLabel = res.data
  336. }else{
  337. showErrorMessage(res.msg);
  338. }
  339. })
  340. },
  341. // 获取居民签约的专科团队
  342. findPatientTeamList: function(){
  343. var vm = this,
  344. params = {
  345. patient: vm.patientInfo.patient
  346. }
  347. rehaAPI.findPatientTeamList(params).then(function(res){
  348. if(res.status == 200) {
  349. var num = 0
  350. $.each(res.data, function(index,item){
  351. if(item.teamCode==vm.curTeamInfo.id){ //签约团队与二维码团队一致
  352. num++
  353. vm.signTeamInfo = item
  354. }
  355. })
  356. if(num>0){
  357. if(vm.signTeamInfo&&vm.signTeamInfo.doctor == docInfo.uid){
  358. vm.is_sign_specialist = true
  359. vm.is_sign_my = true
  360. } else {
  361. var text = vm.patientInfo.patientName+"已签约该专科团队【"+vm.signTeamInfo.doctorName+"】医生,请通过原医生创建康复计划"
  362. layer.alert(text, {icon: 5, title: '提示'});
  363. vm.is_sign_specialist = true
  364. vm.is_sign_my = false
  365. }
  366. } else {
  367. vm.is_sign_specialist = false
  368. vm.is_sign_my = false
  369. }
  370. } else {
  371. showErrorMessage(res.msg)
  372. }
  373. })
  374. },
  375. //居民未与扫描的二维码团队对应
  376. createPatientInSpeciaRelation:function(data){
  377. return new Promise(function (resolve, reject) {
  378. var vm = this,
  379. params = {
  380. patient: data.patient_code,
  381. doctor: docInfo.uid,
  382. patientName: data.patient_name,
  383. doctorName: docInfo.name,
  384. teamCode:data.teamCode
  385. }
  386. rehaAPI.createPatientInSpeciaRelation({jsonData:JSON.stringify(params)}).then(function(res){
  387. resolve(res)
  388. })
  389. })
  390. },
  391. judgePatientInSpecia: function(){
  392. var vm = this
  393. if(!vm.patientInfo){return false}
  394. if(!vm.is_sign_specialist){
  395. var text = "请问您是否确认为"+vm.patientInfo.patientName+"患者进行康复下转?"
  396. var current=layer.confirm(text, {
  397. btn: ['确定', '取消'],
  398. title: "提示"
  399. }, function (index) {
  400. vm.createPatientInSpeciaRelation({
  401. patient_code: vm.patientInfo.patient,
  402. patient_name: vm.patientInfo.patientName,
  403. teamCode: vm.curTeamInfo.id
  404. }).then(function(res){
  405. vm.is_sign_specialist = true
  406. vm.is_sign_my = true
  407. setTimeout(function(){
  408. vm.saveBtn()
  409. }, 500)
  410. })
  411. })
  412. } else {
  413. if(vm.is_sign_my){
  414. vm.saveBtn()
  415. } else {
  416. var text = vm.patientInfo.patientName+"已签约该专科团队【"+vm.signTeamInfo.doctorName+"】医生,请通过原医生创建康复计划"
  417. layer.alert(text, {icon: 5, title: '签约失败'});
  418. return
  419. }
  420. }
  421. },
  422. saveBtn: function(){
  423. var vm = this, num1 = 0, num2 = 0,
  424. health = {}, disease = [], custom = []
  425. if(!vm.curHealthStatu){
  426. showWarningMessage('请选择健康情况!')
  427. return false
  428. }
  429. $.each(vm.healthLabel, function(index, o){
  430. if(o.labelCode == vm.curHealthStatu){
  431. health = {
  432. label: o.labelCode,
  433. labelName: o.labelName,
  434. labelType: o.labelType
  435. }
  436. }
  437. })
  438. for(var i=0; i<vm.diseaseLabel.length; i++){
  439. var o = vm.diseaseLabel[i]
  440. if(!o.flag){
  441. num1++
  442. } else {
  443. disease.push({
  444. disease: o.disease,
  445. diseaseName: o.diseaseName
  446. })
  447. }
  448. if(num1==vm.diseaseLabel.length){
  449. showWarningMessage('请选择疾病类型!')
  450. return false
  451. }
  452. }
  453. for(var i=0; i<vm.customLabel.length; i++){
  454. var o = vm.customLabel[i]
  455. if(!o.flag){
  456. num2++
  457. } else {
  458. custom.push({
  459. label: o.labelCode,
  460. labelName: o.labelName,
  461. labelType: o.labelType
  462. })
  463. }
  464. // if(num2==vm.customLabel.length){
  465. // showWarningMessage('请选择自定义分组!')
  466. // return false
  467. // }
  468. }
  469. var data = {
  470. health: health,
  471. disease: disease,
  472. custom: custom
  473. }
  474. var params = {
  475. patient: vm.patientInfo.patient, // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  476. patientName: vm.patientInfo.patientName,
  477. json: JSON.stringify(data),
  478. teamCode: vm.curTeamInfo.id
  479. }
  480. var loading = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  481. rehaAPI.updatePatientLabelInfo(params).then(function(res){
  482. layer.close(loading);
  483. if(res.status==200){
  484. layer.confirm('康复下转基本信息保存成功,请为患者创建康复计划', { btn: ['创建康复计划', '取消'], title: "康复下转" }, function (index) {
  485. window.location.href="../../recover/html/new_recover.html?patient="+vm.patientInfo.patient + '&teamCode='+vm.curTeamInfo.id
  486. })
  487. }else{
  488. showErrorMessage(res.msg)
  489. }
  490. })
  491. }
  492. }
  493. })
  494. </script>
  495. </body>
  496. </html>