123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var d1 = dialog({contentType:'load', skin:'bk-popup', content:'提交中...'});
- var pagetype = 7;
- var doctor = "";
- $(function (){
- checkUserAgent();
- })
- //判断是否有家庭签约信息
- function queryInit() {
- d.show();
- sendPost('patient/family_contract/checkOpenid', {}, 'json', 'post', queryFailed, openidSuccess2);
- }
- function queryFailed(res) {
- d.close();
- if (res && res.msg) {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg}).show();
- } else {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'加载失败'}).show();
- }
- }
- //成功
- function openidSuccess2(res) {
- if (res.status == 200) {
- if(res.data == null || res.data == ""){
- $("#div-area").show();
- checkTeacter();
- }
- else{
- $("#div-doctorPage").show();
- doctor = res.data;
- queryDoctor();
- }
- } else {
- queryFailed(res);
- }
- }
- function closeWindow(){
- var Request = new Object();
- Request = GetRequest();
- var code = Request["code"];
- //从后台那边获取签名等信息
- var params = {};
- params.pageUrl = server + "wx/html/ssgg/html/choose-region.html?code=" + code + "&state=STATE";
- $.ajax(server + "weixin/getSign", {
- data: params,
- dataType: "json",
- type: "post",
- success: function(res){
- if (res.status == 200) {
- var t = res.data.timestamp;
- var noncestr = res.data.noncestr;
- var signature = res.data.signature;
- wx.config({
- //debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: appId, // 必填,公众号的唯一标识
- timestamp: t, // 必填,生成签名的时间戳
- nonceStr: noncestr, // 必填,生成签名的随机串
- signature: signature,// 必填,签名,见附录1
- jsApiList: [
- 'closeWindow'
- ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
- });
- }
- }
- });
- wx.ready(function(){
- wx.closeWindow();
- });
- }
- //判断是否有三师信息
- function checkTeacter(){
- var data = {};
- sendPost('patient/teachers', data, 'json', 'post', queryFailed, querySuccess);
- }
- function querySuccess(res) {
- if (res.status == 200) {
- d.close();
- var list = res.data.list;
- if(list.length > 0){
- var doctor = "";
- var doctorName = "";
- for(var i=0; i<list.length; i++){
- var data = list[i];
- if(Number(data.type) == 2){
- doctor = data.code;
- doctorName = data.name;
- }
- }
- dialog({
- title:'提示',
- content:'您已存在三师签约,签约医生为' + doctorName + '医生,继续与' + doctorName + '医生签约家庭医生服务吗?',
- ok: function (){
- window.location.href = "doctor-home-page.html?doctor=" + doctor+"&isQr=false";
- }
- }).showModal();
- }
- } else if(res.status == 1 || res.status == 2){
- d.close();
- }
- else{
- queryFailed(res);
- }
- }
- function changeValue(name, code){
- window.location.href='hospital-list.html?areaName=' + encodeURI(name) + '&areaCode=' + code;
- }
- //获取家庭签约的医生信息
- function queryDoctor(){
- var data={};
- data.doctor = doctor;
- sendPost('patient/family_contract/homepage', data, 'json', 'post', queryFailed, querySuccess3);
- }
- function querySuccess3(res) {
- if (res.status == 200) {
- var name = res.data.name;
- var jobName = res.data.job;
- var hospitalName = res.data.hospital;
- var deptName = res.data.dept;
- var photo = getImgUrl(res.data.photo);
- var expertise = res.data.expertise;
- var introduce = res.data.intro;
- var sign = Number(res.data.sign);
- var group = Number(res.data.group);
- var url2 = "../../../images/d-default.png";
- if(photo != null && photo != ""){
- url2 = photo;
- }
- if(!jobName) jobName = "";
- if(!deptName) deptName = "";
- if(!expertise) expertise = "无";
- if(!introduce) introduce = "无";
- document.getElementById("photo").src = url2;
- document.getElementById("name").innerHTML = name;
- document.getElementById("jobName").innerHTML = jobName;
- document.getElementById("hospitalName").innerHTML = hospitalName;
- document.getElementById("deptName").innerHTML = deptName;
- document.getElementById("expertise").innerHTML = expertise;
- document.getElementById("introduce").innerHTML = introduce;
-
- if(group == 1){
- $("#ul-health").show();
- }else if(group == 2){
- $("#ul-disease").show();
- }else if(group == 3){
- $("#ul-sixfive").show();
- }else{
- $("#ul-common").show();
- }
-
- if(sign == 0){
- document.getElementById("btnSign").innerHTML ='<a onclick="cancelSign()" class="c-btn c-btn-E0A526 c-btn-full c-btn-radius c-f18">取消申请</a>';
- }
- else if(sign == 1){
- document.getElementById("btnSign").innerHTML ='<a onclick="overSign()" class="c-btn c-btn-E0A526 c-btn-full c-btn-radius c-f18">申请解约</a>';
- }
- else if(sign == -1){
- document.getElementById("btnSign").innerHTML ='<a onclick="startSign()" class="c-btn c-btn-4dcd70 c-btn-full c-btn-radius c-f18">申请签约</a>';
- $("#divAgree").hide();
- }
- else if(sign == 2){
- document.getElementById("btnSign").innerHTML = '<span class="c-f18" style="color: #E71F19;">您已申请了解约,流程审核中,请等待!!</span>';
- }
- else{
- document.getElementById("btnSign").innerHTML = '<span class="c-f18" style="color: #E71F19;">医生申请与您解约,流程审核中,请等待!!</span>';
- }
- d.close();
- }
- else{
- queryFailed(res);
- }
- }
- //申请签约
- function startSign(){
- var doctorName = encodeURI(document.getElementById("name").innerHTML);
- var hospitalName = encodeURI(document.getElementById("hospitalName").innerHTML);
- window.location.href = "sign-agreement.html?doctor=" + doctor + "&doctorName=" + doctorName + "&hospitalName=" + hospitalName;
- }
- function changeAgreement(){
- window.location.href = "sign-agreement1.html";
- }
- function cancelSign(){
- dialog({
- title: '提示',
- content: '您确定继续取消和' + document.getElementById("name").innerHTML + '医生的签约吗?',
- ok: function (){
- d1.showModal();
- var data = {};
- data.doctor = doctor;
- sendPost('patient/family_contract/unsign', data, 'json', 'post', submitFailed, submitSuccess);
- },
- cancel: function () {
- return;
- }
- }).showModal();
- }
- function overSign(){
- $("#txtInfo").hide();
- dialog({
- title: '申请解约',
- skin:"ui-dialog ax-popup pror",
- content:$("#xf-artd").get(0),
- ok: function (){
- var data = {};
- data.doctor = doctor;
- data.doctorName = document.getElementById("name").innerHTML;
- data.reason = $("#textReason").val();
- if(data.reason == "" || data.reason == null){
- $("#txtInfo").show();
- return false;
- }
- else{
- $("#txtInfo").hide();
- d1.showModal();
- sendPost('patient/family_contract/surrender', data, 'json', 'post', submitFailed, submitSuccess2);
- return;
- }
- },
- cancel: function () {
- return;
- }
- }).showModal();
- }
- function submitFailed(res) {
- d1.close();
- if (res && res.msg) {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg}).show();
- } else {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'操作失败'}).show();
- }
- }
- function submitSuccess(res) {
- if (res.status == 200) {
- d1.close();
- $("#div-area").hide();
- $("#div-doctorPage").hide();
- queryInit();
- } else{
- submitFailed(res);
- }
- }
- function submitSuccess2(res) {
- if (res.status == 200) {
- document.getElementById("btnSign").innerHTML = '<span class="c-f18" style="color: #E71F19;">您已申请了解约,流程审核中,请等待!!</span>';
- d1.close();
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'解约申请成功'}).show();
- window.scrollTo(0,0);
- } else{
- submitFailed(res);
- }
- }
|