123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- var myScroll, docCode, teamCode, type, self, num = 0, curDocCode;
- mui.plusReady(function(){
- self = plus.webview.currentWebview();
- docCode = self.docCode;
- teamCode = self.teamCode;
- type = self.type;
- curDocCode = getUid();
- if(type == "dfp"){
- getDfpPatiLs();
- }else
- getPatiLs();
- })
-
- function getDfpPatiLs(){
- plus.nativeUI.showWaiting();
- sendGet("/doctor/family_contract/findNoHealthSignFamilyHealth",
- {doctor: curDocCode, page: 0, pageSize: 2000}, null, function(res){
- if(res.status == 200){
- console.log(JSON.stringify(res))
- res.data = res.list;
- if(!res.data || res.data.length==0){
- $('#wushuju').show();
- $('.lin-footer').hide();
- $('.doc-list').hide();
- } else {
- $('.doc-list').html(template('pati_tmpl', res));
- }
- myScroll.refresh();
- plus.nativeUI.closeWaiting();
-
- } else
- mui.toast(res.msg)
- })
- }
-
- function getPatiLs(){
- plus.nativeUI.showWaiting();
- sendGet("/doctor/admin-teams/teams/"+ teamCode +"/members/"+ docCode +"/signing", {}, null, function(res){
- if(res.status == 200){
- if(!res.data || res.data.length==0){
- $('#wushuju').show();
- $('.lin-footer').hide();
- $('.doc-list').hide();
- } else {
- $('.doc-list').html(template('pati_tmpl', res));
- }
- myScroll.refresh();
- plus.nativeUI.closeWaiting();
-
- } else
- mui.toast(res.msg)
- })
- }
-
- var loaded = function () {
- myScroll = new IScroll('#wrapper', { mouseWheel: true });
- document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
- }();
-
- /**
- * 下一步操作
- */
- function submit(){
- if(num<=0)
- return;
- plus.nativeUI.showWaiting();
- var patients = [], patiCodes = [];
- var patient;
- $.each($('.doc-list').find('.doc-item.checked'), function(i, v) {
- patient = JSON.parse($(v).attr('data-info'));
- patients.push(patient);
- patiCodes.push(patient.code);
- });
-
- sendPost("/doctor/consult/getConsultByPatientAndDoctor",
- {patientCode: patiCodes.join(","), doctor: docCode}, null,
- function(res){
- var tem = {};
- if(res.length==0){
- to_next(patients);
- } else if(patients.length == res.length){
- plus.nativeUI.closeWaiting();
- mui.confirm("对不起,您选择的居民均有尚未结束的健康咨询,无法继续转移。", "提示", ["我知道了"], function(e){
-
- })
- return;
- } else if(res.length <= 3 ){
- tem = getCanTrans(patients, res);
- mui.confirm("居民"+ tem.names + ",尚有未结束的健康咨询,本次只可转移其余居民,是否继续?", "提示", ["继续转移", "不了,谢谢"], function(e){
- if(e.index == 0){
- to_next(tem.canPati);
- cancleSel(res);
- }
- })
- } else if(res.length < patients.length){
- tem = getCanTrans(patients, res);
- mui.confirm("选中居民中有"+ res.length + "人,尚有未结束的健康咨询,本次只可转移其余居民,是否继续?", "提示", ["继续转移", "不了,谢谢"], function(e){
- if(e.index == 0){
- to_next(tem.canPati);
- cancleSel(res);
- }
- })
- } else{
-
- }
- plus.nativeUI.closeWaiting();
- })
-
- }
-
- function cancleSel(notCodes){
- $.each(notCodes, function(i, v) {
- $('.doc-item[data-code="'+ v +'"]').removeClass("checked");
- });
- num = $('.doc-list').find('.doc-item.checked').length;
- $('.checked-num label').html(num);
- $('.link').toggleClass('c-ccc', num<=0);
- }
-
- function getCanTrans(patients, notCodes){
- var canPati = [];
- var names = [];
- $.each(patients, function(i, v) {
- var has = false;
- $.each(notCodes, function(n, m) {
- if(v.code == m){
- has = true;
- names.push(v.name);
- }
- });
- if(!has){
- canPati.push(v);
- }
- });
- return {canPati: canPati, names: names.join(",")}
- }
-
- function to_next(patients){
- mui.openWindow({
- id: "xuanzejieshouyisheng.html",
- url: "xuanzejieshouyisheng.html",
- extras: {
- jgs: self.jgs,
- patients: patients,
- docCode: docCode,
- teamCode: teamCode,
- type: "转移"
- }
- });
- }
-
- $('.doc-list').on('tap', '.doc-item', function(){
- $(this).toggleClass('checked');
- num = $('.doc-list').find('.doc-item.checked').length;
- $('.checked-num label').html(num);
- $('.link').toggleClass('c-ccc', num<=0);
- })
-
- $('#allSel').on('tap', function(){
- $(this).toggleClass('checked');
- if($(this).hasClass('checked')){
- $(this).next().html("取消全选");
- $('.doc-list').find('.doc-item').addClass('checked');
- } else {
- $(this).next().html("全选");
- $('.doc-list').find('.doc-item').removeClass('checked');
- }
-
- num = $('.doc-list').find('.doc-item.checked').length;
- $('.checked-num label').html(num);
- $('.link').toggleClass('c-ccc', num<=0);
- })
|