123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>选择您的服务类型</title>
- <meta name="author" content="yihu.com" />
- <meta name="format-detection" content="telephone=no" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <link rel="stylesheet" href="../../../css/cross.css">
- <link rel="stylesheet" href="../../../css/cross.ui.css">
- <link rel="stylesheet" href="../../../css/mui.min.css">
- <link rel="stylesheet" href="../css/updateService.css" type="text/css" />
- </head>
- <body style="background: #f3f3f3;">
- <div class="mt5">
- <ul class="w3-row w3-row-padding mb10 clearfix" id="_service">
- </ul>
- </div>
- <div class="plr15 submitbtn">
- <a onclick="submit()" class="c-btn c-btn-full c-btn-4dcd70 border-radius-pill c-f17 pt10" style="height: 45px;">保 存</a>
- </div>
- <script type="text/html" id="service_tmp">
- {{each list as it}}
- <li class="w3-col s4" data-code="{{it.labelCode}}" data-name="{{it.labelName0}}" >
- <div class="outdiv">
- <div class="labelIcon {{it.labelIcon}}">
- <div class="labelIcon1 {{it.labelIcon}}">
- <div class="pt10 pl10 c-f16 c-333">{{it.labelName0}}</div>
- <div class="pt5 pl10 c-f14 c-909090">{{it.labelName1}}</div>
- </div>
- </div>
- </div>
- </li>
- {{/each}}
- </script>
- <script src="../../../js/jquery/2.1.3/jquery.js"></script>
- <script type="text/javascript" src="../../../js/mui.min.js"></script>
- <script type="text/javascript" src="../../../js/app.js"></script>
- <script type="text/javascript" src="../../../js/weixin_common.js"></script>
- <script type="text/javascript" src="../../../js/underscore.js"></script>
- <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
- <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../../js/security.js" type="text/javascript" charset="utf-8"></script>
- <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css">
- <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js"></script>
- <script>
- var dd = dialog({
- contentType: 'load',
- skin: 'bk-popup',
- content: '保存中...'
- });
- var d = dialog({
- contentType: 'load',
- skin: 'bk-popup'
- });
- var Request = new Object();
- Request = GetRequest();
- var openid = Request["openid"];
- var type = Number(Request["type"]);
- var service = "";
- var doctor = Request["doctor"];
- var userAgent = window.localStorage.getItem(agentName);
- $(function() {
- var paramAgent = $.parseJSON(window.localStorage.getItem("paramAgent", paramAgent))
- checkUserAgent();
- getBaseInfo();
- })
-
- function getBaseInfo(){
- sendPost("/patient/baseinfo", {}, 'JSON', 'post', queryFailed, function(res) {
- service = res.data.label;
- if(!service){service=1}
- getServices();
- })
- }
- function getServices() {
- d.show();
- var url = "/patient/serviceType",
- params = {
-
- };
- sendPost(url, params, 'JSON', 'GET', queryFailed, function(res) {
- d.close();
- if(res.status == 200) {
- var list = _.map(res.list, function(item, index) {
- item.labelIcon = "labelIcon_" + item.labelCode;
- if(item.labelName.indexOf("老年人") > -1) {
- item.labelName0 = "老年人";
- item.labelName1 = "60岁以上";
- } else if(item.labelName.indexOf("儿童") > -1) {
- item.labelName0 = "儿童";
- item.labelName1 = "0-6岁";
- }else if(item.labelName.indexOf("精神疾病") > -1) {
- item.labelName0 = "精神疾病";
- item.labelName1 = "重度";
- } else {
- item.labelName0 = item.labelName;
- item.labelName1 = "";
- }
- return item;
- });
- var html = template("service_tmp", {
- list: list
- });
- $("#_service").empty().append(html);
- bindEvents();
- autodivheight();
- } else {
- queryFailed(res);
- }
- })
- }
- //请求失败处理事件
- function queryFailed(res, message) {
- d.close();
- if(message) {
- dialog({
- contentType: 'tipsbox',
- bottom: true,
- skin: 'bk-popup',
- content: message
- }).show();
- } else {
- if(res && res.msg) {
- dialog({
- contentType: 'tipsbox',
- bottom: true,
- skin: 'bk-popup',
- content: res.msg
- }).show();
- } else {
- dialog({
- contentType: 'tipsbox',
- bottom: true,
- skin: 'bk-popup',
- content: '加载失败'
- }).show();
- }
- }
- }
- function bindEvents() {
- //单个服务点击
- $("#_service").on("tap", "li", function() {
- $("#_service li[data-code='" + service + "']").removeClass("active");
- service = $(this).attr("data-code")
- $(this).addClass("active");
- })
- if(service) {
- $("#_service li[data-code='" + service + "']").addClass("active");
- }
- }
- function submit() {
- dd.showModal();
- var _active = $("#_service li.active");
- var params = {
- patient: JSON.parse(window.localStorage.getItem(agentName)).represented || JSON.parse(window.localStorage.getItem(agentName)).uid,
- name: window.localStorage.getItem("firstName"),
- label: _active.attr("data-code"),
- labelName: _active.attr("data-name"),
- };
- sendPost('patient/saveServiceType', params, 'json', 'post', operateFailed, operateSuccesss);
- }
- //失败
- function operateFailed(res) {
- dd.close();
- if(res && res.msg) {
- dialog({
- contentType: 'tipsbox',
- bottom: true,
- skin: 'bk-popup',
- content: res.msg
- }).show();
- } else {
- dialog({
- contentType: 'tipsbox',
- bottom: true,
- skin: 'bk-popup',
- content: '保存失败'
- }).show();
- }
- }
- //成功调用登录接口
- function operateSuccesss(res) {
- if(res.status == 200) {
- dd.close();
- dialog({
- content: '保存成功',
- okValue: '确定',
- ok: function() {
- if(type == 4) {
- window.location.href = "my-detail.html?type=" + type + "&openid=" + openid;
- } else {
- if(doctor) {
- checkDocInWork(doctor)
- }
- }
- }
- }).showModal();
- } else {
- //非200则为失败
- operateFailed(res);
- }
- }
- //获取签约医生的工作时间
- function checkDocInWork(doctor) {
- var url = 'patient/consult/isDoctorWorkWhenconsult',
- params = {
- doctor: doctor
- };
- sendPost(url, params, 'json', 'post', queryFailed, function(res) {
- $("#isFocus").removeClass("disabled");
- if(res.status == 200) {
- d.close();
- // data:0-医生不接受咨询/1-医生当前接受咨询/2-全科医生和健管师当前都不在工作时间/3-全科医生当前不在工作时间/4-健管师当前不在工作时间 健管师当前不在工作时间
- if(!(res.data == "1")) {
- dialog({
- content: '您好,由于您关注的医生工作繁忙,设置了每日回复咨询的时间段,所以,在该时间段外的时间,您的咨询将不会马上获得医生的回复。',
- okValue: '查看医生工作时间',
- ok: function() {
- window.location.href = "../../yszx/html/doctor-work-hours.html?doctor=" + doctor;
- },
- cancelValue: '继续新增咨询',
- cancel: function() {
- window.location.href = "../../yszx/html/add-consult.html?doctorCode=" + doctor;
- }
- }).showModal();
- } else {
- //跳转到新增咨询页面
- window.location.href = "../../yszx/html/add-consult.html?doctorCode=" + doctor;
- }
- } else {
- queryFailed(res);
- }
- });
- }
- function autodivheight() { //函数:获取尺寸
- //获取浏览器窗口高度
- var divWidth = $("#_service li").width();
- $("#_service li").each(function() {
- $(this).find(".outdiv").css('height', divWidth *1.28 + 'px');
- })
- }
- window.onresize = autodivheight; //浏览器窗口发生变化时同时变化DIV高度
-
- </script>
- </body>
- </html>
|