xinxiqueren.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. var signData,//签约信息
  2. firstData,
  3. secondData;
  4. var d = dialog({contentType:'load', skin:'bk-popup'});
  5. function toast(msg){
  6. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:msg}).show()
  7. }
  8. //请求失败
  9. function queryFailed(){ d.close();toast('请求失败');}
  10. $(function(){
  11. if(! window.localStorage.getItem("jiandangCase1")){
  12. dialog({
  13. content: '签约申请已经提交,请耐心等待',
  14. okValue:'我知道了',
  15. ok: function() {
  16. wx.closeWindow();
  17. }
  18. }).showModal();
  19. }else{
  20. signData = JSON.parse(window.localStorage.getItem('is_signData'));
  21. firstData = JSON.parse(window.localStorage.getItem("jiandangCase1"));
  22. var case2 = window.localStorage.getItem("jiandangCase2")
  23. secondData = case2?JSON.parse(case2):'';
  24. var html = template('list_tmp',{fData:firstData,sData:secondData})
  25. $(".c-main").html(html)
  26. bindEvent()
  27. function bindEvent(){
  28. $('.edit').on('tap',function(){
  29. d.show()
  30. var $id = $(this).attr('data-id');
  31. if($id == 1){
  32. window.location.href = "zizhujiandang.html";
  33. }
  34. if($id == 2){
  35. window.location.href = "xinxicaiji.html";
  36. }
  37. })
  38. $('.jm-btn').on('tap',function(){
  39. var params = {
  40. doctorCode:signData.doctor,
  41. patient:signData.patient,
  42. idcard:firstData.idcard,
  43. ssc:firstData.ssc,
  44. sex:firstData.sex,
  45. name:firstData.name,
  46. mobile:firstData.mobile,
  47. jwCountryCode:firstData.countryCode,
  48. nation:firstData.national,
  49. blood:firstData.Blood_type,
  50. marry:firstData.marry,
  51. origo:firstData.addressCode,
  52. origoStr:firstData.address,
  53. adress:firstData.Present_Address,
  54. brithday:firstData.Birthday,
  55. education:secondData.education,//教育水平
  56. occupation:secondData.occupation,//职业
  57. payment:secondData.payment, //支付方式
  58. drugAllergys:secondData.drugAllergys,//药物过敏历史
  59. drugOtherContent:secondData.drugOtherContent, //药物过敏其他内容
  60. pastHistorys:secondData.pastHistorys,//既往史
  61. pastHistoryDate:secondData.pastHistoryDate, //时间
  62. pastHistoryContent:secondData.pastHistoryContent, //既往史其他内容
  63. geneticFlag:secondData.geneticFlag,//有无遗传病历史0无,1有
  64. geneticContent:secondData.geneticContent,//遗传病历史内容
  65. disabilitys:secondData.disabilitys, //残疾
  66. familyHistoryFlag:secondData.familyHistoryFlag,//有无
  67. familyFatherHistorys:secondData.familyFatherHistorys,//父亲的疾病
  68. familyMotherHistorys:secondData.familyMotherHistorys, //母亲的疾病
  69. familyBrotherHistorys:secondData.familyBrotherHistorys, //兄弟的疾病
  70. familyChildrenHistorys:secondData.familyChildrenHistorys, //子女的疾病
  71. }
  72. d.show()
  73. sendPost('patient/createProfileDetail', {archiveJson:JSON.stringify(params)}, 'json', 'post',function(){
  74. d.close()
  75. toast('请求失败');
  76. },function(res){
  77. if (res.status==200) {
  78. window.localStorage.removeItem("jiandangCase1")
  79. window.localStorage.removeItem("jiandangCase2")
  80. if(signData) {
  81. var data = {
  82. doctor: signData.doctor || "",
  83. patient: signData.patient,
  84. countryCode:signData.countryCode,
  85. medicareNumber: signData.medicareNumber
  86. }
  87. sendPost("patient/family_contract/sign", data, "json", "post", queryFailed,function(res){
  88. if(res.status == 200){
  89. d.close()
  90. window.localStorage.removeItem("is_signData");
  91. if(signData.signInvitationCode && signData.signInvitationCode!="undefined") {
  92. dialog({
  93. content: '签约申请已提交,请耐心等待,<br/>医生通过后即可为您的家人提供家庭医生服务',
  94. okValue:'我知道了',
  95. ok: function() {
  96. wx.closeWindow();
  97. }
  98. }).showModal();
  99. }else{
  100. window.location.href = "../../ssgg/html/doctor-homepage-new.html?waitSign=1&state="+signData.doctor;
  101. }
  102. }else{
  103. toast('签约失败')
  104. }
  105. })
  106. } else {
  107. toast('无法提交签约申请,请重新签约')
  108. setTimeout(function() {
  109. window.location.href = '../../qygl/html/signing_management.html'
  110. }, 1000);
  111. }
  112. }else{
  113. d.close()
  114. if(res.msg){
  115. toast(res.msg)
  116. }else{
  117. toast('提交失败')
  118. setTimeout(function() {
  119. window.location.href = '../../qygl/html/signing_management.html';
  120. }, 1000);
  121. }
  122. }
  123. })
  124. })
  125. }
  126. }
  127. })
  128. template.helper('setNull',function(o){
  129. if(o==''){
  130. return '无'
  131. }else{
  132. return o
  133. }
  134. })
  135. template.helper('setDataGroup',function(o,a){
  136. if(a[0]==''){
  137. var name = o.split(',')
  138. var time = a[1].split(',')
  139. var html="";
  140. $.map(name,function(item,i){
  141. if(time[i] != '0'){
  142. html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
  143. }else{
  144. html += '<div>'+item+'</div>'
  145. }
  146. })
  147. return html
  148. }else if(o==''){
  149. return a[0]
  150. }else{
  151. var name = o.split(',')
  152. var time = a[1].split(',')
  153. var html='';
  154. $.map(name,function(item,i){
  155. if(time[i] != '0'){
  156. html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
  157. }else{
  158. html += '<div>'+item+'</div>'
  159. }
  160. })
  161. return html+'<div>'+a[0]+'</div>'
  162. }
  163. })
  164. template.helper('setDrug',function(o,p){
  165. if(p==''){
  166. return o
  167. }else if(o==''){
  168. return p
  169. }else{
  170. return o+','+p
  171. }
  172. })