sign_handle.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  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 vm=this
  245. if(!this.signInfo.adminTeamCode) {
  246. showWarningMessage("请先选择签约团队");
  247. return false;
  248. }
  249. if(top.changeTypeIndex && top.$('#layui-layer-shade'+top.changeTypeIndex).length){
  250. top.xgLabel.initPage();
  251. (top.$('#layui-layer-shade'+top.changeTypeIndex).show(),top.$('#layui-layer'+top.changeTypeIndex).show());
  252. }else{
  253. top.changeTypeIndex=top.layer.open({
  254. type: 2,
  255. area: ['500px', '405px'],
  256. title: "修改居民标签",
  257. shade: 0.5,
  258. shadeClose: false,
  259. closeBtn: 0,
  260. shift: 2,
  261. content: '../html/modify-the-label.html?patient=' + httpData.patientCode+'&teamCode='+vm.signInfo.adminTeamCode+"&signCode="+httpData.signCode
  262. });
  263. }
  264. },
  265. handleStr: function(str) {
  266. if (!str || str === '') {
  267. return ''
  268. }
  269. return str.substr(0, 19)
  270. },
  271. acceptanceRes:function(res){
  272. var vm = this
  273. this.serverName = "";
  274. this.labelName = "";
  275. if(res.server.length != 0) this.signInfo.sevId = res.server.join(",");
  276. if(res.disease.length != 0) this.signInfo.disease = res.disease.join(",");
  277. if(res.heath.length != 0) this.signInfo.healthLabel = res.heath.join(",");
  278. if(res.team.length != 0) this.signInfo.customLabel = res.team.join(",");
  279. $.each(res.server, function(i, v) {
  280. $.each(vm.signdictList, function(j, u) {
  281. if(v == u.code) {
  282. if(vm.serverName == "") {
  283. vm.serverName += u.name
  284. } else {
  285. vm.serverName += ',' + u.name
  286. }
  287. }
  288. });
  289. });
  290. this.allLabels(res)
  291. if(vm.serverName.split(',').indexOf('高血压')>-1 || vm.serverName.split(',').indexOf('糖尿病')>-1 ){
  292. console.log('服务类型存在高血压,糖尿病')
  293. this.zkdoctorShow=true
  294. }else{
  295. this.zkdoctorShow=false
  296. }
  297. },
  298. signOuttime: function() {
  299. var vm = this,
  300. loadding = layer.load(0, {shade: false}),
  301. params = {
  302. patient: httpData.patientCode
  303. }
  304. signAPI.signOuttime(params).then(function(res) {
  305. layer.close(loadding)
  306. if(res.status == 200) {
  307. vm.patientInfo = res.data
  308. vm.signInfo.adminTeamCode = vm.patientInfo.jtSign.adminTeamId
  309. vm.signInfo.teamCode = vm.patientInfo.jtSign.adminTeamId
  310. vm.signInfo.healthDoctorName = vm.patientInfo.jtSign.doctorHealthName || ""
  311. vm.signInfo.healthDoctor = vm.patientInfo.jtSign.doctorHealth || ""
  312. vm.signInfo.doctor = vm.patientInfo.jtSign.doctor || ""
  313. vm.signInfo.doctorName = vm.patientInfo.jtSign.doctorName || ""
  314. if(vm.doctorType == 2) {
  315. vm.signInfo.doctorName = doctorInfo.name
  316. vm.signInfo.doctor = doctorInfo.uid
  317. }
  318. if(vm.doctorType == 3) {
  319. vm.signInfo.healthDoctorName = doctorInfo.name
  320. vm.signInfo.healthDoctor = doctorInfo.uid
  321. }
  322. vm.signInfo.expenses = vm.patientInfo.jtSign.expensesType
  323. vm.judgeTeamToDoc(vm.signInfo.adminTeamCode)
  324. // 查找之前签约的居民标签
  325. vm.patientLabel()
  326. if(vm.renewFlag == 2) { // 获取之前签约团队名字
  327. vm.getTeamNameByTeamCode()
  328. }
  329. } else {
  330. showErrorMessage(res.msg);
  331. }
  332. })
  333. },
  334. judgeTeamToDoc: function(teamCode) {
  335. var judge = false
  336. for(var i = 0, len = this.teamList.length; i < len; i++) {
  337. if(this.teamList[i].id == teamCode) {
  338. judge = true
  339. this.teamMember()
  340. }
  341. }
  342. if(!judge) {
  343. this.signInfo.adminTeamCode = null
  344. this.signInfo.teamCode = null
  345. this.warnMsg = "您已不在原签约团队,请选择新的签约团队"
  346. if(this.doctorType == 2) {
  347. this.justHDoc = this.signInfo.healthDoctorName
  348. this.signInfo.healthDoctorName = null
  349. this.signInfo.healthDoctor = null
  350. } else {
  351. this.justDoc = this.signInfo.doctorName
  352. this.signInfo.doctor = null
  353. this.signInfo.doctorName = null
  354. }
  355. }
  356. },
  357. getDictByDictName: function() {
  358. var vm =this,
  359. loadding = layer.load(0, {shade: false}),
  360. params = {
  361. name: "SIGN_EXPENSES"
  362. }
  363. signAPI.getDictByDictName(params).then(function(res) {
  364. layer.close(loadding)
  365. if(res.status == 200) {
  366. vm.dictList = res.list
  367. } else {
  368. showErrorMessage(res.msg);
  369. }
  370. })
  371. },
  372. teamLimit: function() {
  373. var vm = this,
  374. loadding = layer.load(0, {shade: false}),
  375. params = {
  376. doctorId: doctorInfo.uid
  377. }
  378. signAPI.teamLimit(params).then(function(res) {
  379. layer.close(loadding)
  380. if(res.status == 200) {
  381. vm.teamList = res.data
  382. if (httpData.status == 0) {
  383. vm.signing()
  384. } else {
  385. vm.signOuttime();
  386. }
  387. } else {
  388. showErrorMessage(res.msg);
  389. }
  390. })
  391. },
  392. findPatientSignServerBySignCode: function() {
  393. var vm =this,
  394. loadding = layer.load(0, {shade: false}),
  395. params = {
  396. signCode: httpData.signCode
  397. };
  398. signAPI.findPatientSignServerBySignCode(params).then(function(res) {
  399. layer.close(loadding)
  400. if(res.status == 200) {
  401. vm.fileList = [];
  402. var len = res.data.length;
  403. if(res.data.length > 0) {
  404. vm.serverName = "";
  405. vm.signInfo.sevId = "";
  406. for(var i = 0; i < len; i++) {
  407. if(i == 0) {
  408. vm.serverName += res.data[i].serverTypeName
  409. vm.signInfo.sevId += res.data[i].servetType
  410. } else {
  411. vm.serverName += + ', ' + res.data[i].serverTypeName
  412. vm.signInfo.sevId += +',' + res.data[i].servetType
  413. }
  414. }
  415. }
  416. $.each(res.data, function(i, v) {
  417. if(v.serverType == 8 || v.serverType == 9 || v.serverType == 11) {
  418. vm.fileList.push(v);
  419. }
  420. });
  421. } else {
  422. showErrorMessage(res.msg);
  423. }
  424. })
  425. },
  426. teamMember: function(val) {
  427. var vm = this,
  428. loadding = layer.load(0, {shade: false}),
  429. params = {
  430. teamId: vm.signInfo.adminTeamCode,
  431. name:val||''
  432. }
  433. signAPI.teamMember(params).then(function(res) {
  434. layer.close(loadding)
  435. vm.memberList = [];
  436. vm.doctorList = [];
  437. vm.specialDoctorList=[];
  438. if(res.status == 200) {
  439. var judge = false
  440. $.each(res.data, function(i, v) {
  441. if(v.available) {
  442. if(v.code == vm.signInfo.doctor && vm.doctorType == 3) {
  443. judge = true
  444. }
  445. if(v.code == vm.signInfo.healthDoctor && vm.doctorType == 2) {
  446. judge = true
  447. }
  448. }
  449. if(v.available && (v.level == 3 || v.level == 2)) {vm.memberList.push(v);}
  450. if(v.available && v.level == 2) {vm.doctorList.push(v);}
  451. vm.specialDoctorList.push(v);
  452. });
  453. if(!judge && httpData.status == 1) {
  454. if(vm.doctorType == 3) {
  455. if(!vm.justDoc && !vm.signInfo.doctorName) {
  456. vm.signInfo.doctorName = vm.signInfo.healthDoctorName
  457. vm.signInfo.doctor = vm.signInfo.healthDoctor
  458. return false
  459. }
  460. if(!vm.justDoc) {
  461. vm.justDoc = vm.signInfo.doctorName
  462. }
  463. vm.warnMsg = "去年签约的全科医生" + vm.justDoc + "已不在您的团队,请重新选择一位全科医生"
  464. vm.justDoc = null
  465. vm.signInfo.doctor = null
  466. vm.signInfo.doctorName = null
  467. }
  468. if(vm.doctorType == 2) {
  469. if(!vm.justHDoc && !vm.signInfo.healthDoctorName) {
  470. vm.signInfo.healthDoctorName = vm.signInfo.doctorName
  471. vm.signInfo.healthDoctor = vm.signInfo.doctor
  472. return false
  473. }
  474. if(!vm.justHDoc) {
  475. vm.justHDoc = vm.signInfo.healthDoctorName
  476. }
  477. vm.warnMsg = "去年签约的健管师" + vm.justHDoc + "已不在您的团队,请重新选择一位健管师"
  478. vm.justHDoc = null
  479. vm.signInfo.healthDoctor = null
  480. vm.signInfo.healthDoctorName = null
  481. }
  482. top.changeTypeIndex=null
  483. }
  484. } else {
  485. showErrorMessage(res.msg);
  486. }
  487. })
  488. },
  489. teamMember2:function(val){
  490. var vm = this,
  491. loadding = layer.load(0, {shade: false}),
  492. params = {
  493. teamId: vm.signInfo.adminTeamCode,
  494. name:val||''
  495. }
  496. signAPI.teamMember(params).then(function(res) {
  497. layer.close(loadding)
  498. vm.memberList = [];
  499. vm.doctorList = [];
  500. vm.specialDoctorList=[];
  501. if(res.status == 200) {
  502. var judge = false
  503. $.each(res.data, function(i, v) {
  504. if(v.available) {
  505. if(v.code == vm.signInfo.doctor && vm.doctorType == 3) {
  506. judge = true
  507. }
  508. if(v.code == vm.signInfo.healthDoctor && vm.doctorType == 2) {
  509. judge = true
  510. }
  511. }
  512. if(v.available && (v.level == 3 || v.level == 2)) {vm.memberList.push(v);}
  513. if(v.available && v.level == 2) {vm.doctorList.push(v);}
  514. vm.specialDoctorList.push(v);
  515. });
  516. } else {
  517. showErrorMessage(res.msg);
  518. }
  519. })
  520. },
  521. handleSelect(item) {
  522. console.log(item);
  523. },
  524. handleIconClick(ev) {
  525. console.log(ev);
  526. },
  527. querySearch(queryString, cb) {
  528. var doctorList = this.doctorList;
  529. debugger
  530. var results = queryString ? doctorList.filter(this.createFilter(queryString)) : doctorList;
  531. // 调用 callback 返回建议列表的数据
  532. cb(results);
  533. },
  534. createFilter(queryString) {
  535. return (restaurant) => {
  536. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  537. };
  538. },
  539. selectStatus: function(num,val) {
  540. var vm=this
  541. if(num == 1) {
  542. this.isShowList2 = false;
  543. this.isShowList3 = false;
  544. this.isShowList4 = false;
  545. this.isShowList1 = !this.isShowList1;
  546. } else if (num == 2 || num == 5) {
  547. if(!this.signInfo.adminTeamCode) {
  548. showWarningMessage("请先选择签约团队")
  549. return false;
  550. }
  551. } else if (num == 3) {
  552. }else if(num==5){
  553. } else {
  554. if(!this.signInfo.adminTeamCode) {
  555. showWarningMessage("请先选择签约团队")
  556. return false;
  557. }
  558. }
  559. // if(/^[\u4e00-\u9fa5]+$/i.test(val)){
  560. // _.debounce(vm.teamMember2(val), 300)
  561. // }
  562. },
  563. keyupStatus:function(num,val){
  564. vm.selectStatus(num)
  565. },
  566. selectLi: function(num,data) {
  567. if(num == 1) { // 选择签约团队
  568. this.isShowList1 = false;
  569. this.signInfo.adminTeamCode = data.id;
  570. this.signInfo.teamCode = data.id;
  571. if(this.doctorType == 2) {
  572. this.signInfo.healthDoctor = null
  573. this.signInfo.healthDoctorName = null
  574. }
  575. if(this.doctorType == 3) {
  576. this.signInfo.doctor = null
  577. this.signInfo.doctorName = null
  578. }
  579. // 发现切换团队时无法更新健管师列表,将这个判断取消后就可以更新.
  580. // if(!this.memberList || !this.doctorList) {
  581. this.teamMember()
  582. // }
  583. }
  584. if(num == 2) { // 选择健管师
  585. this.isShowList2 = false;
  586. this.signInfo.healthDoctorName = data.name
  587. this.signInfo.healthDoctor = data.code
  588. }
  589. if(num == 3) {
  590. this.isShowList3 = false;
  591. this.signInfo.expenses = data.code;
  592. }
  593. if(num == 4) { // 选择全科医生
  594. this.isShowList4 = false;
  595. this.signInfo.doctorName = data.name
  596. this.signInfo.doctor = data.code
  597. }
  598. if(num==5){//选择专科医生
  599. this.isShowList5=false
  600. this.signInfo.specialistName = data.name
  601. this.signInfo.specialist = data.code
  602. }
  603. },
  604. // 把原来下拉选择框变成可搜索下拉选择框
  605. changeSelect4:function(val){
  606. var obj = {};
  607. obj = this.doctorList.find(function(item){
  608. return item.code === val;
  609. });
  610. this.signInfo.doctorName=obj.name
  611. },
  612. changeSelect2:function(val){
  613. var obj = {};
  614. obj = this.memberList.find(function(item){
  615. return item.code === val;
  616. });
  617. this.signInfo.healthDoctorName=obj.name
  618. },
  619. changeSelect5:function(val){
  620. var obj = {};
  621. obj = this.specialDoctorList.find(function(item){
  622. return item.code === val;
  623. });
  624. this.signInfo.specialistName=obj.name
  625. },
  626. showTeamName: function(teamCode) {
  627. var teamName;
  628. if(!this.teamList) {
  629. return "请选择签约团队";
  630. }
  631. for(var i = 0, len = this.teamList.length; i < len; i++) {
  632. if(teamCode == this.teamList[i].id) {
  633. teamName = this.teamList[i].name;
  634. }
  635. }
  636. return teamName
  637. },
  638. showExpensesName: function(code) {
  639. var expensesName;
  640. if(!this.dictList) {
  641. return "请选择补贴类型";
  642. }
  643. for(var i = 0, len = this.dictList.length; i < len; i++) {
  644. if(code == this.dictList[i].code) {
  645. expensesName = this.dictList[i].value;
  646. }
  647. }
  648. return expensesName
  649. },
  650. setPatImg: function(str) {
  651. var imgStr = httpRequest.getImgUrl(str);
  652. if (imgStr == "") {
  653. return '../../../images/p-female.png';
  654. } else {
  655. return imgStr;
  656. }
  657. },
  658. lookPhoto: function(data) {
  659. parent.photoLayerIndex = parent.layer.open({
  660. type: 2,
  661. area: ['70%', '600px'],
  662. title: false,
  663. shade: 0.5,
  664. shadeClose: true,
  665. shift: 2,
  666. content: '../html/photo_show.html?serverType=' + data.serverType + '&patientCode=' + httpData.patientCode
  667. })
  668. },
  669. refuse: function() {
  670. var vm = this;
  671. layer.open({
  672. type: 1,
  673. area: ['400px', '300px'],
  674. shade: 0.5,
  675. title: '拒绝签约原因',
  676. shift: 2,
  677. shadeClose: false, //点击遮罩关闭层
  678. 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>',
  679. btn: ['提 交', '取 消'],
  680. yes:function(index, layero) {
  681. if(!refuseReason) {
  682. if(!$("#reason").val()) {
  683. showWarningMessage("请选择或输入拒绝理由!");
  684. layer.close(index);
  685. return false
  686. }
  687. vm.signInfo.refuseReason = $("#reason").val()
  688. } else {
  689. if($("#reason").val()) {
  690. vm.signInfo.refuseReason = refuseReason + "。" + $("#reason").val()
  691. } else {
  692. vm.signInfo.refuseReason = refuseReason
  693. }
  694. }
  695. vm.signInfo.adminTeamCode = 0;
  696. vm.signInfo.teamCode = 0;
  697. vm.signInfo.type = 2;
  698. vm.signInfo.state = 0;
  699. vm.sign();
  700. layer.close(index);
  701. },
  702. success: function(layero){
  703. layero.find('.layui-layer-btn').css('text-align', 'center')
  704. }
  705. });
  706. },
  707. sign: function() {// type:1签约 2拒签
  708. if(this.signInfo.type == 1 && (!this.signInfo.expenses || (this.doctorType == 2 && !this.signInfo.healthDoctor) ||(this.doctorType == 2 && !this.signInfo.specialist) || (this.doctorType == 3 && !this.signInfo.doctor) || !this.signInfo.sevId || (!this.signInfo.disease && !this.signInfo.healthLabel && !this.signInfo.customLabel))) {
  709. showWarningMessage("请将填写完整签约信息!");
  710. return false;
  711. }
  712. var vm = this,
  713. loadding = layer.load(0, {shade: false});
  714. if (httpData.status == 0) {
  715. var param = vm.signInfo
  716. if(vm.doctorType == 2) {
  717. param.doctor = null
  718. param.doctorName = null
  719. }
  720. if(vm.doctorType == 3) {
  721. param.doctorHealth = null
  722. param.doctorHealthName = null
  723. param.specialist=null
  724. param.specialistName=null
  725. }
  726. signAPI.sign(vm.signInfo).then(function(res) {
  727. layer.close(loadding)
  728. if(res.status == 200) {
  729. showSuccessMessage(res.msg || "操作成功")
  730. setTimeout(function() {
  731. parent.gobalVue.signCount();
  732. layer.closeAll();
  733. parent.layer.closeAll();
  734. }, 1000)
  735. } else {
  736. showErrorMessage(res.msg);
  737. }
  738. })
  739. } else {
  740. signAPI.signRenew(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. }
  754. }
  755. }
  756. })