123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816 |
- // 基本信息(包括userAgent、上个页面传递的数据)
- var baseInfo = null,
- // 基础环境信息(包括当前webview)
- baseEnv = null;
- //记录当前选择的服务类型
- var currService,
- initDiseases; //初始化时,默认的疾病类型
- // 顶部信息提示容器
- var $headerPromptMessage = $('#header_prompt_message'),
- // 疾病类型li容器
- $disease = $("#disease"),
- // 提交按钮
- $upload = $('#upload'),
- // 居民分组
- $groupInput = $("#li_group input"),
- // 疾病类型
- $diseaseInput = $("#disease input"),
- // 全科医生
- $doctorQKInput = $('#dortor_qke input[data-val=dortor_qke]'),
- // 健康管理师
- $doctorJGInput = $('#healthManagement input[data-val=healthManagement]'),
- // 政府补贴费
- $expensesInput = $("#li_expenses input"),
- // 家庭医生签约协议(勾选框)
- $agree = $(".input-group-pack"),
- // 签约团队
- $doctorQytdInput = $('#dortor_qke div[data-val=dortor_qytd]'),
- // 居民标签
- $juminLabels = $('#jumin_labels input[data-val=jumin_labels]'),
- //服务类型
- $juminServices = $("#jumin_services input[data-val=jumin_services]");
-
- var self;
-
- mui.plusReady(function(){
- self = plus.webview.currentWebview();
- })
- // 获取基本信息(包括userAgent、上个页面传递的数据)
- var getBaseInfoPromise = function() {
- var baseInfo = {
- // 登录相关信息
- userAgent: JSON.parse(plus.storage.getItem("userAgent")),
- // 上一个页面传递的表单数据
- accessData: baseEnv.webview.accessData,
- // 上一个页面传递的登录者信息
- docInfo: baseEnv.webview.docInfo
- };
- return getSingedInfoPromise(baseInfo.accessData.unencIdcard).then(function(data) {
- baseInfo.signedData = data;
- return baseInfo;
- });
- },
- // 获取基础环境信息
- getBaseEnv = function () {
- return {
- webview: plus.webview.currentWebview()
- };
- },
- // 打开协议书页面
- toXieYiShu = function() {
- mui.openWindow('../../qygl/html/xieyishu.html', 'xieyishu', {});
- },
- // 获取已签约信息
- getSingedInfoPromise = function(idcard) {
- // TODO 已签约三师示例数据
- // idcard = "360827199404102174";
- return getReqPromise("doctor/family_contract/patient_sanshi_signinfo",{idCard: idcard}).then(function(res) {
- if(res.status == 200) {
- var patientCode,disease="",diseaseName="";
- if(res.data.patient) {
- patientCode = res.data.patient.code;
- }
- if(res.data.diseases!==undefined) {
- initDiseases = res.data.diseases;
- disease = _.pluck(res.data.diseases, 'disease').join(",");
- diseaseName = _.pluck(res.data.diseases, 'diseaseName').join(",");
-
- $juminLabels.val(diseaseName).attr("data-code",JSON.stringify({health: "",disease: disease, custom: "" }));
- }
- return $.extend(res.data,{
- patientCode: patientCode,
- disease: disease,
- diseaseName: diseaseName
- });
-
- }
- return null;
- });
- },
- // 获取全科医生
- qke = function (){
- var userAgent = baseInfo.userAgent,
- hospital =userAgent.hospital;
-
- getReqPromise("/doctor/findDoctorByLevelAndHospital",{hospital:hospital,level:2})
- .then(function(res) {
- if(res.status == 200) {
- var doctors = res.doctors,
- qkeCodes=[],
- qkeNames=[];
- // 萃取数组对象中code、name,返回一个数组
- qkeCodes = _.pluck(doctors, 'code');
- qkeNames = _.pluck(doctors, 'name');
- qkeSelect(qkeCodes,qkeNames);
- }
- }).catch(function(e) {
- console && console.error(e);
- });
- },
- setQKSelectReadonly = function(readonly) {
- if(readonly) {
- // 获取全科医生下拉框mibiscroll实例
- var doctorQKMobiscroll = $doctorQKInput.mobiscroll('getInst');
- doctorQKMobiscroll.settings.readonly = true;
- $doctorQKInput.css('pointer-events','none');
- }
- },
- setQKSelect = function(doctor,doctorName) {
- // 获取全科医生下拉框mibiscroll实例
- var doctorQKMobiscroll = $doctorQKInput.mobiscroll('getInst');
- var valueText = "{keys:'"+doctor+"',values:'"+doctorName+"'}";
- doctorQKMobiscroll.setVal([valueText]);
- $doctorQKInput.val(doctorName);
- $doctorQKInput.attr("data-code",doctor);
- },
- // 设置全科医生下拉框
- qkeSelect = function (qkeCodes,qkeNames) {
-
- var docInfo = baseInfo.docInfo,
- signedData = baseInfo.signedData;
- $doctorQKInput.mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: qkeCodes,
- values: qkeNames
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]"),
- name=dd[0].values,
- currExpenses = dd[0].keys;
-
- $(this).val(name);
- $doctorQKInput.attr("data-code",currExpenses);
- }
- });
-
- // if(docInfo.docType == 2) {
- // setQKSelect(docInfo.code, docInfo.name);
- // }
- //
- if(docInfo.docType == 2) {
- setQKSelect(docInfo.code, docInfo.name);
- }
-
- /*if(checkSignedSanshi(signedData)) { // 已签约三师
- if(checkSanshiComnunity(docInfo,signedData)) { // 三师签约中全科医生在当前医生所在社区
- // if(checkLoginerIsSanshi(data.docInfo,data.signedData)) { // 三师签约中全科医生是当前医生
- // } else { // 三师签约中全科医生不是当前医生
- // }
- // TODO 全科医生选择框设值为签约的全科医生,且不能变更
- setQKSelect(signedData.doctor, signedData.doctorName);
- setQKSelectReadonly(true);
- } else { // 三师签约中全科医生不在当前医生所在社区
- mui.toast("病人已签约三师");
- }
-
- $headerPromptMessage.find('.j-disease').text(signedData.diseases[0].diseaseName);
- $headerPromptMessage.find('.j-doctor').text(signedData.doctorName);
- $headerPromptMessage.show();
- }*/
-
- },
- // 获取健康管理医生列表
- reqDoctorJG = function() {
- // 登录者信息
- var docInfo = baseInfo.docInfo,
- // 登录医生的类别。1:专科医生,2:全科医生,3:健康管理师
- docType = docInfo.docType,
- // 所在机构(社区)
- hospital = docInfo.hospital,
- // 请求路径,根据医生类别不同而不同
- url,
- // 请求参数
- params;
-
- if(docType==2){
- url = "/doctor/doctor_combobox";
- // type: 医生类别
- params={type:3,hospital:hospital}
- }else{
- url = "/doctor/findDoctorByLevelAndHospital";
- // level: 医生类别
- params={hospital:hospital,level:docType}
- }
-
- getReqPromise(url,params).then(function(res) {
- var doctors, healthManagementCodes, healthManagementNames;
- if(res.status == 200) {
- // 如果是健康管理师 取res.doctors,如果是全科医生取res.list
- doctors = (docType==3)? res.doctors: ((docType==2)? res.list: []);
- // 萃取数组对象中code、name,返回一个数组
- healthManagementCodes = _.pluck(doctors, 'code');
- healthManagementNames = _.pluck(doctors, 'name');
- activHealthM(healthManagementCodes, healthManagementNames);
- };
- }).catch(function(e) { console && console.error(e); });
- },
- setJGSelect = function(doctor,doctorName) {
- // 获取健康管理师下拉框mibiscroll实例
- var doctorJGMobiscroll = $doctorJGInput.mobiscroll('getInst');
- var valueText = "{keys:'"+doctor+"',values:'"+doctorName+"'}";
- doctorJGMobiscroll.setVal([valueText]);
- $doctorJGInput.val(doctorName);
- $doctorJGInput.attr("data-code",doctor);
- },
- // 健康管理师下拉框
- activHealthM = function activHealthM(codes,names) {
- var docInfo = baseInfo.docInfo,
- signedData = baseInfo.signedData;
- $doctorJGInput.mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: codes,
- values: names
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- $(this).val(dd[0].values);
- $(this).attr('data-code',dd[0].keys);
- }
- });
- // 健康管理师登录,下拉框默认为其本人
- if(docInfo.docType==3) {
- setJGSelect(docInfo.code, docInfo.name);
- }
- },
- setExpensesSelect = function(key,name) {
- // 获取政府补贴下拉框mibiscroll实例
- var expensesMobiscroll = $expensesInput.mobiscroll('getInst');
- var valueText = "{keys:'"+key+"',values:'"+name+"'}";
- expensesMobiscroll.setVal([valueText]);
- $expensesInput.val(name);
- $expensesInput.attr("data-code",key);
- },
- // 获取政府补贴数据
- setExpenses = function (){
- var expensesCodes=[],expensesNames=[];
-
- getReqPromise("/common/getDictByDictName?name=SIGN_EXPENSES",null, "GET")
- .then(function(res) {
- if(res.status == 200) {
- var expensesList = res.list;
- // 萃取数组对象中code、value属性值,返回一个数组
- expensesCodes = _.pluck(expensesList, 'code');
- expensesNames = _.pluck(expensesList, 'value');
- activExpensesM(expensesCodes,expensesNames);
- };
- }).catch(function(e) {
- console && console.error(e);
- });
- },
- // 设置政府补贴下拉框
- activExpensesM = function (expensesCodes,expensesNames) {
- $expensesInput.mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: [expensesCodes[1],expensesCodes[0],expensesCodes[3],expensesCodes[2]],
- values: [expensesNames[1],expensesNames[0],expensesNames[3],expensesNames[2]]
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]"),
- name=dd[0].values,
- currExpenses = dd[0].keys;
-
- $(this).val(name);
- $expensesInput.attr("data-code",currExpenses);
- }
- });
- setExpensesSelect(expensesCodes[0],expensesNames[0]);
- },
- // 疾病类型初始化设值
- initDiseaseTypes = function() {
- var signedData = baseInfo.signedData,
- diseases = signedData.diseases,
- values = "",
- names = "";
- if(diseases) {
- values = _.pluck(diseases, 'disease').join(',');
- names = _.pluck(diseases, 'diseaseName').join(',');
- }
- $diseaseInput.attr('data-code',values)
- $diseaseInput.val(names);
- },
- //普通 老年 高血 糖尿 孕妇 儿童 贫困 计生 重性 残疾 结核
- filterSer = function(name){
- var $li = $('.dw-bf').find('div.dw-li');
- $li.addClass('dw-v');
- var nameArr = name.split(',');
- $.map(nameArr,function(item,index){
- if(item.trim() == '普通人群'){
- var arr = [2,3,6,7,8,9,10]
- $.map(arr,function(it,index){
- $li.eq(it).removeClass('dw-v')
- })
- }
- if(item.trim() == '老年人'){
- var arr = [4,5]
- $.map(arr,function(it,index){
- $li.eq(it).removeClass('dw-v')
- })
- }
- if(item.trim() == '高血压' ||item.trim() == '糖尿病'||item.trim() == '贫困人口'||item.trim() == '计生特殊人群'||item.trim() == '重性精神疾病'||item.trim() == '残疾人'||item.trim() == '结核病' ){
- var arr = [0]
- $.map(arr,function(it,index){
- $li.eq(it).removeClass('dw-v')
- })
- }
- if(item.trim() == '0-6岁儿童'){
- var arr = [1,4]
- $.map(arr,function(it,index){
- $li.eq(it).removeClass('dw-v')
- })
- }
- if(item.trim() == '孕产妇'){
- var arr = [1,5]
- $.map(arr,function(it,index){
- $li.eq(it).removeClass('dw-v')
- })
- }
- })
- },
- //获得服务类型数据
- getServiceData = function(){
- var url = "/doctor/sign/getSigndict";
- sendGet(url, {}, null, function(res){
- fillServiceDropdown(res);
- }, true);
- },
- //设置服务类型下拉
- fillServiceDropdown = function(data){
- var $serviceSel = $('#selFuwu'),
- data = data.data,
- html="";
- for(i=0; i<data.length; i++){
- html += '<option value="'+data[i].code+'">'+data[i].name+'</option>'
- }
- $serviceSel.html(html);
- $serviceSel.mobiscroll().select({
- theme: 'ios',
- lang: 'zh',
- display: 'bottom',
- rows:6,
- placeholder:'请选择服务类型',
- onSelect: function ( valueText, inst) {
- // var vArr = valueText.split(',');
- //判断服务类型是否变更
- $juminLabels.val("").attr("data-code",JSON.stringify({health: "",disease: "", custom: "" }));
- currService = inst._tempValue?inst._tempValue.join(','):'';
- },
- onChange: function (event, inst) {
- filterSer(event)
- },
- onShow: function (event, inst) {
- filterSer(inst)
- }
- })
- },
- // 获取表单数据
- getInputs = function() {
- var data = {
- group: $groupInput.attr("data-code"), // 居民分组
- //disease: $diseaseInput.attr("data-code") , // 慢病类别code
- doctorQK: $doctorQKInput.attr("data-code"), // 全科医生code
- teamCode: $doctorQytdInput.attr("data-code"), // 签约团队code
- doctorNameQK: $doctorQKInput.val(), // 全科医生名字
- doctorJG: $doctorJGInput.attr("data-code"), // 健康管理师code
- doctorNameJG: $doctorJGInput.val(), // 健康管理师名字
- expenses: $expensesInput.attr("data-code"), // 政府补贴费
- agree: $agree.hasClass("checked") ,// 家庭医生签约协议(是否勾选)
- juminLabels: $juminLabels.attr("data-code"), // 居民标签
- juminServices: $juminServices.attr("data-code") //服务类型
- };
- return data;
- },
- // 必输验证
- validRequired = function(data) {
- var fieldsStr = "doctorQK,doctorJG,juminLabels",
- fieldMap = {
- doctorQK:"全科医生",doctorJG:"健康管理师",teamCode: "签约团队",juminLabels: "居民标签"
- },
- fields = fieldsStr.split(","),
- invalidField;
-
- invalidField = _.find(fields,function(key) {
- return !data[key];
- });
- if(invalidField) {
- mui.toast(fieldMap[invalidField]+'不能为空');
- return false;
- } else {
- return true;
- }
- },
- // 输入格式验证
- validFormat = function(data) {
- return true;
- },
- // 检查是否签约三师
- checkSignedSanshi = function(signedData) {
- // signStatus: 0-->病人未注册或三师跟家庭签约都没有,1-->有三师签约,2-->有签约家庭医生
- var signStatus = signedData.signStatus;
- return signStatus==1;
- },
- // 检查三师签约中全科医生是否在当前医生所在社区
- checkSanshiComnunity = function(loginerData,signedData) {
- // 三师中全科医生所在社区主编码(截取前8位,后两位是服务站)
- var sanShiHospital = signedData.hospital.slice(0,8),
- // 该医生(登录者)所在社区主编码(截取前8位,后两位是服务站)
- hospital = loginerData.hospital.slice(0,8);
- return sanShiHospital == hospital;
- },
- // 检查三师签约中全科医生是否是当前医生
- checkLoginerIsSanshi = function(loginerData,signedData) {
- // 三师签约中全科医生code
- var sanShiDoctor = signedData.doctor,
- // 该医生(登录者)编码
- doctor = loginerData.code;
- return sanShiDoctor == doctor;
- },
- validInputByDBPromise = function(data) {
- return true;
- },
- //获取签约团队
- getQytd = function(){
- var userAgent = baseInfo.userAgent;
-
- getReqPromise("/doctor/admin-teams/team/"+ baseInfo.docInfo.code +"/teamsLimit",{}, "GET")
- .then(function(res) {
- if(res.status == 200) {
- var teams = res.data,
- teamCodes=[],
- teamNames=[];
- // 萃取数组对象中code、name,返回一个数组
- teamCodes = _.pluck(teams, 'id');
- // teamNames = _.pluck(teams, 'name');
- for(var i = 0; i < teams.length; i++){
- var signTeam;
- var signCount = teams[i].signCount;
- var signLimitNumber = teams[i].signLimitNumber;
- if(signCount >= signLimitNumber){
- signTeam = teams[i].name + "<span style='color:red'>(已达上限)</span>";
- $('#upload').css({pointerEvents:'none',backgroundColor:"#ccc"});
- }else{
- signTeam = teams[i].name + "(签约人数为"+signCount+"人)";
- }
- teamNames.push(signTeam);
- }
- qytdSelect(teamCodes, teamNames);
- }
- }).catch(function(e) {
- console && console.error(e);
- });
- },
- // 设置团队下拉框
- qytdSelect = function (teamCodes,teamNames) {
- // 登录者信息
- var docInfo = baseInfo.docInfo,
- // 登录医生的类别。1:专科医生,2:全科医生,3:健康管理师
- docType = docInfo.docType;
- $doctorQytdInput.mobiscroll({
- theme: 'ios',
- lang: 'zh',
- customWheels: true,
- wheels: [
- [{
- keys: teamCodes,
- values: teamNames
- }]
- ],
- onSelect: function(valueText, inst) {
- var valueTextZy = valueText.replace("<span style='color:red'>", "<span style=\\\'color:red\\\'>");
- var dd = eval("[" + valueTextZy + "]"),
- name=dd[0].values,
- currExpenses = dd[0].keys;
-
- // $(this).val(name);
- $(this).html(name);
- if($doctorQytdInput.html(name).toString().length>18){
- $doctorQytdInput.css({textAlign:'left'});
- }else{
- $doctorQytdInput.css({textAlign:'right'});
- }
- $doctorQytdInput.attr("data-code",currExpenses);
- // 修复bug#2303 当修改团队时应该清空全科医生及健管师选项中选择的信息
- if(docType == 2) {
- $doctorJGInput.val('').attr("data-code",'');
- } else if(docType == 3) {
- $doctorQKInput.val('').attr("data-code",'');
- }
-
- getTeamMember(currExpenses);
- }
- });
- if(teamCodes.length == 1){
- setQytdSelect(teamCodes[0], teamNames[0]);
- getTeamMember(teamCodes[0]);
- }
- },
- //获取团队成员
- getTeamMember= function(teamCode){
- plus.nativeUI.showWaiting();
-
- sendGet("/doctor/admin-teams/"+ teamCode + "/members", {}, null, function(res){
- if(res.status == 200){
- var qka = [], jgs= [],
- qkCodes=[], jgCodes =[],
- qkNames=[], jgNames = [];
-
- $.each(res.data, function(i, v) {
- if(v.level == 2){
- qka.push(v);
- jgs.push(v);
- }
- else if(v.level == 3)
- jgs.push(v);
- });
- // 萃取数组对象中code、name,返回一个数组
- qkCodes = _.pluck(qka, 'code');
- qkNames = _.pluck(qka, 'name');
- qkeSelect(qkCodes, qkNames);
-
- jgCodes = _.pluck(jgs, 'code');
- jgNames = _.pluck(jgs, 'name');
- activHealthM(jgCodes, jgNames);
-
- } else
- mui.toast("获取团队成员失败!");
- plus.nativeUI.closeWaiting();
- },true)
- },
- //设置签约团队默认值
- setQytdSelect = function(code, name) {
- // 获取全科医生下拉框mibiscroll实例
- var mobiscroll = $doctorQytdInput.mobiscroll('getInst');
- var valueText = "{keys:'"+code+"',values:'"+name+"'}";
- mobiscroll.setVal([valueText]);
- $doctorQytdInput.html(name);
- $doctorQytdInput.attr("data-code", code);
- },
- // 所有输入验证
- validInputsPromise = function() {
- // 表单数据
- var data = getInputs();
- return Promise.resolve()
- .then(function() {
- var flag = validRequired(data);
- if(!flag) throw new Error("必输校验失败");
- return flag;
- })
- .then(function(flag) {
- var flag = validFormat(data);
- if(!flag) throw new Error("格式校验失败");
- return flag;
- })
- .then(function() {
- return validInputByDBPromise(data);
- })
- .then(function() {
- if(!data.agree) {
- mui.toast("您还未接受签约协议");
- throw new Error("未接受签约协议");
- return false;
- }
- return true;
- })
- .then(function(flag) {
- if(flag) return data;
- });
- },
- sendData = function (data) {
- var submitUrl = "doctor/family_contract/agent",
- docInfo = baseInfo.docInfo,
- juminLabels = JSON.parse($juminLabels.attr("data-code")),
- params = $.extend({},data,baseInfo.accessData,{
- doctor: data.doctorQK, //全科医生code
- doctorName: data.doctorNameQK, //全科医生名字
- signDoctorCode: docInfo.code, // 签约人code
- signDoctorName: docInfo.name, // 签约人名字
- signDoctorLevel: docInfo.docType, // 签约人等级
- healthDoctor: data.doctorJG,
- healthDoctorName: data.doctorNameJG,
- healthLabel: juminLabels.health,
- customLabel: juminLabels.custom,
- disease: juminLabels.disease,
- adminTeamCode:$doctorQytdInput.attr("data-code"),
- sevId: currService
- });
- getReqPromise(submitUrl, params).then(function(res) {
- plus.nativeUI.closeWaiting();
- if(res.status == 200) {
- mui.toast('代理签约成功')
- 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");
- }
- setTimeout(function() {
- backToPage(self)
- }, 500)
- }else{
- mui.toast(res.msg)
- }
- }).catch(function(e) {
- plus.nativeUI.closeWaiting();
- console && console.error(e);
- });
- },
- bindEvents = function() {
- // 提交
- $upload.on('tap', function() {
- plus.nativeUI.showWaiting();
- validInputsPromise().then(function(data) {
- if(data) {
- sendData(data);
- }
- }).catch(function(e) {
- plus.nativeUI.closeWaiting();
- console && console.error(e);
- });
-
- });
- // 选择分组
- $("body").on("click","#li_group",function(){
- mui.openWindow({
- url:"../../qygl/html/xiaoxichuli_fzgl.html",
- id:"xiaoxichuli_fzgl.html"
- })
- })
- // 选择居民标签
- .on("click","#jumin_labels",function(){
- var teamCode = $doctorQytdInput.attr("data-code");
- if($.trim(teamCode)) {
- //判断当前服务类型是否已经选择
- if(!currService){
- mui.confirm('请先选择服务类型', "提示", ["确定"], function(){});
- return false;
- }
- mui.openWindow({
- url:"../../huanzhe/html/disease-label-choose.html",
- id:"disease-label-choose",
- extras: $.extend({
- teamCode: teamCode,
- showData: $juminLabels.attr("data-code") || null,
- serviceCode: currService
- },baseInfo.signedData)
-
- })
- } else {
- mui.confirm('请先选择签约团队', "提示", ["确定"], function(){});
- }
-
- })
- // 点击家庭医生签约协议(勾选框)
- .on('click', '.input-group-pack', function() {
- $(this).toggleClass("checked");
- });
-
- $diseaseInput.on('click',function() {
- var view = plus.webview.getWebviewById("xuanzejibing"),
- createNew = false,
- signedData = baseInfo.signedData;
- if(view){ // 如果页面已经缓存
- view.close();
- createNew = true;
- }
-
- var diseaseCodes = null,
- diseaseNames = null;
- if($diseaseInput.val().trim()) {
- diseaseCodes = $diseaseInput.attr('data-code').split(',');
- }
- mui.openWindow({
- url: "../../huanzhe/html/xuanzejibing.html",
- id:"xuanzejibing",
- // 是否重新创建页面webview,防止页面缓存
- createNew: createNew,
- // 跳转页面传参
- extras: {
- diseases: signedData.diseases
- },
- });
- });
-
- /*分组事件*/
- window.addEventListener("group", function group(e) {
- var groupcode=e.detail.code
- var groupName=e.detail.name
- $groupInput.val(groupName).attr("data-code",groupcode)
- });
- /*居民标签*/
- window.addEventListener("setJuMinLabels", function setJuMinLabels(e) {
- var health = e.detail.health,
- disease = e.detail.disease,
- custom = e.detail.custom,
- labelName = e.detail.labelName;
-
- $juminLabels.val(labelName).attr("data-code",JSON.stringify({health: health,disease: disease, custom: custom }));
- });
-
- /*疾病类型回填事件*/
- window.addEventListener("setDiseaseTypes", function setDiseaseTypes(e) {
- var diseases = e.detail.diseases,
- values = _.pluck(diseases, 'disease').join(','),
- names = _.pluck(diseases, 'diseaseName').join(',');
- // 更新疾病类型选择的值
- baseInfo.signedData.diseases = diseases;
- $diseaseInput.val(names);
- $diseaseInput.attr('data-code',values);
- });
- };
- // 页面业务处理流程开始
- new Promise(function(resolve, reject) {
- mui.plusReady(function() {
- // plus已经准备好,可以往下执行
- resolve(true);
- })
- }).then(function() {
- var docInfo = JSON.parse(plus.storage.getItem("docInfo"));
- if(docInfo.level == 3){
- $doctorJGInput.val(docInfo.name).attr('data-code', docInfo.code);
- } else if(docInfo.level == 2){
- $doctorQKInput.val(docInfo.name).attr('data-code', docInfo.code);
- }
-
- $doctorQKInput.on('tap', function(){
- mui.confirm('请先选择签约团队', "提示", ["确定"], function(){});
- })
- $doctorJGInput.on('tap', function(){
- mui.confirm('请先选择签约团队', "提示", ["确定"], function(){});
- })
- // 获取基础环境信息
- baseEnv = getBaseEnv();
- // 获取基本信息
- getBaseInfoPromise().then(function(data) {
- baseInfo = data;
- }).then(function() {
- // 请求并获取签约团队
- getQytd();
- // 请求并初始化全科医生下拉框数据
- qke();
- // 请求并初始化健康管理师下拉框数据
- // reqDoctorJG();
- // 请求并初始化政府补贴下拉框数据
- setExpenses();
- // 疾病类型初始化赋值
- initDiseaseTypes();
- // 请求并初始化服务类型下拉框数据
- getServiceData();
- // 绑定页面事件
- bindEvents();
- });
-
- }).catch(function(e) {
- plus.nativeUI.closeWaiting();
- console && console.error(e);
- })
- //关闭页面操作
- var closeList = [];
- function backToPage(wv){
- if(wv.id == "home2.html"){
- var self = plus.webview.currentWebview();
- wv.show();
- mui.later(function(){
- for(i=0; i<closeList.length; i++){
- closeList[i].close('none');
- }
- self.close('none');
- }, 500);
- return false;
- }else{
- var opener = wv.opener();
- if(opener.id != "home2.html"){
- closeList.push(opener);
- }
- backToPage(opener);
- }
- }
|