appoint-commit.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. var Request = new Object()
  2. Request = GetRequest()
  3. var param = JSON.parse(decodeURIComponent(Request.paramStr)),
  4. backToSynergy = Request.backToSynergy
  5. // param.key = ''
  6. // param.imgCaptcha = ''
  7. $(function () {
  8. // document.getElementById('referenceInformation').bsSuggest({
  9. // data: [{
  10. // code: '',
  11. // name: '全部'
  12. // }],
  13. // getDataMethod: 'data',
  14. // effectiveFields: ['name'],
  15. // idField: 'code',
  16. // keyField: 'name'
  17. // })
  18. $('#closeBtn').click(function () {
  19. closeLayer()
  20. })
  21. $('input:radio').click(function () {
  22. console.log($('input:radio:checked').val(), 'aaaaaaaaaaaaaaaaaaa')
  23. })
  24. $('input:checkbox').click(function () {
  25. var checkList = new Array()
  26. $('input[name="referInfo"]:checked').each(function () {
  27. checkList.push($(this).val()) //向数组中添加元素
  28. console.log('asxxsxsxs', checkList)
  29. })
  30. })
  31. })
  32. function closeLayer() {
  33. var index = top.layer.getFrameIndex(window.name)
  34. top.layer.close(index)
  35. }
  36. // 获取滑动验证码
  37. function createcode(id, callback,patient) {
  38. APIService.createPicCaptcha({
  39. patient: patient
  40. }).then(function(res){
  41. if (res.status == 200) {
  42. var data = res.data
  43. if (data != null) {
  44. $("#"+id)
  45. .imgcode(
  46. {
  47. frontimg : 'data:image/png;base64,'
  48. + data.slideImage,
  49. backimg : 'data:image/png;base64,'
  50. + data.backImage,
  51. yHeight : data.y,
  52. refreshcallback : function() {
  53. //刷新验证码
  54. createcode(id, callback);
  55. },
  56. callback : function(msg) {
  57. console.log(msg);
  58. callback({
  59. key: data.imageToken,
  60. imgCaptcha: JSON.stringify([{
  61. x: msg.xpos,
  62. y: data.y
  63. }])
  64. })
  65. }
  66. });
  67. } else {
  68. mui.toast(res.msg || "验证码获取失败")
  69. // reject()
  70. }
  71. } else {
  72. mui.toast("验证码获取失败");
  73. // reject()
  74. }
  75. })
  76. }
  77. new Vue({
  78. el: '#app',
  79. data: function () {
  80. return {
  81. param: param,
  82. imgCodeImg: '',
  83. radio: 0,
  84. referenceInfo: '已选0',
  85. EDUCATE_CONTENT:'',
  86. referenceShow:false,
  87. tablelist:[],
  88. pageNo:1,
  89. pagesize:10,
  90. pagetotal:'',
  91. checkList:[],
  92. placeholder:"请选择参考信息",
  93. }
  94. },
  95. mounted: function () {
  96. var vm = this
  97. this.getResultList()
  98. document.addEventListener('click',function(){
  99. // if(vm.referenceShow){
  100. // vm.referenceShow = false
  101. // }
  102. })
  103. },
  104. watch:{
  105. checkList() {
  106. this.placeholder = this.checkList.length!=0?"已选"+this.checkList.length+"项":"请选择参考信息"
  107. },
  108. },
  109. methods: {
  110. submitBtn:function() {
  111. var vm = this
  112. if (!param.patientPhone) {
  113. top.showErrorMessage('请填写病人手机号码')
  114. top.layer.close(loadingid)
  115. return
  116. }
  117. createcode('imgscode',function(content) {
  118. $('#imgscode').html('')
  119. vm.applyData(content)
  120. },param.patient)
  121. },
  122. applyData:function(imgscodeContent) {
  123. var vm = this
  124. var loadingid = top.layer.load(1, {
  125. shade: [0.1, '#fff'] //0.1透明度的白色背景
  126. })
  127. var p = JSON.parse(JSON.stringify(param))
  128. var user = JSON.parse(localStorage.getItem('docInfo'))
  129. p.imgCaptcha = imgscodeContent.imgCaptcha
  130. p.key = imgscodeContent.key
  131. p.dcode = user.code
  132. p.dname = user.name
  133. p.relationCode = param.surveyCode
  134. p.reservationType = $('input:radio:checked').val()
  135. p.incidentalMsgType = '11' //筛查报告11
  136. p.incidentalMsg = '筛查报告' //参考信息
  137. p.reservationReason = vm.EDUCATE_CONTENT // 转诊原因
  138. var content = []
  139. vm.checkList.forEach(function(s){
  140. content.push({
  141. addinfoText:s.czrq+s.templateTitle,
  142. code:s.code,
  143. patient:s.patientCode,
  144. patientName:s.patientName,
  145. })
  146. })
  147. var para = {
  148. type:"11",
  149. content:content,
  150. }
  151. p.paramJson = encodeURIComponent(encodeURIComponent(JSON.stringify([para])))
  152. var arrangeDate = JSON.parse(p.arrangeDate)
  153. arrangeDate.sectionType = 'a'
  154. arrangeDate.clazz = 'div-time-enable'
  155. p.arrangeDate = JSON.stringify(arrangeDate)
  156. // "sectionType":"a","clazz":"div-time-enable"
  157. // p.arrangeDate = JSON.stringify(p.arrangeDate)
  158. // {"max":"1","startTime":"2020/4/17 8:00:00","used":"0","endTime":"2020/4/17 8:07:00","sectionType":"a","clazz":"div-time-enable"}
  159. APIService.createOrderByDoctor(p)
  160. .then(function (res) {
  161. top.layer.close(loadingid)
  162. if (res.status == 200) {
  163. parent.eventBuss.$emit('guan_results')
  164. top.showSuccessMessage('提交预约挂号成功!')
  165. if (backToSynergy) {
  166. top.setSynergyData(param)
  167. }
  168. closeLayer()
  169. } else {
  170. top.showErrorMessage(res.msg || '预约挂号提交失败!请稍后重试')
  171. }
  172. })
  173. .catch(function (e) {
  174. top.layer.close(loadingid)
  175. console && console.error(e)
  176. })
  177. },
  178. more:function() {
  179. this.pageNo++
  180. this.getResultList()
  181. },
  182. getResultList:function() {
  183. var vm = this
  184. var params = {
  185. diseaseType: '', //疾病类型
  186. dealType: '', //处理方式(全部为空 1已预约 2已跟踪 3已接诊4待处理)
  187. patientName:vm.param.patientName, //搜索居民的姓名
  188. isDanger: 1, //是否高危预警(0否 1是)
  189. pageNo: this.pageNo,
  190. pageSize: vm.pagesize
  191. }
  192. jbscAPI.getResultList(params).then(function (res) {
  193. if (res.status == 200) {
  194. if(this.pageNo==1) {
  195. vm.tablelist = res.data.data
  196. }else{
  197. vm.tablelist = vm.tablelist.concat(res.data.data)
  198. }
  199. vm.pagetotal = Math.ceil(res.data.num / vm.pagesize)
  200. } else {
  201. showErrorMessage(res.msg)
  202. }
  203. })
  204. },
  205. }
  206. })