xinxiqueren.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. var self,
  2. firstData,
  3. docInfo,
  4. state,
  5. secondData;
  6. mui.plusReady(function(){
  7. self = plus.webview.currentWebview();
  8. state = self.state;
  9. docInfo = JSON.parse(plus.storage.getItem("docInfo"));
  10. firstData = JSON.parse(plus.storage.getItem("jiandangCase1"));
  11. var case2 = plus.storage.getItem("jiandangCase2")
  12. secondData = case2?JSON.parse(case2):'';
  13. var html = template('list_tmp',{fData:firstData,sData:secondData})
  14. $(".c-main").html(html)
  15. bindEvent()
  16. function bindEvent(){
  17. $('.edit').on('tap',function(){
  18. var $id = $(this).attr('data-id');
  19. if($id == 1){
  20. mui.openWindow({
  21. id: "zizhujiandang",
  22. url: "zizhujiandang.html",
  23. waiting:{autoShow:false}
  24. })
  25. }
  26. if($id == 2){
  27. mui.openWindow({
  28. id: "xinxicaiji",
  29. url: "xinxicaiji.html",
  30. waiting:{autoShow:false}
  31. })
  32. }
  33. })
  34. $('.jm-btn').on('tap',function(){
  35. var params = {
  36. doctorCode:docInfo.code,
  37. idcard:firstData.idcard,
  38. ssc:firstData.ssc,
  39. sex:firstData.sex,
  40. name:firstData.name,
  41. mobile:firstData.mobile,
  42. origo:firstData.addressCode,
  43. origoStr:firstData.address,
  44. jwCountryCode:firstData.countryCode,
  45. nation:firstData.national,
  46. blood:firstData.Blood_type,
  47. marry:firstData.marry,
  48. adress:firstData.Present_Address,
  49. brithday:firstData.Birthday,
  50. education:secondData.education,//教育水平
  51. occupation:secondData.occupation,//职业
  52. payment:secondData.payment, //支付方式
  53. drugAllergys:secondData.drugAllergys,//药物过敏历史
  54. drugOtherContent:secondData.drugOtherContent, //药物过敏其他内容
  55. pastHistorys:secondData.pastHistorys,//既往史
  56. pastHistoryDate:secondData.pastHistoryDate, //时间
  57. pastHistoryContent:secondData.pastHistoryContent, //既往史其他内容
  58. geneticFlag:secondData.geneticFlag,//有无遗传病历史0无,1有
  59. geneticContent:secondData.geneticContent,//遗传病历史内容
  60. disabilitys:secondData.disabilitys, //残疾
  61. familyHistoryFlag:secondData.familyHistoryFlag,//有无
  62. familyFatherHistorys:secondData.familyFatherHistorys,//父亲的疾病
  63. familyMotherHistorys:secondData.familyMotherHistorys, //母亲的疾病
  64. familyBrotherHistorys:secondData.familyBrotherHistorys, //兄弟的疾病
  65. familyChildrenHistorys:secondData.familyChildrenHistorys, //子女的疾病
  66. }
  67. var params2 = {
  68. name:firstData.name,
  69. idcard:firstData.idcard,
  70. ssc:firstData.ssc,
  71. mobile:firstData.mobile
  72. }
  73. plus.nativeUI.showWaiting();
  74. sendPost('/doctor/patient/check_regist_info',params2,function(){
  75. plus.nativeUI.closeWaiting();
  76. mui.toast('请求失败');
  77. },function(res){
  78. if (res.status==200) {
  79. sendPost('doctor/patient/createProfileAndSignDeail',{archiveJson:JSON.stringify(params)},function(){
  80. plus.nativeUI.closeWaiting();
  81. mui.toast('请求失败')
  82. },function(res){
  83. plus.nativeUI.closeWaiting();
  84. if(res.status == 200){
  85. mui.toast('提交成功')
  86. plus.storage.removeItem("jiandangCase1")
  87. plus.storage.removeItem("jiandangCase2")
  88. if(state == -3){//未签约
  89. setTimeout(function(){
  90. mui.openWindow({
  91. id: "dailiqianyue",
  92. url: "../../mine/html/dailiqianyue.html",
  93. extras: {
  94. name:firstData.name,
  95. idCard:firstData.idcardAll,
  96. ssc:firstData.ssc,
  97. mobile:firstData.mobile,
  98. countryCode:firstData.countryCode,
  99. countryName:firstData.countryName,
  100. kind:1
  101. }
  102. })
  103. },500)
  104. }else{
  105. var dljd = plus.webview.getWebviewById('dailijiandang');
  106. var zzjd = plus.webview.getWebviewById('zizhujiandang');
  107. var xxcj = plus.webview.getWebviewById('xinxicaiji');
  108. var xxqr = plus.webview.getWebviewById('xinxiqueren');
  109. var jmqy = plus.webview.getWebviewById('juminqianyue');
  110. var jmda = plus.webview.getWebviewById('jumindangan');
  111. if(jmda){jmda.close('none')}
  112. if(jmqy){jmqy.close('none')}
  113. if(dljd){dljd.close('none')}
  114. if(xxcj){xxcj.close('none')}
  115. if(zzjd){zzjd.close('none')}
  116. setTimeout(function(){
  117. xxqr.close('none')
  118. },300)
  119. }
  120. }else{
  121. mui.toast('提交失败')
  122. }
  123. },'post')
  124. }else{
  125. plus.nativeUI.closeWaiting();
  126. if(res.msg){
  127. mui.toast(res.msg)
  128. }else{
  129. mui.toast('填写信息格式不对')
  130. }
  131. }
  132. },'get')
  133. })
  134. }
  135. })
  136. template.helper('setNull',function(o){
  137. if(o==''){
  138. return '无'
  139. }else{
  140. return o
  141. }
  142. })
  143. template.helper('setDataGroup',function(o,a){
  144. if(a[0]==''){
  145. var name = o.split(',')
  146. var time = a[1].split(',')
  147. var html="";
  148. $.map(name,function(item,i){
  149. if(time[i] != '0'){
  150. html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
  151. }else{
  152. html += '<div>'+item+'</div>'
  153. }
  154. })
  155. return html
  156. }else if(o==''){
  157. return a[0]
  158. }else{
  159. var name = o.split(',')
  160. var time = a[1].split(',')
  161. var html='';
  162. $.map(name,function(item,i){
  163. if(time[i] != '0'){
  164. html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
  165. }else{
  166. html += '<div>'+item+'</div>'
  167. }
  168. })
  169. return html+'<div>'+a[0]+'</div>'
  170. }
  171. })
  172. template.helper('setDrug',function(o,p){
  173. if(p==''){
  174. return o
  175. }else if(o==''){
  176. return p
  177. }else{
  178. return o+','+p
  179. }
  180. })