addRecoveryDown.html 18 KB

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