123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- var signData,//签约信息
- firstData,
- secondData;
- var d = dialog({contentType:'load', skin:'bk-popup'});
- function toast(msg){
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:msg}).show()
- }
- //请求失败
- function queryFailed(){ d.close();toast('请求失败');}
- $(function(){
- if(! window.localStorage.getItem("jiandangCase1")){
- dialog({
- content: '签约申请已经提交,请耐心等待',
- okValue:'我知道了',
- ok: function() {
- wx.closeWindow();
- }
- }).showModal();
- }else{
- signData = JSON.parse(window.localStorage.getItem('is_signData'));
- firstData = JSON.parse(window.localStorage.getItem("jiandangCase1"));
- var case2 = window.localStorage.getItem("jiandangCase2")
- secondData = case2?JSON.parse(case2):'';
- var html = template('list_tmp',{fData:firstData,sData:secondData})
- $(".c-main").html(html)
- bindEvent()
- function bindEvent(){
- $('.edit').on('tap',function(){
- d.show()
- var $id = $(this).attr('data-id');
- if($id == 1){
- window.location.href = "zizhujiandang.html";
- }
- if($id == 2){
- window.location.href = "xinxicaiji.html";
- }
- })
- $('.jm-btn').on('tap',function(){
- var params = {
- doctorCode:signData.doctor,
- patient:signData.patient,
- idcard:firstData.idcard,
- ssc:firstData.ssc,
- sex:firstData.sex,
- name:firstData.name,
- mobile:firstData.mobile,
- jwCountryCode:firstData.countryCode,
- nation:firstData.national,
- blood:firstData.Blood_type,
- marry:firstData.marry,
- origo:firstData.addressCode,
- origoStr:firstData.address,
- adress:firstData.Present_Address,
- brithday:firstData.Birthday,
- education:secondData.education,//教育水平
- occupation:secondData.occupation,//职业
- payment:secondData.payment, //支付方式
- drugAllergys:secondData.drugAllergys,//药物过敏历史
- drugOtherContent:secondData.drugOtherContent, //药物过敏其他内容
- pastHistorys:secondData.pastHistorys,//既往史
- pastHistoryDate:secondData.pastHistoryDate, //时间
- pastHistoryContent:secondData.pastHistoryContent, //既往史其他内容
- geneticFlag:secondData.geneticFlag,//有无遗传病历史0无,1有
- geneticContent:secondData.geneticContent,//遗传病历史内容
- disabilitys:secondData.disabilitys, //残疾
- familyHistoryFlag:secondData.familyHistoryFlag,//有无
- familyFatherHistorys:secondData.familyFatherHistorys,//父亲的疾病
- familyMotherHistorys:secondData.familyMotherHistorys, //母亲的疾病
- familyBrotherHistorys:secondData.familyBrotherHistorys, //兄弟的疾病
- familyChildrenHistorys:secondData.familyChildrenHistorys, //子女的疾病
- }
- d.show()
- sendPost('patient/createProfileDetail', {archiveJson:JSON.stringify(params)}, 'json', 'post',function(){
- d.close()
- toast('请求失败');
- },function(res){
- if (res.status==200) {
- window.localStorage.removeItem("jiandangCase1")
- window.localStorage.removeItem("jiandangCase2")
- if(signData) {
- var data = {
- doctor: signData.doctor || "",
- patient: signData.patient,
- countryCode:signData.countryCode
- }
- sendPost("patient/family_contract/sign", data, "json", "post", queryFailed,function(res){
- if(res.status == 200){
- d.close()
- window.localStorage.removeItem("is_signData");
- if(signData.signInvitationCode && signData.signInvitationCode!="undefined") {
- dialog({
- content: '签约申请已提交,请耐心等待,<br/>医生通过后即可为您的家人提供家庭医生服务',
- okValue:'我知道了',
- ok: function() {
- wx.closeWindow();
- }
- }).showModal();
- }else{
- window.location.href = "../../ssgg/html/doctor-homepage-new.html?waitSign=1&state="+signData.doctor;
- }
- }else{
- toast('签约失败')
- }
- })
- } else {
- toast('无法提交签约申请,请重新签约')
- setTimeout(function() {
- window.location.href = '../../qygl/html/signing_management.html'
- }, 1000);
- }
- }else{
- d.close()
- if(res.msg){
- toast(res.msg)
- }else{
- toast('提交失败')
- setTimeout(function() {
- window.location.href = '../../qygl/html/signing_management.html';
- }, 1000);
- }
- }
- })
- })
- }
- }
- })
- template.helper('setNull',function(o){
- if(o==''){
- return '无'
- }else{
- return o
- }
- })
- template.helper('setDataGroup',function(o,a){
- if(a[0]==''){
- var name = o.split(',')
- var time = a[1].split(',')
- var html="";
- $.map(name,function(item,i){
- if(time[i] != '0'){
- html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
- }else{
- html += '<div>'+item+'</div>'
- }
- })
- return html
- }else if(o==''){
- return a[0]
- }else{
- var name = o.split(',')
- var time = a[1].split(',')
- var html='';
- $.map(name,function(item,i){
- if(time[i] != '0'){
- html += '<div>'+item+'(确诊时间:'+time[i]+')</div>'
- }else{
- html += '<div>'+item+'</div>'
- }
- })
- return html+'<div>'+a[0]+'</div>'
- }
- })
- template.helper('setDrug',function(o,p){
- if(p==''){
- return o
- }else if(o==''){
- return p
- }else{
- return o+','+p
- }
- })
|