123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868 |
- var idCardReg = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
- var mobileReg = /^[1][3578][0-9]{9}$/;
- var doctorCode,name, idCard, ssc, mobile, emerMobile, key, encyIdCard;
- var //groupCode = [],
- //groupName = [],
- healthManagementCode=[],
- healthManagementName=[],
- diseaseCode=[],
- diseaseName=[];
- var /**currGroupCode,**/currHealthManagement,currHealthManagementName;
- var self;
- var encryURL = "login/public_key";
- var docInfo =null;
- var userAgent
- var docType
- mui.plusReady(function() {
-
- userAgent = JSON.parse(plus.storage.getItem("userAgent"));//登录的意思信息
- docType = JSON.parse(plus.storage.getItem("docType"));//登录的医生类别
- $("#doctor_zk").hide();
- docInfo= plus.storage.getItem("docInfo");
- docInfo = JSON.parse(docInfo);
- self = plus.webview.currentWebview();
- RSAUtils.getKeyFromServer(encryURL, function(res) {
- if(res.status == 200) {
- var mod = res.data.modulus;
- var exp = res.data.exponent;
- key = RSAUtils.getKeyPair(exp, "", mod);
- }
- });
- if(docType==2)//全科医生登录不显示 选择全科医生选项
- {
- $("#dortor_qke").hide()
- }else if(docType==3){//健康医生登录的时候 健康医生那个地方不能让选
- $("#healthManagement .no").show();
- }
- var hospital = plus.storage.getItem("hospital");
- //console.log(hospital);
- //健康管理师查询
- var healthManagementUrl//查询接口
- var params//参数
- if(docType==2){
- healthManagementUrl = "/doctor/doctor_combobox";
- params={type:3,hospital:hospital}
- }else{
- healthManagementUrl = "/doctor/findDoctorByLevelAndHospital";
- params={hospital:hospital,level:docType}
- }
-
- sendPost(healthManagementUrl, params, function(){
- mui.toast("健康管理师查询失败!");
- }, function(res) {
-
- if(res.status == 200) {
- if(docType==1){//专科
- }else if(docType==3){//健康管理师
- currHealthManagement=docInfo.code
- currHealthManagementName=docInfo.name
- $('#healthManagement input[data-val=healthManagement]').val(currHealthManagementName).attr("data-code",currHealthManagement);
-
- var healthManagementList = res.doctors;
- for(var i = 0; i < healthManagementList.length; i++) {
- healthManagementCode[i] = healthManagementList[i].code;
- healthManagementName[i] = healthManagementList[i].name;
- }
-
- }else{//全科
- //console.log(JSON.stringify(res))
- var healthManagementList = res.list;
-
- for(var i = 0; i < healthManagementList.length; i++) {
- healthManagementCode[i] = healthManagementList[i].code;
- healthManagementName[i] = healthManagementList[i].name;
- }
- }
-
- activHealthM();
- };
- });
-
- var imgArea = document.querySelector(".add-img");
- //添加附件
- document.querySelector(".add").addEventListener("tap", function() {
- showActionSheet(imgArea, this);
- });
- //提交
- document.getElementById("upload").addEventListener("tap", function() {
-
- plus.nativeUI.showWaiting();
- name = $("#name").find("input").val().trim();
-
- if(docType!=3 && $('#dortor_qke input[data-val=dortor_qke]').val().length == 0) {
- mui.toast("请选择全科医生");
- plus.nativeUI.closeWaiting();
- return;
- }
- if(name.length == 0) {
- mui.toast("请填写居民姓名");
- plus.nativeUI.closeWaiting();
- return;
- }
- //if($("#li_group input").attr("data-code")=="0") {
- //shenzaixin 20160829 取消验证
- //mui.toast("请选择居民分组");
- //plus.nativeUI.closeWaiting();
- //return
- //}
- // if($("#li_expenses").attr("data-code")=="0") {
- // mui.toast("请选择政府补贴费");
- // plus.nativeUI.closeWaiting();
- // return
- // }
-
- var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
- idCard = $("#idcard").find("input").val().trim();
- if(!idCardReg.test(idCard)) {
- $("#idcard input").css("color","red")
- mui.toast("请填写有效身份证号");
- plus.nativeUI.closeWaiting();
-
- return;
-
- }else{
- $("#idcard input").css("color","")
- }
- encyIdCard = RSAUtils.encryStr(key, idCard);
- mobile = $("#mobile").find("input").val().trim();
- if(!mobileReg.test(mobile)) {
- $("#mobile input").css("color","red")
- mui.toast("请填写有效的手机号码");
- plus.nativeUI.closeWaiting();
- return;
- }else{
- $("#mobile input").css("color","")
- }
- if(!currHealthManagement){
- mui.toast("请选择健康管理师!");
- plus.nativeUI.closeWaiting();
- return;
- }
- var patrn = /^[a-zA-Z0-9]+$/;
- ssc = $("#ssc").find("input").val().trim();
- if(ssc) {
- if(!patrn.test(ssc)) {
- mui.toast("请填写有效的医保卡卡号");
- plus.nativeUI.closeWaiting();
- return;
- }
- } else {
- ssc = "";
- mui.toast("医保卡号不能为空!");
- plus.nativeUI.closeWaiting();
- return;
- }
- emerMobile = $("#emerMoblie").find("input").val().trim();
- if(emerMobile) {
- if(emerMobile.length != 11) {
- mui.toast("请填写有效的应急人联系方式");
- plus.nativeUI.closeWaiting();
- return;
- }
- } else {
- emerMobile = "";
- }
- if(!$(".input-group-pack").hasClass("checked")) {
- mui.toast("您还未接受签约协议");
- plus.nativeUI.closeWaiting();
- return;
- }
- var uploadImgUrl = getCompressImg();
- if(uploadImgUrl) {
- setTimeout(function() {
- uploadImg(uploadImgUrl, handleUploadSucc);
- }, 1000)
- } else {
- sendData("");
- }
- });
- //设置政府补贴
- setExpenses();
-
- qke(userAgent,docType)
-
- //选择分组
- $("body").on("click","#li_group",function(){
- mui.openWindow({
- url:"../../qygl/html/xiaoxichuli_fzgl.html",
- id:"xiaoxichuli_fzgl.html"
- })
- })
-
- //图片识别点击事件
- // mui("body").on("tap",".tit1 a",function(){
- // page.imgUp();
- // })
-
- });
-
- // //图片识别
- // var page=null;
- // page={
- // imgUp:function(){
- // var m=this;
- // plus.nativeUI.actionSheet({cancel:"取消",buttons:[
- // {title:"拍照"},
- // {title:"从相册中选择"}
- // ]}, function(e){//1 是拍照 2 从相册中选择
- // switch(e.index){
- // case 1:clickCamera();break;
- // case 2:clickGallery();break;
- // }
- // });
- // }
- // //摄像头
- // }
- // //图片上传
- // function clickGallery() {
- // var server = "http://192.168.131.144:3000/";//在鑫
- // plus.gallery.pick(function(path) {
- // plus.zip.compressImage({
- // src: path,
- // dst: "_doc/chat/gallery/" + path,
- // quality: 20,
- // overwrite: true
- // }, function(e) {
- // var task = plus.uploader.createUpload(server + "/ocr", {
- // method: "post"
- // }, function(t, sta) {
- // //console.log(JSON.stringify(t))
- // if(sta == 200) {
- // var msg = t.responseText;
- // var oImg = JSON.parse(msg);
- // var imgUrl = oImg.urls;
- // var re = new RegExp("\\\\", "g");
- // imgUrl = imgUrl.replace(re, "/");
- // uploadMsg(2, imgUrl);
- // }
- // });
- // task.addFile(e.target, {});
- // task.start();
- // }, function(err) {
- // console.error("压缩失败:" + err.message);
- // });
- //
- // }, function(err) {});
- // };
- //
- //
- // // 拍照
- //
- // function clickCamera() {
- // var server = "http://192.168.131.144:3000/";//在鑫
- // var cmr = plus.camera.getCamera();
- // var res = cmr.supportedImageResolutions[0];
- // var fmt = cmr.supportedImageFormats[0];
- // cmr.captureImage(function(path) {
- //
- // //plus.io.resolveLocalFileSystemURL(path, function(entry) {
- // plus.io.resolveLocalFileSystemURL(path, function(entry) {
- //
- // var localUrl = entry.toLocalURL();
- // plus.zip.compressImage({
- // src: localUrl,
- // dst: "_doc/chat/camera/" + localUrl,
- // quality: 20,
- // overwrite: true
- // }, function(e) {
- //
- // var task = plus.uploader.createUpload(server + "/ocr", {
- // method: "post"
- // }, function(t, sta) {
- //
- // if(sta == 200) {
- // var msg = t.responseText;
- // var oImg = JSON.parse(msg);
- // var imgUrl = oImg.urls;
- // var re = new RegExp("\\\\", "g");
- // imgUrl = imgUrl.replace(re, "/");
- // console.log(imgUrl);
- // uploadMsg(2, imgUrl);
- // }
- // });
- // task.addFile(e.target, {});
- // task.start();
- // }, function(err) {
- // console.log("压缩失败: " + err.message);
- // });
- // });
- // }, function(err) {
- // console.error("拍照失败:" + err.message);
- // }, {
- // index: 1
- // });
- // };
- //
- //
- //
-
-
-
-
- //获取全科医生
- function qke(userAgent,docType){
- var qkeCode=[];
- var qkeName=[];
-
- var hospital =userAgent.hospital
- var level =docType
- sendPost("/doctor/findDoctorByLevelAndHospital", {hospital:hospital,level:2}, function(res){
-
- }, function(res) {
-
- if(res.status == 200) {
- //
- // qkeCode.push("0");
- // qkeName.push("无");
- var expensesList = res.doctors;
- for(var i = 0; i < expensesList.length; i++) {
- qkeCode.push(expensesList[i].code);
- qkeName.push(expensesList[i].name);
- }
- qkeSelect(qkeCode,qkeName);
- };
- });
- }
- //设置全科医生下拉框
- function qkeSelect(qkeCode,qkeName) {
- $('#dortor_qke input[data-val=dortor_qke]').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: qkeCode,
- values: qkeName
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- var name=dd[0].values
- $(this).val(name);
- currExpenses = dd[0].keys;
- $('#dortor_qke input[data-val=dortor_qke]').attr("data-code",currExpenses);
- }
- });
- };
- //获取政府补贴数据
- function setExpenses(){
- var expensesCode=[];
- var expensesName=[];
-
- sendGet("/common/getDictByDictName?name=SIGN_EXPENSES", null, null, function(res) {
-
- if(res.status == 200) {
- // expensesCode.push("0");
- // expensesName.push("无");
- var expensesList = res.list;
- for(var i = 0; i < expensesList.length; i++) {
- expensesCode.push(expensesList[i].code);
- expensesName.push(expensesList[i].value);
- }
- activExpensesM(expensesCode,expensesName);
- };
- });
- }
-
-
- //设置政府补贴下拉框
- function activExpensesM(expensesCode,expensesName) {
- $('#li_expenses input[data-val=expenses]').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: expensesCode,
- values: expensesName
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- var name=dd[0].values
- $(this).val(name);
- currExpenses = dd[0].keys;
- $('#li_expenses input[data-val=expenses]').attr("data-code",currExpenses);
- }
- });
- };
- //分组选择
- // function activMob() {
- // $('#group input[data-val=group]').mobiscroll({
- // theme: 'ios',
- // lang: 'zh',
- // customWheels: true,
- // wheels: [
- // [{
- // keys: groupCode,
- // values: groupName
- // }]
- // ],
- // onSelect: function(valueText, inst) {
- // var dd = eval("[" + valueText + "]");
- // $(this).val(dd[0].values);
- // currGroupCode = dd[0].keys;
- // }
- // });
- // };
-
- //健康管理师选择
-
- function activHealthM() {
- $('#healthManagement input[data-val=healthManagement]').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: healthManagementCode,
- values: healthManagementName
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- $(this).val(dd[0].values);
- currHealthManagement = dd[0].keys;
- currHealthManagementName = dd[0].values;
- }
- });
- };
- /*
- * 上传成功后 处理方法
- */
- function handleUploadSucc(uploadObj) {
- var resText = uploadObj.responseText;
- var oRes = JSON.parse(resText);
- var imgNames = oRes.images;
- var imgUrls = oRes.urls;
- sendData(imgUrls);
- }
- /*
- * 提交
- */
- var submitUrl = "doctor/family_contract/agent";
- function sendData(imgUrls) {
-
- var majorDoctorName = $("#doctor_zk input").val();
- var majorDoctor = $("#doctor_zk input").attr("data-code");
- var disease = $("#disease input").attr("data-code");
- var diseaseVal = $("#disease input").val();
- var ismb=$(".tag_cyc").hasClass("on");//是否慢病
-
- if(ismb && diseaseVal.length=="0") {
- mui.toast("疾病类型不能为空!");
- plus.nativeUI.closeWaiting();
- return false;
- }
-
- if(docType!=2 && $('#dortor_qke input[data-val=dortor_qke]').attr("data-code")=="0"){
- mui.toast("全科医生为必填!");
- plus.nativeUI.closeWaiting();
- return false;
- }
-
- if(ismb &&(disease==0||disease==1)&&(majorDoctor==null||majorDoctor=="")){
- mui.toast("专科医生不能为空!");
- plus.nativeUI.closeWaiting();
- return false;
- }
-
-
-
-
- var params ={};
- // console.log(docType)
- if(docType==2){
- params={
- doctor:docInfo.code,//全科医生code
- doctorName:docInfo.name,//全科医生名字
- signDoctorCode:docInfo.code,//簽約人code
- signDoctorName:docInfo.name,//簽約人銘
- signDoctorLevel:docType,//簽約人等级
- name: name,
- idcard: encyIdCard,
- ssc: ssc,
- mobile: mobile,
- emerMobile: emerMobile,
- images: imgUrls,
- //group: currGroupCode,
- healthDoctor:currHealthManagement,
- healthDoctorName:currHealthManagementName,
- // majorDoctor:majorDoctor,
- // majorDoctorName:majorDoctorName,
- // disease:disease,
- expenses:$("#li_expenses input").attr("data-code"),
- group:$("#li_group input").attr("data-code")
- };
- }else{
- params={
- doctor:$('#dortor_qke input[data-val=dortor_qke]').attr("data-code"),//全科医生code
- doctorName:$('#dortor_qke input[data-val=dortor_qke]').val(),//全科医生名字
- signDoctorCode:docInfo.code,//簽約人code
- signDoctorName:docInfo.name,//簽約人銘
- signDoctorLevel:docType,//簽約人等级
- name: name,
- idcard: encyIdCard,
- ssc: ssc,
- mobile: mobile,
- emerMobile: emerMobile,
- images: imgUrls,
- //group: currGroupCode,
- healthDoctor:currHealthManagement,
- healthDoctorName:currHealthManagementName,
- // majorDoctor:majorDoctor,
- // majorDoctorName:majorDoctorName,
- // disease:disease,
- expenses:$("#li_expenses input").attr("data-code"),
- group:$("#li_group input").attr("data-code")
- };
- }
-
- if(!ismb){//如果没有选择慢病
- params.disease=0//慢病
- }else{//如果选中了病种
- params.majorDoctor=majorDoctor
- params.majorDoctorName=majorDoctorName
- params.disease=disease//慢病
-
- }
-
- sendPost(submitUrl, params, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("系统异常!");
- }, function(res) {
- plus.nativeUI.closeWaiting();
- if(res.status == 200) {
- mui.confirm("代理签约成功, 是否继续代理签约?", "提示", ['是', '否'], function(e){
- if(e.index==0){
- plus.webview.currentWebview().reload();
- } else{
- mui.fire(self.opener(), 'updatePatiAmount');
- mui.later(function() {
- var hzWv = plus.webview.getWebviewById("huanzhe.html");
- if(hzWv) {
- mui.fire(hzWv, "update");
- }
- var syWv = plus.webview.getWebviewById("home2.html");
- if(syWv) {
- mui.fire(syWv, "refreshPatCount");
- }
- mui.back();
- }, 500);
- }
- })
-
- } else {
- mui.toast(res.msg);
- }
- });
- }
- /*
- * 删除图片
- */
- mui(".add-img").on("tap", ".icon-del", function() {
- var oli = this.parentElement;
- var oul = this.parentElement.parentElement;
- oul.removeChild(oli);
- });
- $(function() {
- //图片缩放( 动态添加了上传的图片后运行一下下面这条这个)
- scaleRefresh(".upload-img-list");
- $('body').on('click', '.input-group-pack', function() {
- // $(this).find(".input-group-pack").toggleClass("checked");
- $(this).toggleClass("checked");
- //$("#upload").parent().toggle();
- });
- });
- function toXieYiShu() {
- mui.openWindow('../../qygl/html/xieyishu.html', 'xieyishu', {})
- }
- //图片缩放,
- function scaleRefresh(dom) {
- ImagesZoom.init({
- "elem": dom,
- "delBack": function(index) {
- $(".pic-count").text($(".pic-count").text() - 1); //删除图片后的回调
- $(dom).find("li").eq(index).remove();
- }
- });
- }
-
- function getSSCNoByIdcard(idcard)
- {
- var checkUrl = "doctor/patient_cardno";
- sendPost(checkUrl,{idcard:idcard},null,function(res){
- //console.log(JSON.stringify(res));
- if(res.status=='200'){
- $("#ssc").find("input").val(res.data);
- if(res.data!="" && res.data!=null)
- {
- $("#ssc").find("input").attr("readonly","readonly");
- }
- else{
- $("#ssc").find("input").removeAttr("readonly");
- }
- } else {
- mui.toast(res.msg);
- }
- });
- }
-
- /* 签约三师 */
- function validIdCard(data) {
- // 该医生(登录者)所在社区(机构)编码
- var hospital = plus.storage.getItem("hospital"),
- // 该医生(登录者)基础信息
- docInfo = plus.storage.getItem("docInfo"),
- // 该医生(登录者)所在社区主编码(截取前8位,后两位是服务站)
- communityCode = hospital.slice(0,8),
- // 三师中全科医生所在社区主编码(截取前8位,后两位是服务站)
- qkCommunityCode = data.hospital.slice(0,8),
- // 该医生(登录者)编码
- doctor = docInfo.code,
- // 三师中全科医生编码
- qkDoctor = data.doctor,
- // 三师中全科医生是否在本社区
- isInCommunity = data.hospital,
- // 全科医生是否是该医生
- isSameDoctor = doctor == qkDoctor
-
- // ①三师中全科医生不在本社区,则弹窗提示“该居民已签约三师,无法继续签约”,点击“我知道了”,关闭弹窗,退出代理签约
-
- }
- $("#idcard input").on("blur", function() {
- $("#disease input").css("pointer-events", "");
- $("#healthManagement input").css("pointer-events","");
- $("#doctor_zk input").css("pointer-events", "");
- // $("#ssc input").removeAttr("readonly");
-
- var $this = $(this);
- var card = $this.val().trim();
- if(!idCardReg.test(card) || !card) {
- $("#idcard input").css("color","red")
- mui.toast("请输入正确的身份证号!");
- $("#ssc input").val("")
- //$this.val("");
-
- return;
- }else{
- $("#idcard input").css("color","")
- }
- var checkUrl = "doctor/family_contract/patient_sanshi_signinfo";
- sendPost(checkUrl,{idCard:card},null,function(res){
- //console.log(JSON.stringify(res));
- if(res.status=='200'){
- var resultData =res.data;
- //是三师签约,团队保持一致
-
- if(resultData.signStatus==1){
- //如果当前登录是健康管理师
- var qkcode="";
- if(docType==2){
- qkcode=docInfo.code;
- }else if(docType==3){
- qkcode=$('#dortor_qke input[data-val=dortor_qke]').attr("data-code");
- }
-
-
- //有三师签约,且全科医生不一致的情况下,不能进行签约
- if(qkcode=="0" || qkcode==""){
- mui.alert("请先选择全科医生,在填写身份证号");
- $("#idcard input").val("")
- $("#ssc input").val("")
- return false;
- }else if(qkcode!=resultData.doctor){
-
- //清空人员身份证
- $('#idcard input').val("").attr("data-code","");
- /*$("#info_list input").val("");
- $("#info_list input").attr("data-code","");*/
- mui.alert("存在三师签约,由于团队不一致无法进行签约!");
- return false;
- }else{
- $("#doctor_zk").show();
- $("#doctor_zk input").val(resultData.majorDoctorName);
- $("#doctor_zk input").attr("data-code",resultData.majorDoctor);
- $("#healthManagement input").val(resultData.healthDoctorName);
- currHealthManagement = resultData.healthDoctor;
- currHealthManagementName = resultData.healthDoctorName;
- $("#healthManagement input").attr("data-code",resultData.healthDoctor);
- $("#disease input").val(resultData.diseaseName);
- $("#disease input").attr("data-code",resultData.disease);
- $("#disease input").css("pointer-events","none");
- $("#healthManagement input").css("pointer-events","none");
- $("#doctor_zk input").css("pointer-events","none");
- }
-
- }else if(resultData.signStatus==2){
- alert(resultData.msg);
- $("#info_list input").val("");
- $("#info_list input").attr("data-code","");
- return false;
- } else {
- activHealthM();
- disease() ;
- }
- }
-
- getSSCNoByIdcard(card);
-
- });
- // plus.nativeUI.showWaiting();
- // idCard = $("#idcard").find("input").val().trim();
- // var checkUrl = "doctor/family_contract/check";
- // sendPost(checkUrl, {
- // idcard: RSAUtils.encryStr(key, idCard)
- // }, null, function(res) {
- // if(res.status == 200) {
- // var text;
- // if(res.data.sign == 1)
- // text = "该居民已签约 " + res.data.hospitalName.trim() + " 的 " + res.data.doctorName.trim() + " 医生。";
- // else if(res.data.sign == 2)
- // text = "不存在该居民!";
- //
- // if(text)
- // dialog({ content: text, ok: function() { $this.val(""); }}).showModal();
- // } else {
- // mui.toast("身份证验证异常!");
- // $this.val("");
- // }
- // plus.nativeUI.closeWaiting();
- // })
- });
- function validMobile(){
- var $this = $(this);
- var mobile = $this.val().trim();
- if($this.attr("id")=='emerMoblieIpt' && mobile=='')
- return;
-
- if(!mobileReg.test(mobile) || !mobile) {
- $("#mobile input").css("color","red")
- mui.toast("请输入正确的手机号!");
- //$this.val("");
- return;
- }else{
- $("#mobile input").css("color","")
- }
- if(!$this.hasClass("ajax"))
- return;
-
- plus.nativeUI.showWaiting();
- var checkUrl = "doctor/family_contract/checkMoblie";
- sendPost(checkUrl, {
- mobile: mobile
- }, null, function(res) {
- if(res.status == 200) {
- if(res.data.islive == "false") {
- dialog({
- content: "该手机号已签约!",
- ok: function() {
- $this.val("");
- }
- }).showModal();
- }
- } else {
- mui.toast("手机号验证异常!");
- $this.val("");
- }
- plus.nativeUI.closeWaiting();
- })
- }
- $("#emerMoblie input").on("blur", validMobile);
- $("#mobile input").on("blur", validMobile);
- $("#doctor_zk input").on("click",function(){
- mui.openWindow('hospital_list.html', 'hospital_list', {
- extras: {
- hosptialType: 1,
- callbackview:"dailiqianyue",
- callbackmethod:"getDoctor"
- }
- });
- })
-
- window.addEventListener('getDoctor', function(event) {
- //console.log(event.detail.name)
- $("#doctor_zk input").val(event.detail.name);
- $("#doctor_zk input").attr("data-code",event.detail.code);
- });
-
-
- var currdiseaseCode;// 病种类型CODE
- //病种
- var diseaseData= {"msg":"查询成功!","list":[{"code":"1","name":"高血压",},{"code":"2","name":"糖尿病",}],"status":200} ;
- // var diseaseData= {"msg":"查询成功!","list":[{"code":"0","name":"无"},{"code":"1","name":"高血压",},{"code":"2","name":"糖尿病",}],"status":200} ;
- var diseaseList = diseaseData.list;
- for(var i = 0; i < diseaseList.length; i++) {
- diseaseCode[i] = diseaseList[i].code;
- diseaseName[i] = diseaseList[i].name;
- }
- disease();//病种类型
- function disease() {
- $('#disease input[data-val=disease]').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: diseaseCode,
- values: diseaseName
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- $(this).val(dd[0].values);
- currdiseaseCode = dd[0].keys;
- $('#disease input[data-val=disease]').attr("data-code",currdiseaseCode);
- // if(currdiseaseCode!=0){//如果选者的是 糖尿病 或者高血压 就显示专科医生
- // $("#doctor_zk").show();
- // }else{
- // $("#doctor_zk").hide();
- // $("#doctor_zk input").val("");
- // $("#doctor_zk input").attr("data-code","");
- // }
- }
- });
- };
- /*分组事件*/
- function group(e) {
- var groupcode=e.detail.code
- var groupName=e.detail.name
- //console.log(groupName)
-
- $('#li_group input[data-val=li_group]').val(groupName).attr("data-code",groupcode)
- }
- window.addEventListener("group", group);
- //切换是否慢病的 按钮
- tag_cyc()
- function tag_cyc(){
- $(".tag_cyc").on("click",function(){
- if($(this).hasClass("on")){
- $(this).removeClass("on");
- $("#doctor_zk").hide();
- $("#disease").hide();
- }else{
- $(this).addClass("on")
- $("#doctor_zk").css("display","-webkit-box")
- $("#disease").css("display","-webkit-box")
- }
- })
-
- }
|