addRecoveryDown.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  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. // isTurnDown String 类型是否已下转 -2:未下转未家签,-1未下转 0未下转全部,;1已下转(未接收);2已下转(已接收);3已下转全部;03已下转全部+未下转全部
  249. getRehabilitationPatientList: function(value){
  250. var vm = this,
  251. loading = layer.load(0, {shade: false})
  252. var params = {
  253. idcard: value,
  254. isTurnDown: '03'
  255. }
  256. rehaAPI.getRehabilitationPatientList(params).then(function(res){
  257. layer.close(loading)
  258. if(res.status == 200) {
  259. if(res.data.length>0){
  260. vm.patientInfo = res.data[0]
  261. vm.getPatientLabelInfo()
  262. // 获取签约专科信息
  263. vm.findPatientTeamList()
  264. } else {
  265. vm.patientInfo = undefined
  266. vm.emptyText = '患者暂未家签,请先提醒患者完成家庭医生签约'
  267. }
  268. } else {
  269. showErrorMessage(res.msg);
  270. }
  271. })
  272. },
  273. // 根据居民code 查找居民
  274. getPatient: function(patient){
  275. var vm = this
  276. var params = {
  277. patient: patient
  278. }
  279. signAPI.getPatient(params).then(function(res){
  280. if(res.status==200){
  281. if(res.data){
  282. var result = res.data
  283. vm.patientInfo = {}
  284. vm.patientInfo['patient'] = result.code
  285. vm.patientInfo['patientName'] = result.name
  286. vm.patientInfo['sex'] = result.sex
  287. vm.patientInfo['age'] = result.age
  288. vm.patientInfo['hospitalName'] = result.jtHospitalName
  289. vm.patientInfo['doctorName'] = result.jtDoctorName
  290. vm.patientInfo['doctorHealthName'] = result.jtDoctorHealthName
  291. vm.$forceUpdate()
  292. vm.getPatientLabelInfo()
  293. // 获取签约专科信息
  294. vm.findPatientTeamList()
  295. }
  296. console.log('res', res)
  297. } else {
  298. showErrorMessage('获取居民信息失败!')
  299. }
  300. })
  301. },
  302. getSpecialistTeamList: function(){
  303. var vm = this,
  304. loading = layer.load(0, {shade: false})
  305. var params = {
  306. doctor: docInfo.uid
  307. }
  308. rehaAPI.getSpecialistTeamList(params).then(function(res){
  309. layer.close(loading)
  310. if(res.status == 200) {
  311. vm.teamList = res.data || []
  312. vm.curTeamId = vm.teamList[0].id
  313. vm.curTeamInfo = vm.teamList[0]
  314. vm.teamListObj = {}
  315. $.each(res.data, function(index, o){
  316. vm.teamListObj[o.id] = o
  317. })
  318. } else {
  319. showErrorMessage(res.msg);
  320. }
  321. })
  322. },
  323. // 获取居民标签(健康情况、疾病类型、自定义分组)
  324. getPatientLabelInfo: function(){
  325. var vm = this,
  326. loading = layer.load(0, {shade: false})
  327. var params = {
  328. patient: vm.patientInfo.patient // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  329. }
  330. rehaAPI.getPatientLabelInfo(params).then(function(res){
  331. layer.close(loading)
  332. if(res.status == 200) {
  333. var healthLabel = res.data['healthLabel']||[],
  334. diseaseLabel = res.data['diseaseServer']||[],
  335. customLabel = res.data['customLabel']||[];
  336. vm.patientInfo.healthLabel = healthLabel
  337. vm.patientInfo.diseaseLabel = diseaseLabel
  338. vm.patientInfo.customLabel = customLabel
  339. vm.initLabelData()
  340. } else {
  341. showErrorMessage(res.msg);
  342. }
  343. })
  344. },
  345. initLabelData: function(){
  346. var vm = this
  347. var dLabel = [], cLabel = [];
  348. $.each(vm.allLabel['diseaseLabel'], function(index, o){
  349. o.flag = false
  350. o.disease = o.code
  351. o.diseaseName = o.name
  352. $.each(vm.patientInfo.diseaseLabel, function(index1, o1){
  353. if(o1.disease == o.code){
  354. o.flag = true
  355. }
  356. })
  357. dLabel.push(o)
  358. })
  359. $.each(vm.allLabel['customLabel'], function(index, o){
  360. o.flag = false
  361. o.labelCode = o.labelCode
  362. o.labelName = o.labelName
  363. $.each(vm.patientInfo.customLabel, function(index1, o1){
  364. if(o1.label == o.labelCode){
  365. o.flag = true
  366. }else{
  367. }
  368. })
  369. if(o.isSystem!=1){
  370. cLabel.push(o)
  371. }
  372. })
  373. vm.healthLabel = vm.allLabel['healthLabel'] || []
  374. vm.curHealthStatu = vm.healthLabel[0].labelCode
  375. vm.diseaseLabel = dLabel
  376. vm.customLabel = cLabel
  377. vm.$forceUpdate()
  378. },
  379. // 获取居民标签字典(健康情况、疾病类型、自定义分组)
  380. getSpecialistPatientLabel: function(teamId){
  381. var vm = this,
  382. loading = layer.load(0, {shade: false})
  383. var params = {
  384. teamCode: teamId
  385. }
  386. rehaAPI.getSpecialistPatientLabel(params).then(function(res){
  387. layer.close(loading)
  388. if(res.status==200){
  389. vm.allLabel = res.data
  390. }else{
  391. showErrorMessage(res.msg);
  392. }
  393. })
  394. },
  395. // 获取居民签约的专科团队
  396. findPatientTeamList: function(){
  397. var vm = this,
  398. params = {
  399. patient: vm.patientInfo.patient
  400. }
  401. rehaAPI.findPatientTeamList(params).then(function(res){
  402. if(res.status == 200) {
  403. var num = 0
  404. $.each(res.data, function(index,item){
  405. if(item.teamCode==vm.curTeamInfo.id){ //签约团队与二维码团队一致
  406. num++
  407. vm.signTeamInfo = item
  408. }
  409. })
  410. if(num>0){
  411. if(vm.signTeamInfo&&vm.signTeamInfo.doctor == docInfo.uid){
  412. vm.is_sign_specialist = true
  413. vm.is_sign_my = true
  414. } else {
  415. var text = vm.patientInfo.patientName+"已签约该专科团队【"+vm.signTeamInfo.doctorName+"】医生,请通过原医生创建康复计划"
  416. layer.alert(text, {icon: 5, title: '提示'});
  417. vm.is_sign_specialist = true
  418. vm.is_sign_my = false
  419. }
  420. } else {
  421. vm.is_sign_specialist = false
  422. vm.is_sign_my = false
  423. }
  424. } else {
  425. showErrorMessage(res.msg)
  426. }
  427. })
  428. },
  429. //居民未与扫描的二维码团队对应
  430. createPatientInSpeciaRelation:function(data){
  431. return new Promise(function (resolve, reject) {
  432. var vm = this,
  433. params = {
  434. patient: data.patient_code,
  435. doctor: docInfo.uid,
  436. patientName: data.patient_name,
  437. doctorName: docInfo.name,
  438. teamCode:data.teamCode
  439. }
  440. rehaAPI.createPatientInSpeciaRelation({jsonData:JSON.stringify(params)}).then(function(res){
  441. resolve(res)
  442. })
  443. })
  444. },
  445. judgePatientInSpecia: function(){
  446. var vm = this
  447. if(!vm.patientInfo){return false}
  448. if(!vm.is_sign_specialist){
  449. var text = "请问您是否确认为"+vm.patientInfo.patientName+"患者进行康复下转?"
  450. var current=layer.confirm(text, {
  451. btn: ['确定', '取消'],
  452. title: "提示"
  453. }, function (index) {
  454. vm.createPatientInSpeciaRelation({
  455. patient_code: vm.patientInfo.patient,
  456. patient_name: vm.patientInfo.patientName,
  457. teamCode: vm.curTeamInfo.id
  458. }).then(function(res){
  459. vm.is_sign_specialist = true
  460. vm.is_sign_my = true
  461. setTimeout(function(){
  462. vm.saveBtn()
  463. }, 500)
  464. })
  465. })
  466. } else {
  467. if(vm.is_sign_my){
  468. vm.saveBtn()
  469. } else {
  470. var text = vm.patientInfo.patientName+"已签约该专科团队【"+vm.signTeamInfo.doctorName+"】医生,请通过原医生创建康复计划"
  471. layer.alert(text, {icon: 5, title: '签约失败'});
  472. return
  473. }
  474. }
  475. },
  476. saveBtn: function(){
  477. var vm = this, num1 = 0, num2 = 0,
  478. health = {}, disease = [], custom = []
  479. if(!vm.curHealthStatu){
  480. showWarningMessage('请选择健康情况!')
  481. return false
  482. }
  483. $.each(vm.healthLabel, function(index, o){
  484. if(o.labelCode == vm.curHealthStatu){
  485. health = {
  486. label: o.labelCode,
  487. labelName: o.labelName,
  488. labelType: o.labelType
  489. }
  490. }
  491. })
  492. for(var i=0; i<vm.diseaseLabel.length; i++){
  493. var o = vm.diseaseLabel[i]
  494. if(!o.flag){
  495. num1++
  496. } else {
  497. disease.push({
  498. disease: o.disease,
  499. diseaseName: o.diseaseName
  500. })
  501. }
  502. if(num1==vm.diseaseLabel.length){
  503. showWarningMessage('请选择疾病类型!')
  504. return false
  505. }
  506. }
  507. for(var i=0; i<vm.customLabel.length; i++){
  508. var o = vm.customLabel[i]
  509. if(!o.flag){
  510. num2++
  511. } else {
  512. custom.push({
  513. label: o.labelCode,
  514. labelName: o.labelName,
  515. labelType: o.labelType
  516. })
  517. }
  518. // if(num2==vm.customLabel.length){
  519. // showWarningMessage('请选择自定义分组!')
  520. // return false
  521. // }
  522. }
  523. var data = {
  524. health: health,
  525. disease: disease,
  526. custom: custom
  527. }
  528. var params = {
  529. patient: vm.patientInfo.patient, // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  530. patientName: vm.patientInfo.patientName,
  531. json: JSON.stringify(data),
  532. teamCode: vm.curTeamInfo.id
  533. }
  534. var loading = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  535. rehaAPI.updatePatientLabelInfo(params).then(function(res){
  536. layer.close(loading);
  537. if(res.status==200){
  538. layer.confirm('康复下转基本信息保存成功,请为患者创建康复计划', { btn: ['创建康复计划', '取消'], title: "康复下转" }, function (index) {
  539. window.location.href="../../recover/html/new_recover.html?patient="+vm.patientInfo.patient + '&teamCode='+vm.curTeamInfo.id
  540. })
  541. }else{
  542. showErrorMessage(res.msg)
  543. }
  544. })
  545. }
  546. }
  547. })
  548. </script>
  549. </body>
  550. </html>