yjk-preview.js 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. var $body = $('.yjk-body');
  2. var d = dialog({contentType:'load', skin:'bk-popup'});
  3. var userAgent = JSON.parse(window.localStorage.getItem(agentName));
  4. var cache1 = window.localStorage.getItem("oneStep"+userAgent.uid);
  5. var cache2 = window.localStorage.getItem("twoStep"+userAgent.uid);
  6. var cache3 = window.localStorage.getItem("threeStep"+userAgent.uid);
  7. var cache4 = window.localStorage.getItem("fourStep"+userAgent.uid);
  8. //定义弹窗
  9. function toast(msg){
  10. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:msg}).show()
  11. }
  12. var oneObj={},twoObj={},threeObj={},fourObj={};
  13. $(function(){
  14. oneObj = cache1?JSON.parse(cache1):'';
  15. twoObj = cache2?JSON.parse(cache2):'';
  16. threeObj = cache3?JSON.parse(cache3):'';
  17. fourObj = cache4?JSON.parse(cache4):'';
  18. var html = template('tpl_list',{oneData:oneObj,twoData:twoObj,threeData:threeObj,fourData:fourObj})
  19. $body.html(html)
  20. bindEvents()
  21. })
  22. function bindEvents(){
  23. $('#ok_submit').on('tap',function(){
  24. var params={
  25. patient:userAgent.uid,
  26. name:oneObj.name,
  27. idcard:oneObj.idcardAll,
  28. ssc:oneObj.ssc,
  29. birthday:oneObj.birthday,
  30. mobile:oneObj.mobile,
  31. lastMenstrualDate:oneObj.lastMenstruation,
  32. allergyHistory:oneObj.allergy,
  33. maritalStatus:oneObj.marital,
  34. residentialAddress:oneObj.address,//现居住址
  35. residentialProvince:"",
  36. residentialCity:"",
  37. residentialTown:"",
  38. permanentAddress:'',//户籍地址
  39. permanentProvince:oneObj.permanentProvince,//户籍地址省份
  40. permanentCity:oneObj.permanentCity,//户籍地址城市
  41. permanentTown:"",//户籍地址区县
  42. marryDate:oneObj.marital?twoObj.weddingDate:"" ,//结婚日期
  43. spouseName:oneObj.marital?twoObj.spouseName:'',//配偶姓名
  44. spouseBirthday:oneObj.marital?twoObj.spouseBirthday:'',//配偶生日
  45. spouseMobile:oneObj.marital?twoObj.spouseMobile:'',//配偶手机
  46. eatFolate:threeObj.folicacidCode,//服用叶酸
  47. eatAcyeterion:threeObj.contrapillsCode,//服避孕药
  48. smoke:threeObj.smokeCode,//吸烟(1是,0否)
  49. drink:threeObj.drinkCode,//饮酒(1是,0否)
  50. eatOtherDrugs:threeObj.otherPills,//其他药物
  51. workUnit:fourObj.work,//工作单位
  52. height:fourObj.height,//身高cm
  53. weight:fourObj.weight,//体重kg
  54. vaginalDeliveryTimes:fourObj.vaginalTimes,//阴道分娩次数
  55. caesareanSectionTimes:fourObj.caesareanTimes,//剖宫产次数
  56. menarcheAge:fourObj.menarche,//初潮(岁)
  57. menstrualPeriod:fourObj.period,//经期(天)
  58. menstrualCycle:fourObj.cycle,//周期(天)
  59. diseaseHistory:fourObj.diseaseHistory,//疾病史
  60. operationHistory:fourObj.operationHistory,//手术史
  61. otherInformation:fourObj.otherInformation//其他
  62. }
  63. d.show();
  64. sendPost("patient/prenatalnspector/addPreCard",{json:JSON.stringify(params)},'json','post', function(res){
  65. d.close();
  66. toast('请求失败')
  67. },function(res){
  68. d.close();
  69. if(res.status == 200){
  70. window.localStorage.removeItem("oneStep"+userAgent.uid)
  71. window.localStorage.removeItem("twoStep"+userAgent.uid)
  72. window.localStorage.removeItem("threeStep"+userAgent.uid)
  73. window.localStorage.removeItem("fourStep"+userAgent.uid)
  74. dialog({
  75. content: '<div><div class="c-f14 c-333 c-t-left mb10">已成功提交,建卡后,请您定期到医院进行产前检查,接受孕期宣教,做好自我监控</div></div>',
  76. okValue: '好的',
  77. cancel: false,
  78. ok: function() {
  79. window.location.href="yunjianjihua.html"
  80. }
  81. }).showModal()
  82. }else{
  83. toast(res.msg)
  84. }
  85. })
  86. })
  87. $('.edit').on('tap',function(){
  88. var $url = $(this).attr('data-url')
  89. window.location.href=$url+'?isContinue=1'
  90. })
  91. }