appoint-commit.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. isFuzhen: null
  94. }
  95. },
  96. mounted: function () {
  97. var vm = this
  98. this.getResultList()
  99. this.isFuzhen = sessionStorage.getItem("isFuzhen")
  100. document.addEventListener('click',function(){
  101. // if(vm.referenceShow){
  102. // vm.referenceShow = false
  103. // }
  104. })
  105. },
  106. watch:{
  107. checkList() {
  108. this.placeholder = this.checkList.length!=0?"已选"+this.checkList.length+"项":"请选择参考信息"
  109. },
  110. },
  111. methods: {
  112. submitBtn:function() {
  113. var vm = this
  114. if (!param.patientPhone) {
  115. top.showErrorMessage('请填写病人手机号码')
  116. top.layer.close(loadingid)
  117. return
  118. }
  119. createcode('imgscode',function(content) {
  120. $('#imgscode').html('')
  121. vm.applyData(content)
  122. },param.patient)
  123. },
  124. applyData:function(imgscodeContent) {
  125. var vm = this
  126. var loadingid = top.layer.load(1, {
  127. shade: [0.1, '#fff'] //0.1透明度的白色背景
  128. })
  129. var p = JSON.parse(JSON.stringify(param))
  130. var user = JSON.parse(localStorage.getItem('docInfo'))
  131. p.imgCaptcha = imgscodeContent.imgCaptcha
  132. p.key = imgscodeContent.key
  133. p.dcode = user.code
  134. p.dname = user.name
  135. p.relationCode = param.surveyCode
  136. p.reservationType = $('input:radio:checked').val()
  137. p.incidentalMsgType = '11' //筛查报告11
  138. p.incidentalMsg = '筛查报告' //参考信息
  139. p.reservationReason = vm.EDUCATE_CONTENT // 转诊原因
  140. var content = []
  141. vm.checkList.forEach(function(s){
  142. content.push({
  143. addinfoText:s.czrq+s.templateTitle,
  144. code:s.code,
  145. patient:s.patientCode,
  146. patientName:s.patientName,
  147. })
  148. })
  149. var para = {
  150. type:"11",
  151. content:content,
  152. }
  153. p.paramJson = encodeURIComponent(encodeURIComponent(JSON.stringify([para])))
  154. var arrangeDate = JSON.parse(p.arrangeDate)
  155. arrangeDate.sectionType = 'a'
  156. arrangeDate.clazz = 'div-time-enable'
  157. p.arrangeDate = JSON.stringify(arrangeDate)
  158. // "sectionType":"a","clazz":"div-time-enable"
  159. // p.arrangeDate = JSON.stringify(p.arrangeDate)
  160. // {"max":"1","startTime":"2020/4/17 8:00:00","used":"0","endTime":"2020/4/17 8:07:00","sectionType":"a","clazz":"div-time-enable"}
  161. APIService.createOrderByDoctor(p)
  162. .then(function (res) {
  163. top.layer.close(loadingid)
  164. if (res.status == 200) {
  165. parent.eventBuss.$emit('guan_results')
  166. top.showSuccessMessage('提交预约挂号成功!')
  167. if (backToSynergy) {
  168. top.setSynergyData(param)
  169. }
  170. closeLayer()
  171. } else {
  172. top.showErrorMessage(res.msg || '预约挂号提交失败!请稍后重试')
  173. }
  174. })
  175. .catch(function (e) {
  176. top.layer.close(loadingid)
  177. console && console.error(e)
  178. })
  179. },
  180. more:function() {
  181. this.pageNo++
  182. this.getResultList()
  183. },
  184. getResultList:function() {
  185. var vm = this
  186. var params = {
  187. diseaseType: '', //疾病类型
  188. dealType: '', //处理方式(全部为空 1已预约 2已跟踪 3已接诊4待处理)
  189. patientName:vm.param.patientName, //搜索居民的姓名
  190. isDanger: 1, //是否高危预警(0否 1是)
  191. pageNo: this.pageNo,
  192. pageSize: vm.pagesize
  193. }
  194. jbscAPI.getResultList(params).then(function (res) {
  195. if (res.status == 200) {
  196. if(this.pageNo==1) {
  197. vm.tablelist = res.data.data
  198. }else{
  199. vm.tablelist = vm.tablelist.concat(res.data.data)
  200. }
  201. vm.pagetotal = Math.ceil(res.data.num / vm.pagesize)
  202. } else {
  203. showErrorMessage(res.msg)
  204. }
  205. })
  206. },
  207. }
  208. })