addRecoveryDown.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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">
  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 ml50">
  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="saveBtn">保存</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.patientInfo = undefined
  150. this.getSpecialistPatientLabel(this.curTeamId)
  151. this.curTeamInfo = this.teamListObj[this.curTeamId]
  152. }
  153. },
  154. methods: {
  155. isSignSpecialist: function(is_sign, idcard){
  156. if(is_sign){ // 已家签
  157. if(idcard){ // 已签约专科
  158. this.is_sign_specialist = true
  159. this.getRehabilitationPatientList(idcard)
  160. }
  161. } else {
  162. this.patientInfo = undefined
  163. this.emptyText = '患者暂未家签,请先提醒患者完成家庭医生签约'
  164. }
  165. layer.close(qrcodeBoxIndex)
  166. },
  167. // 显示二维码窗口
  168. viewQrcodeBox: function(){
  169. var vm=this
  170. qrcodeBoxIndex = layer.open({
  171. type: 2,
  172. // offset: ['100px'], //右下角弹出
  173. area: ['500px', '500px'],
  174. shade: 0.5,
  175. title: '康复下转',
  176. fixed: true, //不固定
  177. maxmin: true,
  178. closeBtn: 1,
  179. shift: 5,
  180. shadeClose: false, //点击遮罩关闭层
  181. content:'../../rehabilitation/html/signZkTeam.html?id=' + vm.curTeamInfo.id + '&name='+ vm.curTeamInfo.name+'&photo='+vm.curTeamInfo.photo,
  182. end: function() { // 未点击确定按钮,点击关闭按钮
  183.   
  184. }
  185. });
  186. },
  187. // 获取下转居民列表
  188. onSearch: function(){
  189. if(this.searchKey.trim().length==0){
  190. showWarningMessage('请输入居民身份证进行查询!')
  191. return false;
  192. }
  193. this.getRehabilitationPatientList(this.searchKey)
  194. },
  195. getRehabilitationPatientList: function(value){
  196. var vm = this,
  197. loading = layer.load(0, {shade: false})
  198. var params = {
  199. idcard: value
  200. }
  201. rehaAPI.getRehabilitationPatientList(params).then(function(res){
  202. layer.close(loading)
  203. if(res.status == 200) {
  204. if(res.data.length>0){
  205. vm.patientInfo = res.data[0]
  206. vm.getPatientLabelInfo()
  207. } else {
  208. vm.patientInfo = undefined
  209. vm.emptyText = '患者暂未家签,请先提醒患者完成家庭医生签约'
  210. }
  211. } else {
  212. showErrorMessage(res.msg);
  213. }
  214. })
  215. },
  216. getSpecialistTeamList: function(){
  217. var vm = this,
  218. loading = layer.load(0, {shade: false})
  219. var params = {
  220. doctor: docInfo.code
  221. }
  222. rehaAPI.getSpecialistTeamList(params).then(function(res){
  223. layer.close(loading)
  224. if(res.status == 200) {
  225. vm.teamList = res.data || []
  226. vm.curTeamId = vm.teamList[0].id
  227. vm.curTeamInfo = vm.teamList[0]
  228. vm.teamListObj = {}
  229. $.each(res.data, function(index, o){
  230. vm.teamListObj[o.id] = o
  231. })
  232. } else {
  233. showErrorMessage(res.msg);
  234. }
  235. })
  236. },
  237. // 获取居民标签(健康情况、疾病类型、自定义分组)
  238. getPatientLabelInfo: function(){
  239. var vm = this,
  240. loading = layer.load(0, {shade: false})
  241. var params = {
  242. patient: vm.patientInfo.patient // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  243. }
  244. rehaAPI.getPatientLabelInfo(params).then(function(res){
  245. layer.close(loading)
  246. if(res.status == 200) {
  247. var healthLabel = res.data['healthLabel']||[],
  248. diseaseLabel = res.data['diseaseServer']||[],
  249. customLabel = res.data['customLabel']||[];
  250. vm.patientInfo.healthLabel = healthLabel
  251. vm.patientInfo.diseaseLabel = diseaseLabel
  252. vm.patientInfo.customLabel = customLabel
  253. vm.getSpecialistPatientLabel(vm.curTeamId)
  254. } else {
  255. showErrorMessage(res.msg);
  256. }
  257. })
  258. },
  259. // 获取居民标签字典(健康情况、疾病类型、自定义分组)
  260. getSpecialistPatientLabel: function(teamId){
  261. var vm = this,
  262. loading = layer.load(0, {shade: false})
  263. var params = {
  264. teamCode: teamId
  265. }
  266. rehaAPI.getSpecialistPatientLabel(params).then(function(res){
  267. layer.close(loading)
  268. if(res.status==200){
  269. var dLabel = [], cLabel = [];
  270. $.each(res.data['diseaseLabel'], function(index, o){
  271. o.flag = false
  272. o.disease = o.code
  273. o.diseaseName = o.name
  274. $.each(vm.patientInfo.diseaseLabel, function(index1, o1){
  275. if(o1.disease == o.code){
  276. o.flag = true
  277. }
  278. })
  279. dLabel.push(o)
  280. })
  281. $.each(res.data['customLabel'], function(index, o){
  282. o.flag = false
  283. o.labelCode = o.labelCode
  284. o.labelName = o.labelName
  285. $.each(vm.patientInfo.customLabel, function(index1, o1){
  286. if(o1.label == o.labelCode){
  287. o.flag = true
  288. }else{
  289. }
  290. })
  291. if(o.isSystem!=1){
  292. cLabel.push(o)
  293. }
  294. })
  295. vm.healthLabel = res.data['healthLabel'] || []
  296. vm.curHealthStatu = vm.patientInfo.healthLabel&&vm.patientInfo.healthLabel.length>0?vm.patientInfo.healthLabel[0].label:res.data['healthLabel'][0].labelCode
  297. vm.diseaseLabel = dLabel
  298. vm.customLabel = cLabel
  299. }else{
  300. showErrorMessage(res.msg);
  301. }
  302. })
  303. },
  304. //居民未与扫描的二维码团队对应
  305. createPatientInSpeciaRelation:function(data){
  306. var vm = this,
  307. params = {
  308. patient: data.patient_code,
  309. doctor: docInfo.code,
  310. patientName: data.patient_name,
  311. doctorName: docInfo.name,
  312. teamCode:data.teamCode
  313. }
  314. rehaAPI.createPatientInSpeciaRelation(params).then(function(res){
  315. if(res.data&&res.data.status == 200) {
  316. } else {
  317. showErrorMessage(res.msg);
  318. }
  319. })
  320. },
  321. saveBtn: function(){
  322. var vm = this
  323. var vm = this, num1 = 0, num2 = 0,
  324. health = {}, disease = [], custom = []
  325. if(!vm.patientInfo){return false}
  326. if(!is_sign_specialist){
  327. vm.createPatientInSpeciaRelation({
  328. patient_code: vm.patientInfo.patient,
  329. patient_name: vm.patientInfo.patientName,
  330. teamCode: vm.curTeamInfo.id
  331. })
  332. }
  333. if(!vm.curHealthStatu){
  334. showWarningMessage('请选择健康情况!')
  335. return false
  336. }
  337. $.each(vm.healthLabel, function(index, o){
  338. if(o.labelCode == vm.curHealthStatu){
  339. health = {
  340. label: o.labelCode,
  341. labelName: o.labelName,
  342. labelType: o.labelType
  343. }
  344. }
  345. })
  346. for(var i=0; i<vm.diseaseLabel.length; i++){
  347. var o = vm.diseaseLabel[i]
  348. if(!o.flag){
  349. num1++
  350. } else {
  351. disease.push({
  352. disease: o.disease,
  353. diseaseName: o.diseaseName
  354. })
  355. }
  356. if(num1==vm.diseaseLabel.length){
  357. showWarningMessage('请选择疾病类型!')
  358. return false
  359. }
  360. }
  361. for(var i=0; i<vm.customLabel.length; i++){
  362. var o = vm.customLabel[i]
  363. if(!o.flag){
  364. num2++
  365. } else {
  366. custom.push({
  367. label: o.labelCode,
  368. labelName: o.labelName,
  369. labelType: o.labelType
  370. })
  371. }
  372. if(num2==vm.customLabel.length){
  373. showWarningMessage('请选择自定义分组!')
  374. return false
  375. }
  376. }
  377. var data = {
  378. health: health,
  379. disease: disease,
  380. custom: custom
  381. }
  382. var params = {
  383. patient: vm.patientInfo.patient, // "915cdef5-5b1d-11e6-8344-fa163e8aee56"
  384. patientName: vm.patientInfo.patientName,
  385. json: JSON.stringify(data)
  386. }
  387. var loading = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  388. rehaAPI.updatePatientLabelInfo(params).then(function(res){
  389. layer.close(loading);
  390. if(res.status==200){
  391. layer.confirm('康复下转基本信息保存成功,请为患者创建康复计划', { btn: ['创建康复计划', '取消'], title: "康复下转" }, function (index) {
  392. window.location.href="./new_recover.html?patient="+vm.patientInfo.patient + '&teamCode='+vm.curTeamInfo.id
  393. })
  394. }else{
  395. showErrorMessage(res.msg)
  396. }
  397. })
  398. }
  399. }
  400. })
  401. </script>
  402. </body>
  403. </html>