sign_handle.js 12 KB

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