sign_handle.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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. isShowList1: false,
  37. isShowList2: false,
  38. isShowList3: false,
  39. showTit3: "请选择补贴类型",
  40. showTit4: "请选择服务类型",
  41. showTit5: "请选择居民标签",
  42. patientInfo: null,
  43. teamList: null,
  44. memberList: null,
  45. dictList: null,
  46. fileList: null,
  47. signInfo: {
  48. signType: 1,
  49. majorDoctor: null,
  50. majorDoctorName: null,
  51. healthLabel: null,
  52. customLabel: null,
  53. disease: null,
  54. patientIDcard: null, // 必填
  55. adminTeamCode: null,
  56. msgid: httpData.msgId, // 消息id(必填)
  57. patient: httpData.patientCode,
  58. healthDoctor: null,
  59. healthDoctorName: null,
  60. type: 1,
  61. expenses: null,
  62. group: null,
  63. //添加服务类型数据
  64. sevId: null,
  65. // 拒绝参数
  66. // adminTeamCode:0,
  67. // type: 2,
  68. refuseReason: null
  69. },
  70. },
  71. mounted: function() {
  72. if (httpData.status == 0) {
  73. this.signing()
  74. } else {
  75. this.signOuttime();
  76. }
  77. this.getDictByDictName();
  78. this.teamLimit();
  79. this.findPatientSignServerBySignCode();
  80. },
  81. methods: {
  82. signing: function() {
  83. var vm = this,
  84. loadding = layer.load(0, {shade: false}),
  85. params = {
  86. patient: httpData.patientCode
  87. }
  88. signAPI.signing(params).then(function(res) {
  89. layer.close(loadding)
  90. if(res.status == 200) {
  91. vm.patientInfo = res.data
  92. } else {
  93. showErrorMessage(res.msg);
  94. }
  95. })
  96. },
  97. signOuttime: function() {
  98. var vm = this,
  99. loadding = layer.load(0, {shade: false}),
  100. params = {
  101. patient: httpData.patientCode
  102. }
  103. signAPI.signOuttime(params).then(function(res) {
  104. layer.close(loadding)
  105. if(res.status == 200) {
  106. vm.patientInfo = res.data
  107. vm.signInfo.adminTeamCode = vm.patientInfo.jtSign.adminTeamId
  108. vm.signInfo.healthDoctorName = vm.patientInfo.jtSign.doctorHealthName
  109. vm.signInfo.healthDoctor = vm.patientInfo.jtSign.doctorHealth
  110. vm.signInfo.expenses = vm.patientInfo.jtSign.expensesType
  111. vm.teamMember()
  112. } else {
  113. showErrorMessage(res.msg);
  114. }
  115. })
  116. },
  117. getDictByDictName: function() {
  118. var vm =this,
  119. loadding = layer.load(0, {shade: false}),
  120. params = {
  121. name: "SIGN_EXPENSES"
  122. }
  123. signAPI.getDictByDictName(params).then(function(res) {
  124. layer.close(loadding)
  125. if(res.status == 200) {
  126. vm.dictList = res.list
  127. } else {
  128. showErrorMessage(res.msg);
  129. }
  130. })
  131. },
  132. teamLimit: function() {
  133. var vm = this,
  134. loadding = layer.load(0, {shade: false}),
  135. params = {
  136. doctorId: doctorInfo.uid
  137. }
  138. signAPI.teamLimit(params).then(function(res) {
  139. layer.close(loadding)
  140. if(res.status == 200) {
  141. vm.teamList = res.data
  142. } else {
  143. showErrorMessage(res.msg);
  144. }
  145. })
  146. },
  147. findPatientSignServerBySignCode: function() {
  148. var vm =this,
  149. loadding = layer.load(0, {shade: false}),
  150. params = {
  151. signCode: httpData.signCode
  152. };
  153. signAPI.findPatientSignServerBySignCode(params).then(function(res) {
  154. layer.close(loadding)
  155. if(res.status == 200) {
  156. vm.fileList = []
  157. $.each(res.data, function(i, v) {
  158. if(v.serverType == 8 || v.serverType == 9 || v.serverType == 11) {
  159. vm.fileList.push(v);
  160. }
  161. });
  162. } else {
  163. showErrorMessage(res.msg);
  164. }
  165. })
  166. },
  167. teamMember: function() {
  168. var vm = this,
  169. loadding = layer.load(0, {shade: false}),
  170. params = {
  171. teamId: vm.signInfo.adminTeamCode
  172. }
  173. signAPI.teamMember(params).then(function(res) {
  174. layer.close(loadding)
  175. vm.memberList = []
  176. if(res.status == 200) {
  177. $.each(res.data, function(i, v) {
  178. if(v.level == 3 || v.level == 2)
  179. vm.memberList.push(v);
  180. });
  181. } else {
  182. showErrorMessage(res.msg);
  183. }
  184. })
  185. },
  186. selectStatus: function(num) {
  187. if(num == 1) {
  188. this.isShowList2 = false;
  189. this.isShowList3 = false;
  190. this.isShowList1 = !this.isShowList1;
  191. } else if (num == 2) {
  192. if(!this.signInfo.adminTeamCode) {
  193. showWarningMessage("请先选择签约团队")
  194. }
  195. this.isShowList1 = false;
  196. this.isShowList3 = false;
  197. this.isShowList2 = !this.isShowList2;
  198. } else {
  199. this.isShowList1 = false;
  200. this.isShowList2 = false;
  201. this.isShowList3 = !this.isShowList3;
  202. }
  203. },
  204. selectLi: function(num, data) {
  205. if(num == 1) {
  206. this.isShowList1 = false;
  207. this.signInfo.adminTeamCode = data.id;
  208. if(!this.memberList) {
  209. this.teamMember()
  210. }
  211. }
  212. if(num == 2) {
  213. this.isShowList2 = false;
  214. this.signInfo.healthDoctorName = data.name
  215. this.signInfo.healthDoctor = data.code
  216. }
  217. if(num == 3) {
  218. this.isShowList3 = false;
  219. this.signInfo.expenses = data.code;
  220. }
  221. },
  222. showTeamName: function(teamCode) {
  223. var teamName;
  224. if(!this.teamList) {
  225. return "请选择签约团队";
  226. }
  227. for(var i = 0, len = this.teamList.length; i < len; i++) {
  228. if(teamCode == this.teamList[i].id) {
  229. teamName = this.teamList[i].name;
  230. }
  231. }
  232. return teamName
  233. },
  234. showExpensesName: function(code) {
  235. var expensesName;
  236. if(!this.dictList) {
  237. return "请选择补贴类型";
  238. }
  239. for(var i = 0, len = this.dictList.length; i < len; i++) {
  240. if(code == this.dictList[i].code) {
  241. expensesName = this.dictList[i].value;
  242. }
  243. }
  244. return expensesName
  245. },
  246. setPatImg: function(str) {
  247. var imgStr = httpRequest.getImgUrl(str);
  248. if (imgStr == "") {
  249. return '../../../images/p-female.png';
  250. } else {
  251. return imgStr;
  252. }
  253. },
  254. lookPhoto: function(data) {
  255. layer.open({
  256. type: 2,
  257. area: ['100%', '100%'],
  258. title: "凭证预览",
  259. shade: 0.5,
  260. shadeClose: true,
  261. shift: 2,
  262. content: '../html/photo_show.html?serverType=' + data.serverType + '&patientCode=' + httpData.patientCode
  263. })
  264. },
  265. refuse: function() {
  266. var vm = this;
  267. layer.open({
  268. type: 1,
  269. area: ['400px', '300px'],
  270. shade: 0.5,
  271. title: '拒绝签约原因',
  272. shift: 2,
  273. shadeClose: false, //点击遮罩关闭层
  274. 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>',
  275. btn: ['提 交', '取 消'],
  276. yes:function(index, layero) {
  277. if(!refuseReason) {
  278. if(!$("#reason").val()) {
  279. showWarningMessage("请选择或输入拒绝理由!");
  280. layer.close(index);
  281. return false
  282. }
  283. vm.signInfo.refuseReason = $("#reason").val()
  284. vm.signInfo.adminTeamCode = 0
  285. vm.signInfo.type = 2
  286. vm.sign()
  287. }
  288. layer.close(index);
  289. },
  290. success: function(layero){
  291. layero.find('.layui-layer-btn').css('text-align', 'center')
  292. }
  293. });
  294. },
  295. sign: function() {// type:1签约 2拒签
  296. var vm = this,
  297. loadding = layer.load(0, {shade: false});
  298. signAPI.sign(vm.signInfo).then(function(res) {
  299. layer.close(loadding)
  300. if(res.status == 200) {
  301. } else {
  302. showErrorMessage(res.msg);
  303. }
  304. })
  305. }
  306. }
  307. })