sign_handle.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  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. $.each(res.data, function(i, v) {
  419. if(v.serverType == 8 || v.serverType == 9 || v.serverType == 11) {
  420. vm.fileList.push(v);
  421. }
  422. });
  423. } else {
  424. showErrorMessage(res.msg);
  425. }
  426. })
  427. },
  428. teamMember: function(val) {
  429. var vm = this,
  430. loadding = layer.load(0, {shade: false}),
  431. params = {
  432. teamId: vm.signInfo.adminTeamCode,
  433. name:val||''
  434. }
  435. signAPI.teamMember(params).then(function(res) {
  436. layer.close(loadding)
  437. vm.memberList = [];
  438. vm.doctorList = [];
  439. vm.specialDoctorList=[];
  440. if(res.status == 200) {
  441. var judge = false
  442. $.each(res.data, function(i, v) {
  443. if(v.available) {
  444. if(v.code == vm.signInfo.doctor && vm.doctorType == 3) {
  445. judge = true
  446. }
  447. if(v.code == vm.signInfo.healthDoctor && vm.doctorType == 2) {
  448. judge = true
  449. }
  450. }
  451. if(v.available && (v.level == 3 || v.level == 2)) {vm.memberList.push(v);}
  452. if(v.available && v.level == 2) {vm.doctorList.push(v);}
  453. vm.specialDoctorList.push(v);
  454. });
  455. if(!judge && httpData.status == 1) {
  456. if(vm.doctorType == 3) {
  457. if(!vm.justDoc && !vm.signInfo.doctorName) {
  458. vm.signInfo.doctorName = vm.signInfo.healthDoctorName
  459. vm.signInfo.doctor = vm.signInfo.healthDoctor
  460. return false
  461. }
  462. if(!vm.justDoc) {
  463. vm.justDoc = vm.signInfo.doctorName
  464. }
  465. vm.warnMsg = "去年签约的全科医生" + vm.justDoc + "已不在您的团队,请重新选择一位全科医生"
  466. vm.justDoc = null
  467. vm.signInfo.doctor = null
  468. vm.signInfo.doctorName = null
  469. }
  470. if(vm.doctorType == 2) {
  471. if(!vm.justHDoc && !vm.signInfo.healthDoctorName) {
  472. vm.signInfo.healthDoctorName = vm.signInfo.doctorName
  473. vm.signInfo.healthDoctor = vm.signInfo.doctor
  474. return false
  475. }
  476. if(!vm.justHDoc) {
  477. vm.justHDoc = vm.signInfo.healthDoctorName
  478. }
  479. vm.warnMsg = "去年签约的健管师" + vm.justHDoc + "已不在您的团队,请重新选择一位健管师"
  480. vm.justHDoc = null
  481. vm.signInfo.healthDoctor = null
  482. vm.signInfo.healthDoctorName = null
  483. }
  484. top.changeTypeIndex=null
  485. }
  486. } else {
  487. showErrorMessage(res.msg);
  488. }
  489. })
  490. },
  491. teamMember2:function(val){
  492. var vm = this,
  493. loadding = layer.load(0, {shade: false}),
  494. params = {
  495. teamId: vm.signInfo.adminTeamCode,
  496. name:val||''
  497. }
  498. signAPI.teamMember(params).then(function(res) {
  499. layer.close(loadding)
  500. vm.memberList = [];
  501. vm.doctorList = [];
  502. vm.specialDoctorList=[];
  503. if(res.status == 200) {
  504. var judge = false
  505. $.each(res.data, function(i, v) {
  506. if(v.available) {
  507. if(v.code == vm.signInfo.doctor && vm.doctorType == 3) {
  508. judge = true
  509. }
  510. if(v.code == vm.signInfo.healthDoctor && vm.doctorType == 2) {
  511. judge = true
  512. }
  513. }
  514. if(v.available && (v.level == 3 || v.level == 2)) {vm.memberList.push(v);}
  515. if(v.available && v.level == 2) {vm.doctorList.push(v);}
  516. vm.specialDoctorList.push(v);
  517. });
  518. } else {
  519. showErrorMessage(res.msg);
  520. }
  521. })
  522. },
  523. handleSelect:function(item) {
  524. console.log(item);
  525. },
  526. handleIconClick:function(ev) {
  527. console.log(ev);
  528. },
  529. querySearch:function(queryString, cb) {
  530. var doctorList = this.doctorList;
  531. debugger
  532. var results = queryString ? doctorList.filter(this.createFilter(queryString)) : doctorList;
  533. // 调用 callback 返回建议列表的数据
  534. cb(results);
  535. },
  536. createFilter:function(queryString) {
  537. return function(restaurant){
  538. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  539. };
  540. },
  541. selectStatus: function(num,val) {
  542. var vm=this
  543. if(num == 1) {
  544. this.isShowList2 = false;
  545. this.isShowList3 = false;
  546. this.isShowList4 = false;
  547. this.isShowList1 = !this.isShowList1;
  548. } else if (num == 2 || num == 5) {
  549. if(!this.signInfo.adminTeamCode) {
  550. showWarningMessage("请先选择签约团队")
  551. return false;
  552. }
  553. } else if (num == 3) {
  554. }else if(num==5){
  555. } else {
  556. if(!this.signInfo.adminTeamCode) {
  557. showWarningMessage("请先选择签约团队")
  558. return false;
  559. }
  560. }
  561. // if(/^[\u4e00-\u9fa5]+$/i.test(val)){
  562. // _.debounce(vm.teamMember2(val), 300)
  563. // }
  564. },
  565. keyupStatus:function(num,val){
  566. vm.selectStatus(num)
  567. },
  568. selectLi: function(num,data) {
  569. if(num == 1) { // 选择签约团队
  570. this.isShowList1 = false;
  571. this.signInfo.adminTeamCode = data.id;
  572. this.signInfo.teamCode = data.id;
  573. if(this.doctorType == 2) {
  574. this.signInfo.healthDoctor = null
  575. this.signInfo.healthDoctorName = null
  576. }
  577. if(this.doctorType == 3) {
  578. this.signInfo.doctor = null
  579. this.signInfo.doctorName = null
  580. }
  581. // 发现切换团队时无法更新健管师列表,将这个判断取消后就可以更新.
  582. // if(!this.memberList || !this.doctorList) {
  583. this.teamMember()
  584. // }
  585. }
  586. if(num == 2) { // 选择健管师
  587. this.isShowList2 = false;
  588. this.signInfo.healthDoctorName = data.name
  589. this.signInfo.healthDoctor = data.code
  590. }
  591. if(num == 3) {
  592. this.isShowList3 = false;
  593. this.signInfo.expenses = data.code;
  594. }
  595. if(num == 4) { // 选择全科医生
  596. this.isShowList4 = false;
  597. this.signInfo.doctorName = data.name
  598. this.signInfo.doctor = data.code
  599. }
  600. if(num==5){//选择专科医生
  601. this.isShowList5=false
  602. this.signInfo.specialistName = data.name
  603. this.signInfo.specialist = data.code
  604. }
  605. },
  606. // 把原来下拉选择框变成可搜索下拉选择框
  607. changeSelect4:function(val){
  608. var obj = {};
  609. obj = this.doctorList.find(function(item){
  610. return item.code === val;
  611. });
  612. this.signInfo.doctorName=obj.name
  613. },
  614. changeSelect2:function(val){
  615. var obj = {};
  616. obj = this.memberList.find(function(item){
  617. return item.code === val;
  618. });
  619. this.signInfo.healthDoctorName=obj.name
  620. },
  621. changeSelect5:function(val){
  622. var obj = {};
  623. obj = this.specialDoctorList.find(function(item){
  624. return item.code === val;
  625. });
  626. this.signInfo.specialistName=obj.name
  627. },
  628. showTeamName: function(teamCode) {
  629. var teamName;
  630. if(!this.teamList) {
  631. return "请选择签约团队";
  632. }
  633. for(var i = 0, len = this.teamList.length; i < len; i++) {
  634. if(teamCode == this.teamList[i].id) {
  635. teamName = this.teamList[i].name;
  636. }
  637. }
  638. return teamName
  639. },
  640. showExpensesName: function(code) {
  641. var expensesName;
  642. if(!this.dictList) {
  643. return "请选择补贴类型";
  644. }
  645. for(var i = 0, len = this.dictList.length; i < len; i++) {
  646. if(code == this.dictList[i].code) {
  647. expensesName = this.dictList[i].value;
  648. }
  649. }
  650. return expensesName
  651. },
  652. setPatImg: function(str) {
  653. var imgStr = httpRequest.getImgUrl(str);
  654. if (imgStr == "") {
  655. return '../../../images/p-female.png';
  656. } else {
  657. return imgStr;
  658. }
  659. },
  660. lookPhoto: function(data) {
  661. var localurl=window.location.href;
  662. var useUrl=localurl.split("html/")[0]
  663. parent.photoLayerIndex = parent.layer.open({
  664. type: 2,
  665. area: ['70%', '600px'],
  666. title: false,
  667. shade: 0.5,
  668. shadeClose: true,
  669. shift: 2,
  670. content: useUrl+'html/photo_show.html?serverType=' + data.serverType + '&patientCode=' + httpData.patientCode
  671. })
  672. },
  673. refuse: function() {
  674. var vm = this;
  675. layer.open({
  676. type: 1,
  677. area: ['400px', '300px'],
  678. shade: 0.5,
  679. title: '拒绝签约原因',
  680. shift: 2,
  681. shadeClose: false, //点击遮罩关闭层
  682. 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>',
  683. btn: ['提 交', '取 消'],
  684. yes:function(index, layero) {
  685. if(!refuseReason) {
  686. if(!$("#reason").val()) {
  687. showWarningMessage("请选择或输入拒绝理由!");
  688. layer.close(index);
  689. return false
  690. }
  691. vm.signInfo.refuseReason = $("#reason").val()
  692. } else {
  693. if($("#reason").val()) {
  694. vm.signInfo.refuseReason = refuseReason + "。" + $("#reason").val()
  695. } else {
  696. vm.signInfo.refuseReason = refuseReason
  697. }
  698. }
  699. vm.signInfo.adminTeamCode = 0;
  700. vm.signInfo.teamCode = 0;
  701. vm.signInfo.type = 2;
  702. vm.signInfo.state = 0;
  703. vm.sign();
  704. layer.close(index);
  705. },
  706. success: function(layero){
  707. layero.find('.layui-layer-btn').css('text-align', 'center')
  708. }
  709. });
  710. },
  711. sign: function() {// type:1签约 2拒签
  712. 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))) {
  713. showWarningMessage("请将填写完整签约信息!");
  714. return false;
  715. }
  716. var vm = this,
  717. loadding = layer.load(0, {shade: false});
  718. if (httpData.status == 0) {
  719. var param = vm.signInfo
  720. if(vm.doctorType == 2) {
  721. param.doctor = null
  722. param.doctorName = null
  723. }
  724. if(vm.doctorType == 3) {
  725. param.doctorHealth = null
  726. param.doctorHealthName = null
  727. param.specialist=null
  728. param.specialistName=null
  729. }
  730. signAPI.sign(vm.signInfo).then(function(res) {
  731. layer.close(loadding)
  732. if(res.status == 200) {
  733. showSuccessMessage(res.msg || "操作成功")
  734. setTimeout(function() {
  735. parent.gobalVue.signCount();
  736. layer.closeAll();
  737. parent.layer.closeAll();
  738. }, 1000)
  739. } else {
  740. showErrorMessage(res.msg);
  741. }
  742. })
  743. } else {
  744. signAPI.signRenew(vm.signInfo).then(function(res) {
  745. layer.close(loadding)
  746. if(res.status == 200) {
  747. showSuccessMessage(res.msg || "操作成功")
  748. setTimeout(function() {
  749. parent.gobalVue.signCount();
  750. layer.closeAll();
  751. parent.layer.closeAll();
  752. }, 1000)
  753. } else {
  754. showErrorMessage(res.msg);
  755. }
  756. })
  757. }
  758. }
  759. }
  760. })