sign_handle.js 9.2 KB

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