addRecoveryDown.html 15 KB

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