xinxiqueren.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. }
  86. sendPost("patient/family_contract/sign", data, "json", "post", queryFailed,function(res){
  87. if(res.status == 200){
  88. d.close()
  89. window.localStorage.removeItem("is_signData");
  90. if(signData.signInvitationCode && signData.signInvitationCode!="undefined") {
  91. dialog({
  92. content: '签约申请已提交,请耐心等待,<br/>医生通过后即可为您的家人提供家庭医生服务',
  93. okValue:'我知道了',
  94. ok: function() {
  95. wx.closeWindow();
  96. }
  97. }).showModal();
  98. }else{
  99. window.location.href = "../../ssgg/html/doctor-homepage-new.html?waitSign=1&state="+signData.doctor;
  100. }
  101. }else{
  102. toast('签约失败')
  103. }
  104. })
  105. } else {
  106. toast('无法提交签约申请,请重新签约')
  107. setTimeout(function() {
  108. window.location.href = '../../qygl/html/signing_management.html'
  109. }, 1000);
  110. }
  111. }else{
  112. d.close()
  113. if(res.msg){
  114. toast(res.msg)
  115. }else{
  116. toast('提交失败')
  117. setTimeout(function() {
  118. window.location.href = '../../qygl/html/signing_management.html';
  119. }, 1000);
  120. }
  121. }
  122. })
  123. })
  124. }
  125. }
  126. })
  127. template.helper('setNull',function(o){
  128. if(o==''){
  129. return '无'
  130. }else{
  131. return o
  132. }
  133. })
  134. template.helper('setDataGroup',function(o,a){
  135. if(a[0]==''){
  136. var name = o.split(',')
  137. var time = a[1].split(',')
  138. var html="";
  139. $.map(name,function(item,i){
  140. if(time[i] != '0'){
  141. html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
  142. }else{
  143. html += '<div>'+item+'</div>'
  144. }
  145. })
  146. return html
  147. }else if(o==''){
  148. return a[0]
  149. }else{
  150. var name = o.split(',')
  151. var time = a[1].split(',')
  152. var html='';
  153. $.map(name,function(item,i){
  154. if(time[i] != '0'){
  155. html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
  156. }else{
  157. html += '<div>'+item+'</div>'
  158. }
  159. })
  160. return html+'<div>'+a[0]+'</div>'
  161. }
  162. })
  163. template.helper('setDrug',function(o,p){
  164. if(p==''){
  165. return o
  166. }else if(o==''){
  167. return p
  168. }else{
  169. return o+','+p
  170. }
  171. })