123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- var d = dialog({
- contentType: 'load',
- skin: 'bk-popup'
- });
- $(function() {
- var pageIndex = 1;
- var pageSize = 100;
- var request = GetRequest();
- var hospitalId = request["hospitalId"];
- var pageInfo;
- getPageInfo();
- bindEvents();
- templateHelper();
-
- function getPageInfo(){
- var url = "/patient/guahao/imm/GetOrgScheduleList",
- params = {
- orgCode: hospitalId
- };
- d.show();
- sendPost(url, params, 'json', 'get', queryFailed, function(res) {
- if(res.status == 200) {
- d.close();
- pageInfo = res.data;
- var html = template("info_tmp", res.data);
- $(".main").empty().append(html);
- } else {
- queryFailed(res);
- }
- });
- }
-
- function getTimeSection(orgId, scheduleId, amorpm){
- var url = "/patient/guahao/imm/GetOrgNumberList",
- params = {
- orgId: orgId,
- ScheduleId: scheduleId,
- amorpm: amorpm
- };
- d.show();
- sendPost(url, params, 'json', 'get', queryFailed, function(res){
- if(res.status == 200){
- d.close();
- var html = template("section-info-tmp", {list: res.data});
- $(".time-section[data-id="+scheduleId+"]").empty().append(html);
- }else{
- queryFailed(res);
- }
- });
- }
- function bindEvents() {
- // $(".c-list").on("click", "li", function(event) {
- // var doctorId = $(this).attr("data-id");
- // var target = $(event.target);
- // if(target.closest(".div-timeList").length == 0) { //跳转到医生简介
- // location.href = "immune-detail.html?type=1&&hospitalId=" + hospitalId;
- // } else { //跳转到门诊预约
- // var id = target.closest("div").eq(0).attr("data-id");
- // location.href = "immune-detail.html?type=2&id=" + id + "&hospitalId=" + hospitalId;
- // }
- // })
- //展开查看
- $(".main").on('click', '.yy-info', function(){
- var $this = $(this),
- $ul = $this.siblings(),
- orgCode = $this.attr("data-org"),
- sid = $this.attr("data-sid"),
- time = $this.attr("data-time");
- if($ul.hasClass("c-hide")){
- $this.find(".fa").removeClass("fa-chevron-circle-down");
- $this.find(".fa").addClass("fa-chevron-circle-up");
- $ul.removeClass("c-hide");
- getTimeSection(orgCode, sid, time);
- }else{
- $this.find(".fa").removeClass("fa-chevron-circle-up");
- $this.find(".fa").addClass("fa-chevron-circle-down");
- $ul.addClass("c-hide");
- }
- });
-
- //选中时间预约
- $(".main").on('click', ".time", function(){
- var $this = $(this),
- time = $this.attr("data-time"),
- startTime = $this.attr("data-start"),
- timeRange = $this.text();
- if($this.hasClass("disabled")){
- return false;
- }
- var orgInfo = {},
- arrangeDate = {
- timeStr: startTime.substr(0, 10)+' '+timeRange,
- time: time,
- startTime: startTime
- };
- if(pageInfo){
- orgInfo = {
- code: pageInfo.ORG_CODE,
- name: pageInfo.ORG_NAME,
- };
- }
- window.localStorage.setItem("orgInfo", JSON.stringify(orgInfo));
- window.localStorage.setItem('arrangeDate', JSON.stringify(arrangeDate));
- // window.location.href = "immune-confirm.html";
- location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+wxurl+"%2fwdyy%2fhtml%2fimmune-confirm.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
- })
- }
-
- function templateHelper(){
- template.helper('getWeek', function(str){
- var weekDay = ["周天", "周一", "周二", "周三", "周四", "周五", "周六"];
- return weekDay[parseInt(str)];
- });
-
- template.helper('formatDate', function(str, formatter){
- //默认时间格式是2017-08-12 08:00:00
- switch(formatter){
- case 'yyyy-MM-dd':
- return str.substring(0, 10);
- break;
- case 'HH:ss':
- return str.substring(11, 16);
- break;
- default:
- return str;
- break;
- }
- });
-
- template.helper('getOrgPhoto', function(url){
- if(url){
- return getImgUrl(url);
- }else{
- return "../../qygl/images/hospital_default.png";
- }
- })
- }
- function queryFailed(res) {
- d.close();
- if(res && res.msg) {
- if((res.msg).indexOf("SOAP") >= 0) {
- dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: "医院接口访问异常,请刷新后重试!", bottom: true }).show();
- return false;
- }
- dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: res.msg, bottom: true }).show();
- } else {
- dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '加载失败', bottom: true }).show();
- }
- }
- });
|