sign_handle.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. var httpData=GetRequest(),
  2. doctorInfo = JSON.parse(window.localStorage.getItem('wlyyAgent'));
  3. var refuseReason = null;
  4. function showSuccessMessage(msg) {
  5. layer.msg(msg, {
  6. icon: 1
  7. })
  8. }
  9. function showErrorMessage(msg) {
  10. layer.msg(msg, {
  11. icon: 5
  12. })
  13. }
  14. function showWarningMessage(msg) {
  15. layer.msg(msg, {
  16. icon: 2
  17. })
  18. }
  19. function showInfoMessage(msg) {
  20. layer.msg(msg, {
  21. icon: 6
  22. })
  23. }
  24. function getReason(ele) {
  25. if(ele.hasClass("active")) {
  26. ele.removeClass("active")
  27. refuseReason = null
  28. return false;
  29. }
  30. ele.addClass("active").siblings().removeClass("active");
  31. refuseReason = ele.html();
  32. }
  33. top.changeTypeIndex=null;//修改居民标签的窗体
  34. top.handleVue=new Vue({
  35. el: "#app",
  36. data: {
  37. doctorType: doctorInfo.doctorType,
  38. isShowList1: false,
  39. isShowList2: false,
  40. isShowList3: false,
  41. isShowList4: false,
  42. showTit3: "请选择补贴类型",
  43. showTit5: "请选择居民标签",
  44. patientInfo: null,
  45. warnMsg: "",
  46. teamList: null,
  47. memberList: null, // 团队成员列表
  48. doctorList: null, // 全科医生列表
  49. dictList: null,
  50. fileList: null,
  51. serverName: null,
  52. serverCode: null,
  53. signInfo: {
  54. signType: 1,
  55. majorDoctor: null,
  56. majorDoctorName: null,
  57. healthLabel: null,
  58. customLabel: null,
  59. disease: null,
  60. patientIDcard: null, // 必填
  61. adminTeamCode: null,
  62. msgid: httpData.msgId, // 消息id(必填)
  63. patient: httpData.patientCode,
  64. doctor: null,
  65. doctorName: null,
  66. healthDoctor: null,
  67. healthDoctorName: null,
  68. type: 1,
  69. expenses: null,
  70. group: null,
  71. //添加服务类型数据
  72. sevId: null,
  73. // 拒绝参数
  74. // adminTeamCode:0,
  75. // type: 2,
  76. refuseReason: null
  77. },
  78. },
  79. mounted: function() {
  80. this.getDictByDictName();
  81. this.teamLimit();
  82. this.patientLabel();
  83. this.findPatientSignServerBySignCode();
  84. },
  85. methods: {
  86. signing: function() {
  87. var vm = this,
  88. loadding = layer.load(0, {shade: false}),
  89. params = {
  90. patient: httpData.patientCode
  91. }
  92. signAPI.signing(params).then(function(res) {
  93. layer.close(loadding)
  94. if(res.status == 200) {
  95. vm.patientInfo = res.data
  96. } else {
  97. showErrorMessage(res.msg);
  98. }
  99. })
  100. },
  101. selectServer:function(){
  102. var vm=this
  103. if(top.changeTypeIndex && top.$('#layui-layer-shade'+top.changeTypeIndex).length){
  104. (top.$('#layui-layer-shade'+top.changeTypeIndex).show(),top.$('#layui-layer'+top.changeTypeIndex).show());
  105. }else{
  106. top.changeTypeIndex=top.layer.open({
  107. type: 2,
  108. area: ['500px', '405px'],
  109. title: "修改居民标签",
  110. shade: 0.5,
  111. shadeClose: false,
  112. closeBtn: 0,
  113. shift: 2,
  114. content: '../html/modify-the-label.html?patient=' + httpData.patientCode+'&teamCode='+vm.signInfo.adminTeamCode
  115. });
  116. }
  117. },
  118. acceptanceRes:function(res){
  119. console.log(res)
  120. },
  121. signOuttime: function() {
  122. var vm = this,
  123. loadding = layer.load(0, {shade: false}),
  124. params = {
  125. patient: httpData.patientCode
  126. }
  127. signAPI.signOuttime(params).then(function(res) {
  128. layer.close(loadding)
  129. if(res.status == 200) {
  130. vm.patientInfo = res.data
  131. vm.signInfo.adminTeamCode = vm.patientInfo.jtSign.adminTeamId
  132. vm.signInfo.healthDoctorName = vm.patientInfo.jtSign.doctorHealthName || ""
  133. vm.signInfo.healthDoctor = vm.patientInfo.jtSign.doctorHealth || ""
  134. vm.signInfo.doctor = vm.patientInfo.jtSign.doctor || ""
  135. vm.signInfo.doctorName = vm.patientInfo.jtSign.doctorName || ""
  136. vm.signInfo.expenses = vm.patientInfo.jtSign.expensesType
  137. vm.judgeTeamToDoc(vm.signInfo.adminTeamCode)
  138. } else {
  139. showErrorMessage(res.msg);
  140. }
  141. })
  142. },
  143. judgeTeamToDoc: function(teamCode) {
  144. var judge = false
  145. for(var i = 0, len = this.teamList.length; i < len; i++) {
  146. if(this.teamList[i].id == teamCode) {
  147. judge = true
  148. this.teamMember()
  149. }
  150. }
  151. if(!judge) {
  152. this.signInfo.adminTeamCode = null
  153. this.warnMsg = "您已不在原签约团队,请选择新的签约团队"
  154. if(this.doctorType == 2) {
  155. this.signInfo.healthDoctorName = null
  156. this.signInfo.healthDoctor = null
  157. } else {
  158. this.signInfo.doctor = null
  159. this.signInfo.doctorName = null
  160. }
  161. }
  162. },
  163. patientLabel: function() {
  164. var vm =this,
  165. loadding = layer.load(0, {shade: false}),
  166. params = {
  167. patient: httpData.patientCode,
  168. labelType: null
  169. }
  170. signAPI.patientLabel(params).then(function(res) {
  171. layer.close(loadding)
  172. if(res.status == 200) {
  173. } else {
  174. showErrorMessage(res.msg);
  175. }
  176. })
  177. },
  178. getDictByDictName: function() {
  179. var vm =this,
  180. loadding = layer.load(0, {shade: false}),
  181. params = {
  182. name: "SIGN_EXPENSES"
  183. }
  184. signAPI.getDictByDictName(params).then(function(res) {
  185. layer.close(loadding)
  186. if(res.status == 200) {
  187. vm.dictList = res.list
  188. } else {
  189. showErrorMessage(res.msg);
  190. }
  191. })
  192. },
  193. teamLimit: function() {
  194. var vm = this,
  195. loadding = layer.load(0, {shade: false}),
  196. params = {
  197. doctorId: doctorInfo.uid
  198. }
  199. signAPI.teamLimit(params).then(function(res) {
  200. layer.close(loadding)
  201. if(res.status == 200) {
  202. vm.teamList = res.data
  203. if (httpData.status == 0) {
  204. vm.signing()
  205. } else {
  206. vm.signOuttime();
  207. }
  208. } else {
  209. showErrorMessage(res.msg);
  210. }
  211. })
  212. },
  213. findPatientSignServerBySignCode: function() {
  214. var vm =this,
  215. loadding = layer.load(0, {shade: false}),
  216. params = {
  217. signCode: httpData.signCode
  218. };
  219. signAPI.findPatientSignServerBySignCode(params).then(function(res) {
  220. layer.close(loadding)
  221. if(res.status == 200) {
  222. vm.fileList = [];
  223. var len = res.data.length;
  224. if(res.data.length > 0) {
  225. vm.serverName = "";
  226. vm.serverCode = "";
  227. for(var i = 0; i < len; i++) {
  228. if(i == 0) {
  229. vm.serverName += res.data[i].serverTypeName
  230. vm.serverCode += res.data[i].servetType
  231. } else {
  232. vm.serverName += + ', ' + res.data[i].serverTypeName
  233. vm.serverCode += +',' + res.data[i].servetType
  234. }
  235. }
  236. }
  237. $.each(res.data, function(i, v) {
  238. if(v.serverType == 8 || v.serverType == 9 || v.serverType == 11) {
  239. vm.fileList.push(v);
  240. }
  241. });
  242. } else {
  243. showErrorMessage(res.msg);
  244. }
  245. })
  246. },
  247. teamMember: function() {
  248. var vm = this,
  249. loadding = layer.load(0, {shade: false}),
  250. params = {
  251. teamId: vm.signInfo.adminTeamCode
  252. }
  253. signAPI.teamMember(params).then(function(res) {
  254. layer.close(loadding)
  255. vm.memberList = [];
  256. vm.doctorList = [];
  257. if(res.status == 200) {
  258. var judge = false
  259. $.each(res.data, function(i, v) {
  260. if(v.available) {
  261. if(v.code == vm.signInfo.doctor && vm.doctorType == 3) {
  262. judge = true
  263. }
  264. if(v.code == vm.signInfo.healthDoctor && vm.doctorType == 2) {
  265. judge = true
  266. }
  267. }
  268. if(v.available && (v.level == 3 || v.level == 2)) {vm.memberList.push(v);}
  269. if(v.available && v.level == 2) {vm.doctorList.push(v);}
  270. });
  271. if(!judge) {
  272. if(vm.doctorType == 3) {
  273. vm.signInfo.doctor = null
  274. vm.signInfo.doctorName = null
  275. vm.warnMsg = "居民续签的全科医生已不在您的团队,请重新选择一位全科医生"
  276. }
  277. if(vm.doctorType == 2) {
  278. vm.signInfo.healthDoctor = null
  279. vm.signInfo.healthDoctorName = null
  280. vm.warnMsg = "居民续签的健管师已不在您的团队,请重新选择一位健管师"
  281. }
  282. top.changeTypeIndex=null
  283. }
  284. } else {
  285. showErrorMessage(res.msg);
  286. }
  287. })
  288. },
  289. selectStatus: function(num) {
  290. if(num == 1) {
  291. this.isShowList2 = false;
  292. this.isShowList3 = false;
  293. this.isShowList4 = false;
  294. this.isShowList1 = !this.isShowList1;
  295. } else if (num == 2) {
  296. if(!this.signInfo.adminTeamCode) {
  297. showWarningMessage("请先选择签约团队")
  298. return false;
  299. }
  300. this.isShowList1 = false;
  301. this.isShowList3 = false;
  302. this.isShowList4 = false;
  303. this.isShowList2 = !this.isShowList2;
  304. } else if (num == 3) {
  305. this.isShowList1 = false;
  306. this.isShowList2 = false;
  307. this.isShowList4 = false;
  308. this.isShowList3 = !this.isShowList3;
  309. } else {
  310. this.isShowList1 = false;
  311. this.isShowList2 = false;
  312. this.isShowList3 = false;
  313. this.isShowList4 = !this.isShowList4;
  314. }
  315. },
  316. selectLi: function(num, data) {
  317. if(num == 1) { // 选择签约团队
  318. this.isShowList1 = false;
  319. this.signInfo.adminTeamCode = data.id;
  320. if(this.doctorType == 2) {
  321. this.signInfo.healthDoctor = null
  322. this.signInfo.healthDoctorName = null
  323. }
  324. if(this.doctorType == 3) {
  325. this.signInfo.doctor = null
  326. this.signInfo.doctorName = null
  327. }
  328. if(!this.memberList || !this.doctorList) {
  329. this.teamMember()
  330. }
  331. }
  332. if(num == 2) { // 选择健管师
  333. this.isShowList2 = false;
  334. this.signInfo.healthDoctorName = data.name
  335. this.signInfo.healthDoctor = data.code
  336. }
  337. if(num == 3) {
  338. this.isShowList3 = false;
  339. this.signInfo.expenses = data.code;
  340. }
  341. if(num == 4) { // 选择全科医生
  342. this.isShowList4 = false;
  343. this.signInfo.doctorName = data.name
  344. this.signInfo.doctor = data.code
  345. }
  346. },
  347. showTeamName: function(teamCode) {
  348. var teamName;
  349. if(!this.teamList) {
  350. return "请选择签约团队";
  351. }
  352. for(var i = 0, len = this.teamList.length; i < len; i++) {
  353. if(teamCode == this.teamList[i].id) {
  354. teamName = this.teamList[i].name;
  355. }
  356. }
  357. return teamName
  358. },
  359. showExpensesName: function(code) {
  360. var expensesName;
  361. if(!this.dictList) {
  362. return "请选择补贴类型";
  363. }
  364. for(var i = 0, len = this.dictList.length; i < len; i++) {
  365. if(code == this.dictList[i].code) {
  366. expensesName = this.dictList[i].value;
  367. }
  368. }
  369. return expensesName
  370. },
  371. setPatImg: function(str) {
  372. var imgStr = httpRequest.getImgUrl(str);
  373. if (imgStr == "") {
  374. return '../../../images/p-female.png';
  375. } else {
  376. return imgStr;
  377. }
  378. },
  379. lookPhoto: function(data) {
  380. layer.open({
  381. type: 2,
  382. area: ['100%', '100%'],
  383. title: "凭证预览",
  384. shade: 0.5,
  385. shadeClose: true,
  386. shift: 2,
  387. content: '../html/photo_show.html?serverType=' + data.serverType + '&patientCode=' + httpData.patientCode
  388. })
  389. },
  390. refuse: function() {
  391. var vm = this;
  392. layer.open({
  393. type: 1,
  394. area: ['400px', '300px'],
  395. shade: 0.5,
  396. title: '拒绝签约原因',
  397. shift: 2,
  398. shadeClose: false, //点击遮罩关闭层
  399. 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>',
  400. btn: ['提 交', '取 消'],
  401. yes:function(index, layero) {
  402. if(!refuseReason) {
  403. if(!$("#reason").val()) {
  404. showWarningMessage("请选择或输入拒绝理由!");
  405. layer.close(index);
  406. return false
  407. }
  408. vm.signInfo.refuseReason = $("#reason").val()
  409. vm.signInfo.adminTeamCode = 0
  410. vm.signInfo.type = 2
  411. vm.sign()
  412. }
  413. layer.close(index);
  414. },
  415. success: function(layero){
  416. layero.find('.layui-layer-btn').css('text-align', 'center')
  417. }
  418. });
  419. },
  420. sign: function() {// type:1签约 2拒签
  421. var vm = this,
  422. loadding = layer.load(0, {shade: false});
  423. signAPI.sign(vm.signInfo).then(function(res) {
  424. layer.close(loadding)
  425. if(res.status == 200) {
  426. } else {
  427. showErrorMessage(res.msg);
  428. }
  429. })
  430. }
  431. }
  432. })