sign_handle.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. var httpData=GetRequest(),
  2. doctorInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'));
  3. var applyDate=httpData.applyDate?decodeURI(httpData.applyDate):""
  4. var refuseReason = null;
  5. function showSuccessMessage(msg) {
  6. layer.msg(msg, {
  7. icon: 1
  8. })
  9. }
  10. function showErrorMessage(msg) {
  11. layer.msg(msg, {
  12. icon: 5
  13. })
  14. }
  15. function showWarningMessage(msg) {
  16. layer.msg(msg, {
  17. icon: 2
  18. })
  19. }
  20. function showInfoMessage(msg) {
  21. layer.msg(msg, {
  22. icon: 6
  23. })
  24. }
  25. function getReason(ele) {
  26. if(ele.hasClass("active")) {
  27. ele.removeClass("active")
  28. refuseReason = null
  29. return false;
  30. }
  31. ele.addClass("active").siblings().removeClass("active");
  32. refuseReason = ele.html();
  33. }
  34. top.changeTypeIndex=null;//修改居民标签的窗体
  35. top.handleVue=new Vue({
  36. el: "#app",
  37. data: {
  38. renewFlag: httpData.renewFlag, // 2 改签
  39. applyDate: applyDate,
  40. justDoc: null,
  41. justHDoc: null,
  42. doctorType: doctorInfo.doctorType,
  43. isShowList1: false,
  44. isShowList2: false,
  45. isShowList3: false,
  46. isShowList4: false,
  47. isShowList5:false,
  48. patientInfo: {jtSign: {}},
  49. warnMsg: "",
  50. signdictList: null,
  51. teamList: null,
  52. hisTeamName: null, // 历史团队
  53. memberList: null, // 团队成员列表
  54. doctorList: null, // 全科医生列表
  55. specialDoctorList:null,//专科医生列表
  56. dictList: null,
  57. fileList: null,
  58. serverName: null,
  59. labelName: null,
  60. patLabel: [],
  61. signInfo: {
  62. signType: 1,
  63. signCode: httpData.signCode,
  64. majorDoctor: null,
  65. majorDoctorName: null,
  66. healthLabel: null,
  67. customLabel: null,
  68. disease: null,
  69. patientIDcard: null, // 必填
  70. adminTeamCode: null,
  71. teamCode: null,
  72. mesId: null, // 消息id(必填)
  73. msgid: null, // 消息id(必填)
  74. patient: httpData.patientCode,
  75. doctor: null,
  76. doctorName: null,
  77. healthDoctor: null,
  78. healthDoctorName: null,
  79. type: 1,
  80. state: 1,
  81. expenses: null,
  82. group: null,
  83. //添加服务类型数据
  84. sevId: null,
  85. // 拒绝参数
  86. // adminTeamCode:0,
  87. // type: 2,
  88. refuseReason: null
  89. },
  90. zkdoctorShow:false,
  91. choseTeamFirst:true,
  92. },
  93. mounted: function() {
  94. this.getSigndict();
  95. this.getDictByDictName();
  96. if(!httpData.msgid || httpData.msgid == "undefined" || httpData.msgid == "null") {
  97. this.findMsgId()
  98. } else {
  99. this.signInfo.mesId = httpData.msgid
  100. this.signInfo.msgid = httpData.msgid
  101. }
  102. this.teamLimit();
  103. this.findPatientSignServerBySignCode();
  104. },
  105. methods: {
  106. allLabels: function(selData) {
  107. var vm =this,
  108. param = {
  109. teamCode: this.signInfo.adminTeamCode
  110. },
  111. loadding = layer.load(0, {shade: false});
  112. signAPI.allLabels(param).then(function(res) {
  113. layer.close(loadding)
  114. if(res.status == 200) {
  115. $.each(res.data, function(i, v) {
  116. if(v.labelType == 2) {
  117. $.each(selData.heath, function(j, u) {
  118. if(u == v.labelCode) {
  119. if(vm.labelName == "") {
  120. vm.labelName += v.labelName
  121. } else {
  122. vm.labelName += ',' + v.labelName
  123. }
  124. }
  125. });
  126. }
  127. if(v.labelType == 3) {
  128. $.each(selData.disease, function(j, u) {
  129. if(u == v.labelCode) {
  130. if(vm.labelName == "") {
  131. vm.labelName += v.labelName
  132. } else {
  133. vm.labelName += ',' + v.labelName
  134. }
  135. }
  136. });
  137. }
  138. if(v.labelType == 4) {
  139. $.each(selData.team, function(j, u) {
  140. if(u == v.labelCode) {
  141. if(vm.labelName == "") {
  142. vm.labelName += v.labelName
  143. } else {
  144. vm.labelName += ',' + v.labelName
  145. }
  146. }
  147. });
  148. }
  149. });
  150. } else {
  151. showErrorMessage(res.msg);
  152. }
  153. })
  154. },
  155. getTeamNameByTeamCode: function() {
  156. var vm =this,
  157. params = {
  158. teamCode: vm.patientInfo.jtSign.adminTeamId
  159. },
  160. loadding = layer.load(0, {shade: false});
  161. signAPI.getTeamNameByTeamCode(params).then(function(res) {
  162. layer.close(loadding)
  163. if(res.status == 200) {
  164. vm.hisTeamName = res.data
  165. } else {
  166. showErrorMessage(res.msg);
  167. }
  168. })
  169. },
  170. patientLabel: function() {
  171. var vm =this,
  172. params = {
  173. patient: httpData.patientCode,
  174. labelType: ""
  175. },
  176. loadding = layer.load(0, {shade: false});
  177. signAPI.patientLabel(params).then(function(res) {
  178. layer.close(loadding)
  179. if(res.status == 200) {
  180. vm.patLabel = res.data
  181. } else {
  182. showErrorMessage(res.msg);
  183. }
  184. })
  185. },
  186. getSigndict: function() {
  187. var vm =this,
  188. loadding = layer.load(0, {shade: false});
  189. signAPI.getSigndict().then(function(res) {
  190. layer.close(loadding)
  191. if(res.status == 200) {
  192. vm.signdictList = res.data
  193. } else {
  194. showErrorMessage(res.msg);
  195. }
  196. })
  197. },
  198. findMsgId: function() {
  199. var vm =this,
  200. params = {
  201. sender: httpData.patientCode,
  202. signStatus: httpData.status == 0 ? 1 : (vm.renewFlag == 1 ? 8 : 9)
  203. },
  204. loadding = layer.load(0, {shade: false});
  205. signAPI.findMsgId(params).then(function(res) {
  206. layer.close(loadding)
  207. if(res.status == 200) {
  208. vm.signInfo.mesId = res.data.id
  209. vm.signInfo.msgid = res.data.id
  210. } else {
  211. showErrorMessage(res.msg);
  212. }
  213. })
  214. },
  215. signing: function() {
  216. var vm = this,
  217. loadding = layer.load(0, {shade: false}),
  218. params = {
  219. patient: httpData.patientCode
  220. }
  221. signAPI.signing(params).then(function(res) {
  222. layer.close(loadding)
  223. if(res.status == 200) {
  224. var patientInfo=JSON.parse(JSON.stringify(vm.patientInfo))
  225. vm.patientInfo={}
  226. vm.patientInfo = _.assign(patientInfo, res.data)
  227. vm.signInfo.patientIDcard = res.data.idCard
  228. if(res.data.jtSign){
  229. if(vm.doctorType == 2) {
  230. vm.signInfo.doctorName = res.data.jtSign.doctorName
  231. vm.signInfo.doctor = res.data.jtSign.doctor
  232. }
  233. if(vm.doctorType == 3) {
  234. vm.signInfo.healthDoctorName = res.data.jtSign.doctorHealthName
  235. vm.signInfo.healthDoctor = res.data.jtSign.doctorHealth
  236. }
  237. }
  238. } else {
  239. showErrorMessage(res.msg);
  240. }
  241. })
  242. },
  243. selectServer:function(){
  244. var localurl=window.location.href;
  245. var useUrl=localurl.split("html/")[0]
  246. var vm=this
  247. if(!this.signInfo.adminTeamCode) {
  248. showWarningMessage("请先选择签约团队");
  249. return false;
  250. }
  251. if(top.changeTypeIndex && top.$('#layui-layer-shade'+top.changeTypeIndex).length){
  252. top.xgLabel.initPage();
  253. (top.$('#layui-layer-shade'+top.changeTypeIndex).show(),top.$('#layui-layer'+top.changeTypeIndex).show());
  254. }else{
  255. top.changeTypeIndex=top.layer.open({
  256. type: 2,
  257. area: ['500px', '405px'],
  258. title: "修改居民标签",
  259. shade: 0.5,
  260. shadeClose: false,
  261. closeBtn: 0,
  262. shift: 2,
  263. content: useUrl+'html/modify-the-label.html?patient=' + httpData.patientCode+'&teamCode='+vm.signInfo.adminTeamCode+"&signCode="+httpData.signCode
  264. });
  265. }
  266. },
  267. handleStr: function(str) {
  268. if (!str || str === '') {
  269. return ''
  270. }
  271. return str.substr(0, 19)
  272. },
  273. acceptanceRes:function(res){
  274. var vm = this
  275. this.serverName = "";
  276. this.labelName = "";
  277. if(res.server.length != 0) this.signInfo.sevId = res.server.join(",");
  278. if(res.disease.length != 0) this.signInfo.disease = res.disease.join(",");
  279. if(res.heath.length != 0) this.signInfo.healthLabel = res.heath.join(",");
  280. if(res.team.length != 0) this.signInfo.customLabel = res.team.join(",");
  281. $.each(res.server, function(i, v) {
  282. $.each(vm.signdictList, function(j, u) {
  283. if(v == u.code) {
  284. if(vm.serverName == "") {
  285. vm.serverName += u.name
  286. } else {
  287. vm.serverName += ',' + u.name
  288. }
  289. }
  290. });
  291. });
  292. this.allLabels(res)
  293. if(vm.serverName.split(',').indexOf('高血压')>-1 || vm.serverName.split(',').indexOf('糖尿病')>-1 ){
  294. console.log('服务类型存在高血压,糖尿病')
  295. this.zkdoctorShow=true
  296. }else{
  297. this.zkdoctorShow=false
  298. }
  299. },
  300. signOuttime: function() {
  301. var vm = this,
  302. loadding = layer.load(0, {shade: false}),
  303. params = {
  304. patient: httpData.patientCode
  305. }
  306. signAPI.signOuttime(params).then(function(res) {
  307. layer.close(loadding)
  308. if(res.status == 200) {
  309. vm.patientInfo = res.data
  310. vm.signInfo.adminTeamCode = vm.patientInfo.jtSign.adminTeamId
  311. vm.signInfo.teamCode = vm.patientInfo.jtSign.adminTeamId
  312. vm.signInfo.healthDoctorName = vm.patientInfo.jtSign.doctorHealthName || ""
  313. vm.signInfo.healthDoctor = vm.patientInfo.jtSign.doctorHealth || ""
  314. vm.signInfo.doctor = vm.patientInfo.jtSign.doctor || ""
  315. vm.signInfo.doctorName = vm.patientInfo.jtSign.doctorName || ""
  316. if(vm.doctorType == 2) {
  317. vm.signInfo.doctorName = doctorInfo.name
  318. vm.signInfo.doctor = doctorInfo.uid
  319. }
  320. if(vm.doctorType == 3) {
  321. vm.signInfo.healthDoctorName = doctorInfo.name
  322. vm.signInfo.healthDoctor = doctorInfo.uid
  323. }
  324. vm.signInfo.expenses = vm.patientInfo.jtSign.expensesType
  325. vm.judgeTeamToDoc(vm.signInfo.adminTeamCode)
  326. // 查找之前签约的居民标签
  327. vm.patientLabel()
  328. if(vm.renewFlag == 2) { // 获取之前签约团队名字
  329. vm.getTeamNameByTeamCode()
  330. }
  331. } else {
  332. showErrorMessage(res.msg);
  333. }
  334. })
  335. },
  336. judgeTeamToDoc: function(teamCode) {
  337. var judge = false
  338. for(var i = 0, len = this.teamList.length; i < len; i++) {
  339. if(this.teamList[i].id == teamCode) {
  340. judge = true
  341. this.teamMember()
  342. }
  343. }
  344. if(!judge) {
  345. this.signInfo.adminTeamCode = null
  346. this.signInfo.teamCode = null
  347. this.warnMsg = "您已不在原签约团队,请选择新的签约团队"
  348. if(this.doctorType == 2) {
  349. this.justHDoc = this.signInfo.healthDoctorName
  350. this.signInfo.healthDoctorName = null
  351. this.signInfo.healthDoctor = null
  352. } else {
  353. this.justDoc = this.signInfo.doctorName
  354. this.signInfo.doctor = null
  355. this.signInfo.doctorName = null
  356. }
  357. }
  358. },
  359. getDictByDictName: function() {
  360. var vm =this,
  361. loadding = layer.load(0, {shade: false}),
  362. params = {
  363. name: "SIGN_EXPENSES"
  364. }
  365. signAPI.getDictByDictName(params).then(function(res) {
  366. layer.close(loadding)
  367. if(res.status == 200) {
  368. vm.dictList = res.list
  369. } else {
  370. showErrorMessage(res.msg);
  371. }
  372. })
  373. },
  374. teamLimit: function() {
  375. var vm = this,
  376. loadding = layer.load(0, {shade: false}),
  377. params = {
  378. doctorId: doctorInfo.uid
  379. }
  380. signAPI.teamLimit(params).then(function(res) {
  381. layer.close(loadding)
  382. if(res.status == 200) {
  383. vm.teamList = res.data
  384. if (httpData.status == 0) {
  385. vm.signing()
  386. } else {
  387. vm.signOuttime();
  388. }
  389. } else {
  390. showErrorMessage(res.msg);
  391. }
  392. })
  393. },
  394. findPatientSignServerBySignCode: function() {
  395. var vm =this,
  396. loadding = layer.load(0, {shade: false}),
  397. params = {
  398. signCode: httpData.signCode
  399. };
  400. signAPI.findPatientSignServerBySignCode(params).then(function(res) {
  401. layer.close(loadding)
  402. if(res.status == 200) {
  403. vm.fileList = [];
  404. var len = res.data.length;
  405. if(res.data.length > 0) {
  406. vm.serverName = "";
  407. vm.signInfo.sevId = "";
  408. for(var i = 0; i < len; i++) {
  409. if(i == 0) {
  410. vm.serverName += res.data[i].serverTypeName
  411. vm.signInfo.sevId += res.data[i].servetType
  412. } else {
  413. vm.serverName += + ', ' + res.data[i].serverTypeName
  414. vm.signInfo.sevId += +',' + res.data[i].servetType
  415. }
  416. }
  417. }
  418. if(vm.serverName.split(',').indexOf('高血压')>-1 || vm.serverName.split(',').indexOf('糖尿病')>-1 ){
  419. console.log('服务类型存在高血压,糖尿病')
  420. vm.zkdoctorShow=true
  421. }else{
  422. vm.zkdoctorShow=false
  423. }
  424. $.each(res.data, function(i, v) {
  425. if(v.serverType == 8 || v.serverType == 9 || v.serverType == 11) {
  426. vm.fileList.push(v);
  427. }
  428. });
  429. } else {
  430. showErrorMessage(res.msg);
  431. }
  432. })
  433. },
  434. teamMember: function(val) {
  435. var vm = this,
  436. loadding = layer.load(0, {shade: false}),
  437. params = {
  438. teamId: vm.signInfo.adminTeamCode,
  439. name:val||''
  440. }
  441. signAPI.teamMember(params).then(function(res) {
  442. layer.close(loadding)
  443. vm.memberList = [];
  444. vm.doctorList = [];
  445. vm.specialDoctorList=[];
  446. if(res.status == 200) {
  447. var judge = false
  448. $.each(res.data, function(i, v) {
  449. if(v.available) {
  450. if(v.code == vm.signInfo.doctor && vm.doctorType == 3) {
  451. judge = true
  452. }
  453. if(v.code == vm.signInfo.healthDoctor && vm.doctorType == 2) {
  454. judge = true
  455. }
  456. }
  457. if(v.available && (v.level == 3 || v.level == 2)) {vm.memberList.push(v);}
  458. if(v.available && v.level == 2) {vm.doctorList.push(v);}
  459. vm.specialDoctorList.push(v);
  460. });
  461. if(!judge && httpData.status == 1) {
  462. if(vm.doctorType == 3) {
  463. if(!vm.justDoc && !vm.signInfo.doctorName) {
  464. vm.signInfo.doctorName = vm.signInfo.healthDoctorName
  465. vm.signInfo.doctor = vm.signInfo.healthDoctor
  466. return false
  467. }
  468. if(!vm.justDoc) {
  469. vm.justDoc = vm.signInfo.doctorName
  470. }
  471. vm.warnMsg = "去年签约的全科医生" + vm.justDoc + "已不在您的团队,请重新选择一位全科医生"
  472. vm.justDoc = null
  473. vm.signInfo.doctor = null
  474. vm.signInfo.doctorName = null
  475. }
  476. if(vm.doctorType == 2) {
  477. if(!vm.justHDoc && !vm.signInfo.healthDoctorName) {
  478. vm.signInfo.healthDoctorName = vm.signInfo.doctorName
  479. vm.signInfo.healthDoctor = vm.signInfo.doctor
  480. return false
  481. }
  482. if(!vm.justHDoc) {
  483. vm.justHDoc = vm.signInfo.healthDoctorName
  484. }
  485. vm.warnMsg = "去年签约的健管师" + vm.justHDoc + "已不在您的团队,请重新选择一位健管师"
  486. vm.justHDoc = null
  487. vm.signInfo.healthDoctor = null
  488. vm.signInfo.healthDoctorName = null
  489. }
  490. top.changeTypeIndex=null
  491. }
  492. } else {
  493. showErrorMessage(res.msg);
  494. }
  495. })
  496. },
  497. teamMember2:function(val){
  498. var vm = this,
  499. loadding = layer.load(0, {shade: false}),
  500. params = {
  501. teamId: vm.signInfo.adminTeamCode,
  502. name:val||''
  503. }
  504. signAPI.teamMember(params).then(function(res) {
  505. layer.close(loadding)
  506. vm.memberList = [];
  507. vm.doctorList = [];
  508. vm.specialDoctorList=[];
  509. if(res.status == 200) {
  510. var judge = false
  511. $.each(res.data, function(i, v) {
  512. if(v.available) {
  513. if(v.code == vm.signInfo.doctor && vm.doctorType == 3) {
  514. judge = true
  515. }
  516. if(v.code == vm.signInfo.healthDoctor && vm.doctorType == 2) {
  517. judge = true
  518. }
  519. }
  520. if(v.available && (v.level == 3 || v.level == 2)) {vm.memberList.push(v);}
  521. if(v.available && v.level == 2) {vm.doctorList.push(v);}
  522. vm.specialDoctorList.push(v);
  523. });
  524. } else {
  525. showErrorMessage(res.msg);
  526. }
  527. })
  528. },
  529. handleSelect:function(item) {
  530. console.log(item);
  531. },
  532. handleIconClick:function(ev) {
  533. console.log(ev);
  534. },
  535. querySearch:function(queryString, cb) {
  536. var doctorList = this.doctorList;
  537. debugger
  538. var results = queryString ? doctorList.filter(this.createFilter(queryString)) : doctorList;
  539. // 调用 callback 返回建议列表的数据
  540. cb(results);
  541. },
  542. createFilter:function(queryString) {
  543. return function(restaurant){
  544. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  545. };
  546. },
  547. selectStatus: function(num,val) {
  548. var vm=this
  549. if(num == 1) {
  550. this.isShowList2 = false;
  551. this.isShowList3 = false;
  552. this.isShowList4 = false;
  553. this.isShowList1 = !this.isShowList1;
  554. } else if (num == 2 || num == 5) {
  555. if(!this.signInfo.adminTeamCode) {
  556. showWarningMessage("请先选择签约团队")
  557. return false;
  558. }
  559. } else if (num == 3) {
  560. this.isShowList1 = false;
  561. this.isShowList2 = false;
  562. this.isShowList4 = false;
  563. this.isShowList3 = !this.isShowList3;
  564. }else if(num==5){
  565. } else {
  566. if(!this.signInfo.adminTeamCode) {
  567. showWarningMessage("请先选择签约团队")
  568. return false;
  569. }
  570. }
  571. // if(/^[\u4e00-\u9fa5]+$/i.test(val)){
  572. // _.debounce(vm.teamMember2(val), 300)
  573. // }
  574. },
  575. keyupStatus:function(num,val){
  576. vm.selectStatus(num)
  577. },
  578. selectLi: function(num,data) {
  579. if(num == 1) { // 选择签约团队
  580. this.isShowList1 = false;
  581. this.signInfo.adminTeamCode = data.id;
  582. this.signInfo.teamCode = data.id;
  583. if(this.doctorType == 2) {
  584. this.signInfo.healthDoctor = null
  585. this.signInfo.healthDoctorName = null
  586. }
  587. if(this.doctorType == 3) {
  588. this.signInfo.doctor = null
  589. this.signInfo.doctorName = null
  590. }
  591. // 发现切换团队时无法更新健管师列表,将这个判断取消后就可以更新.
  592. // if(!this.memberList || !this.doctorList) {
  593. this.teamMember()
  594. // }
  595. }
  596. if(num == 2) { // 选择健管师
  597. this.isShowList2 = false;
  598. this.signInfo.healthDoctorName = data.name
  599. this.signInfo.healthDoctor = data.code
  600. }
  601. if(num == 3) {
  602. this.isShowList3 = false;
  603. this.signInfo.expenses = data.code;
  604. }
  605. if(num == 4) { // 选择全科医生
  606. this.isShowList4 = false;
  607. this.signInfo.doctorName = data.name
  608. this.signInfo.doctor = data.code
  609. }
  610. if(num==5){//选择专科医生
  611. this.isShowList5=false
  612. this.signInfo.specialistName = data.name
  613. this.signInfo.specialist = data.code
  614. }
  615. },
  616. // 把原来下拉选择框变成可搜索下拉选择框
  617. changeSelect4:function(val){
  618. var obj = {};
  619. obj = this.doctorList.find(function(item){
  620. return item.code === val;
  621. });
  622. this.signInfo.doctorName=obj.name
  623. },
  624. changeSelect2:function(val){
  625. var obj = {};
  626. obj = this.memberList.find(function(item){
  627. return item.code === val;
  628. });
  629. this.signInfo.healthDoctorName=obj.name
  630. },
  631. changeSelect5:function(val){
  632. var obj = {};
  633. obj = this.specialDoctorList.find(function(item){
  634. return item.code === val;
  635. });
  636. this.signInfo.specialistName=obj.name
  637. },
  638. showTeamName: function(teamCode) {
  639. var teamName;
  640. if(!this.teamList) {
  641. return "请选择签约团队";
  642. }
  643. for(var i = 0, len = this.teamList.length; i < len; i++) {
  644. if(teamCode == this.teamList[i].id) {
  645. teamName = this.teamList[i].name;
  646. }
  647. }
  648. return teamName
  649. },
  650. showExpensesName: function(code) {
  651. var expensesName;
  652. if(!this.dictList) {
  653. return "请选择补贴类型";
  654. }
  655. for(var i = 0, len = this.dictList.length; i < len; i++) {
  656. if(code == this.dictList[i].code) {
  657. expensesName = this.dictList[i].value;
  658. }
  659. }
  660. return expensesName
  661. },
  662. setPatImg: function(str) {
  663. var imgStr = httpRequest.getImgUrl(str);
  664. if (imgStr == "") {
  665. return '../../../images/p-female.png';
  666. } else {
  667. return imgStr;
  668. }
  669. },
  670. lookPhoto: function(data) {
  671. var localurl=window.location.href;
  672. var useUrl=localurl.split("html/")[0]
  673. parent.photoLayerIndex = parent.layer.open({
  674. type: 2,
  675. area: ['70%', '600px'],
  676. title: false,
  677. shade: 0.5,
  678. shadeClose: true,
  679. shift: 2,
  680. content: useUrl+'html/photo_show.html?serverType=' + data.serverType + '&patientCode=' + httpData.patientCode
  681. })
  682. },
  683. refuse: function() {
  684. var vm = this;
  685. layer.open({
  686. type: 1,
  687. area: ['400px', '300px'],
  688. shade: 0.5,
  689. title: '拒绝签约原因',
  690. shift: 2,
  691. shadeClose: false, //点击遮罩关闭层
  692. content: '<div class="p20 pb0"><div class="reason_list clearfix"><span class="fl mr10 mb20" onclick="getReason($(this))">居民信息填写不详</span><span class="fl mr10 mb20" onclick="getReason($(this))">签约人数已满</span><span class="fl mb20" onclick="getReason($(this))">家庭医生变更</span></div><textarea id="reason" maxLength="200" placeholder="可选择填写其他拒签原因(限200字以内)"></textarea></div>',
  693. btn: ['提 交', '取 消'],
  694. yes:function(index, layero) {
  695. if(!refuseReason) {
  696. if(!$("#reason").val()) {
  697. showWarningMessage("请选择或输入拒绝理由!");
  698. layer.close(index);
  699. return false
  700. }
  701. vm.signInfo.refuseReason = $("#reason").val()
  702. } else {
  703. if($("#reason").val()) {
  704. vm.signInfo.refuseReason = refuseReason + "。" + $("#reason").val()
  705. } else {
  706. vm.signInfo.refuseReason = refuseReason
  707. }
  708. }
  709. vm.signInfo.adminTeamCode = 0;
  710. vm.signInfo.teamCode = 0;
  711. vm.signInfo.type = 2;
  712. vm.signInfo.state = 0;
  713. vm.sign();
  714. layer.close(index);
  715. },
  716. success: function(layero){
  717. layero.find('.layui-layer-btn').css('text-align', 'center')
  718. }
  719. });
  720. },
  721. sign: function() {// type:1签约 2拒签
  722. if(this.signInfo.type == 1 && (!this.signInfo.expenses || (this.doctorType == 2 && !this.signInfo.healthDoctor) ||(this.zkdoctorShow==true &&this.doctorType == 2 && !this.signInfo.specialist) || (this.doctorType == 3 && !this.signInfo.doctor) || !this.signInfo.sevId || (!this.signInfo.disease && !this.signInfo.healthLabel && !this.signInfo.customLabel))) {
  723. showWarningMessage("请将填写完整签约信息!");
  724. return false;
  725. }
  726. var vm = this,
  727. loadding = layer.load(0, {shade: false});
  728. if (httpData.status == 0) {
  729. var param = vm.signInfo
  730. if(vm.doctorType == 2) {
  731. param.doctor = null
  732. param.doctorName = null
  733. }
  734. if(vm.doctorType == 3) {
  735. param.doctorHealth = null
  736. param.doctorHealthName = null
  737. param.specialist=null
  738. param.specialistName=null
  739. }
  740. signAPI.sign(vm.signInfo).then(function(res) {
  741. layer.close(loadding)
  742. if(res.status == 200) {
  743. showSuccessMessage(res.msg || "操作成功")
  744. setTimeout(function() {
  745. parent.gobalVue.signCount();
  746. layer.closeAll();
  747. parent.layer.closeAll();
  748. }, 1000)
  749. } else {
  750. showErrorMessage(res.msg);
  751. }
  752. })
  753. } else {
  754. signAPI.signRenew(vm.signInfo).then(function(res) {
  755. layer.close(loadding)
  756. if(res.status == 200) {
  757. showSuccessMessage(res.msg || "操作成功")
  758. setTimeout(function() {
  759. parent.gobalVue.signCount();
  760. layer.closeAll();
  761. parent.layer.closeAll();
  762. }, 1000)
  763. } else {
  764. showErrorMessage(res.msg);
  765. }
  766. })
  767. }
  768. }
  769. }
  770. })