<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<script src="assets/js/jquery-3.1.0.js"></script>
		<script src="assets/js/jquery.base64.js"></script>
		<script src="CommonJS/Config_JS/Config_Load.js"></script>
		<script src="CommonJS/DBUtil_JS/WsCommonClassJava.js"></script>
		<script src="CommonJS/Data_ProcessJS/CommonData.js"></script>
		<script src="CommonJS/HTML_ElementCommonJS/Select_Common.js"></script>
		<script src="js/mui.min.js"></script>


		<style>
			.leftimg{
				margin-top: 0.9375rem;
			}
			.maintext{
				/* float: left; */
			}
			.delebtn{
				 width: 1.5625rem;
				 margin-top: 1.25rem;
			}
			.title{
				background-color:gainsboro;
				height: 3.125rem;
			}
			.maincontent{
				margin-top: 3.75rem;
			}
			.headimg{
				float: left;
				margin-left: 0.3rem;
				margin-top: 0.8rem;
			}
			.headimg img{
				width: 2.1875rem;
			}
			 li{
			        display:block;
			        /* float:left; */
			        width:100%;
			        margin-right:8px;
			        white-space:normal;
			        word-break : break-all;
			        word-wrap: break-word;
			    }

				 .table {
						border: 1px solid #cad9ea;
						color: #666;
					}

					.table th {
						background-repeat: repeat-x;
						height: 30px;
					}

					.table td,
					.table th {
						border: 1px solid #cad9ea;
						padding: 0 1em 0;
					}

					.table tr.alter {
						background-color: #f5fafe;
					}


			#popover{
						position: absolute !important;
						top: 43% !important;
						left: 17% !important;
					}
					.mui-popover-arrow{
								display: none;
							}
		</style>
		<script>
			$(document).on("click", '#mainpage', function() {
				window.location="mainTest.html?date="+getDateStr();
			});
			$(document).on("click", '#addpage', function() {
				// mui.alert('模块更新中 敬请期待!!!', '系统提示', function() {});
				window.location="addTest.html?date="+getDateStr();
			});
			$(document).on("click", '#exit', function() {
				 var btnArray = ['否', '是'];
				 mui.confirm('是否确认退出登录?', '系统提示', btnArray, function(e) {
					if (e.index == 1) {
						window.location="loginTest.html";
					} else {
					}
				})
			});

			mui.init({
				//swipeBack: true //启用右滑关闭功能
			});
			(function($) {
				$('#scroll').scroll({
					indicators: true //是否显示滚动条
				});
				var segmentedControl = document.getElementById('segmentedControl');
				$('.mui-input-group').on('change', 'input', function() {
					if (this.checked) {
						var styleEl = document.querySelector('input[name="style"]:checked');
						var colorEl = document.querySelector('input[name="color"]:checked');
						if (styleEl && colorEl) {
							var style = styleEl.value;
							var color = colorEl.value;
							segmentedControl.className = 'mui-segmented-control' + (style ? (' mui-segmented-control-' + style) : '') + ' mui-segmented-control-' + color;
						}
					}
				});
			})(mui);


			function createNewDataList(content, address, username, idcard,id,ppzt,sex,major,street,xjzt,zdpc) {
				var str = "";
				var str1="";
					/* "<li id='newdatalist' class='mui-table-view-cell mui-media'>" +
					"<a class='mui-navigate-right'>" +
					"<img class='mui-media-object mui-pull-left' src='../assets/images/test.png'>" +
					"<div class='mui-media-body'>" +
					"<span class='mui-ellipsis' style='font-size: 16px;font-family: PingFang;'>" + typeName + "</span>" +
					"<span  class='mui-ellipsis mui-pull-right' style='font-size: 13px;font-family: PingFang;'>" + time + "</span>" +
					"<p id='dataID' class='mui-ellipsis mui-pull-right' style='font-size: 0px;font-family: PingFang;'>" + id + "</p>" +
					"<p class='mui-ellipsis'>" +
					"<span class='mui-ellipsis' style='font-size: 13px;font-family: PingFang;'>" + projectName + "</span>" +
					"<span class='mui-ellipsis mui-pull-right' style='font-size: 13px;font-family: PingFang;'>" + status + "</span>" +
					"</p></div></a></li> "; */
					var enable = "";
					var strzt="";
					var strimage="";
					if(zdpc=="0"){
                        strimage="<img class='mui-media-object mui-pull-left leftimg' src='assets/image/tupian.png'>" ;
					}
					if(zdpc=="1"){
                        strimage="<img class='mui-media-object mui-pull-left leftimg' src='assets/image/tupian2.png'>" ;
					}
					if(towncode == null || towncode==""){
						enable =" disabled='disabled'";
					}else{
						enable = "";
					}

					if(ppzt=='1'){
						strzt="街道已匹配";
					}else{
						if(ppzt==''){
							strzt="街道未匹配";
						}else{
							strzt="街道已匹配";
						}
					}
				if(towncode != null && towncode!=""){
					str1="";
				}else{
					str1="<p id='txt_ppzt' class='mui-ellipsis' >"+strzt+"</p>";
				}

				/* 	str = "<li id='list' class='mui-table-view-cell mui-media'>"+
							"<a href='javascript:;'>"+
							"<img class='mui-media-object mui-pull-left leftimg' src='assets/image/tupian.png'>"+
							"<div class=' mui-pull-right'>"+
							"<div><span class='mui-badge mui-badge-success'>"+content+"</span></div>"+
							"<div><img src='assets/image/lajit.png' class='delebtn'/></div>"+
							"</div>"+
							"<div class='mui-media-body  maintext' >"+
							"<p id='txt_add' class='mui-ellipsis-5' style='width: 95%;'>"+address+"</p>"+
							"<p id='txt_name' class='mui-ellipsis'>"+username+"</p>"+
							"<p id='txt_idcard' class='mui-ellipsis'>"+idcard+"</p>"+
							"<p id='txt_id' class='mui-ellipsis' style='display:none'>"+id+"</p>"+str1+
							"</div>"+
							"</a>"+
							"</li>"; */

				if(role=="3" || role=="21") {
                    var str1="";
                    var str2="";
                    if(xjzt!=""){
                        if(xjzt=="执业中"){
                            str1="<div><span class='mui-badge mui-badge-danger'>" + xjzt + "</span></div>" ;
						}else{
                            str1="<div><span class='mui-badge mui-badge-success'>" + xjzt + "</span></div>" ;
						}
                    }
                    if(content>0){
                        if(xjzt=="执业中"){
                            str2="<span class='mui-badge mui-badge-danger' >" + content + "</span>";
                        }else{
                            str2="<span class='mui-badge mui-badge-success' >" + content + "</span>";
                        }
					}else{
                        str2="<span class='mui-badge mui-badge-success' >" + content + "</span>";
					}
								str = "<li id='list' class='mui-table-view-cell mui-media'>" +
										"<a href='javascript:;'>" +strimage+

										"<div class=' mui-pull-right'>" +
										"<div onclick='conclusionPopover("+id+")'>" +str2+
										"</div>" +str1+
										//"<div><img src='assets/image/lajit.png' class='delebtn'/></div>"+
										"</div>" +
										"<div class='mui-media-body  maintext' id='listDiv'>" +
										"<p id='txt_add' class='mui-ellipsis-5' style='width: 95%;'>" + address + "</p>" +
										"<p id='txt_name' class='mui-ellipsis'>" + username + "</p>" +
										"<p id='txt_idcard' class='mui-ellipsis'>" + idcard + "</p>" +
										"<p id='txt_id' class='mui-ellipsis' style='display:none'>" + id + "</p>" +
										"<p id='txt_sex' class='mui-ellipsis' style='display:none'>" + sex + "</p>" +
										"<p id='txt_major' class='mui-ellipsis' style='display:none'>" + major + "</p>" +
										"</div>" +
										"</a>" +
										"</li>";
							}else {
									var str1="";
									var str2="";
									var str3="";
									if(xjzt=="执业中"){
                                        str3="<div class='mui-media-body  maintext' id='listDiv' onclick='onclickRead("+id+")'>" ;
                                    }else{
                                        str3="<div class='mui-media-body  maintext' id='listDiv'>" ;
                                    }

									if(xjzt!=""){
										if(xjzt=="执业中"){
											str1="<div><span class='mui-badge mui-badge-danger'>" + xjzt + "</span></div>" ;
										}else{
											str1="<div><span class='mui-badge mui-badge-success'>" + xjzt + "</span></div>" ;
                                        }
									}
									if(content>0){
										if(xjzt=="执业中"){
											str2="<span class='mui-badge mui-badge-danger' >" + content + "</span>";
										}else{
											str2="<span class='mui-badge mui-badge-success' >" + content + "</span>";
										}
									}else{
										str2="<span class='mui-badge mui-badge-success' >" + content + "</span>";
									}

								str = "<li id='list' class='mui-table-view-cell mui-media'>" +
										"<a href='javascript:;'>" +strimage+
										"<div class=' mui-pull-right'>" +
										"<div onclick='conclusionPopover("+id+")'>" +str2+
									"</div>" +str1+
										//"<div><img src='assets/image/lajit.png' class='delebtn'/></div>"+
										"</div>" +str3+
										"<p id='txt_street' class='mui-ellipsis-5' style='width: 95%;'>" + street + "</p>" +
										"<p id='txt_add' class='mui-ellipsis-5' style='width: 95%;'>" + address + "</p>" +
										"<p id='txt_name' class='mui-ellipsis'>" + username + "</p>" +
										"<p id='txt_major' class='mui-ellipsis'>" + major + "</p>" +
										"<p id='txt_idcard' class='mui-ellipsis'>" + idcard + "</p>" +
										"<p id='txt_id' class='mui-ellipsis' style='display:none'>" + id + "</p>" +
										"<p id='txt_sex' class='mui-ellipsis' style='display:none'>" + sex + "</p>" +
										"</div>" +
										"</a>" +
										"</li>";
							}

				$("#newDataUl").append(str);

			}

			$(document).on("click", '#listDiv', function() {

				// mui.show("fasdfasdfasd");
				var listid = $(this).find('#txt_idcard').text();
				localStorage.setItem("name",$(this).find('#txt_name').text());
				localStorage.setItem("idcard",$(this).find('#txt_idcard').text());
				localStorage.setItem("address",$(this).find('#txt_add').text());
				localStorage.setItem("caseid",$(this).find('#txt_id').text());

				localStorage.setItem("sex",$(this).find('#txt_sex').text());
				localStorage.setItem("major",$(this).find('#txt_major').text());

				//增加判断:四小时内不能重复提交
				var strSql = "select count(t.ID) num from 巡检状态 t where t.一户一档ID = '"+$(this).find('#txt_id').text()+"' and t.时间 > (sysdate-(4.0/24))";
				new WsCommonClass("QueryDataBaseJson", ["sql"], [strSql], (evt)=>{
					var num = Number(evt.data[0].NUM);
					if(num > 0){
						mui.alert('四小时内不能重复提交!','提示',['确定'],null,'');
						return;
					}else{
						// var html = "approveNew.html";
						var html = "approveTest.html";
						// var html = "./mFAHomepageParticulars.html?id=" + listid;
						if(role=="3" ||role=="21"){
							$(location).attr('href', html);
						}
					}
				}, "queryCount");

				// alert(listid);
				// var html = "approveNew.html";
				// var html = "approveTest.html";
				// // var html = "./mFAHomepageParticulars.html?id=" + listid;
				// if(role=="3" ||role=="21"){
				// 	$(location).attr('href', html);
				// }else{
				//
				// }

				// var webview_sub = plus.webview.create(
				// 		 html,
				// 		 'mFAHomepageParticulars', {}, {
				// 			 name: 'davis'
				// 		 }); //后台创建webview并打开页面
				// 		webview_sub.show('slide-in-right', 150);
			});
			var towncode;
            var towncode1;
			var districtcode;
			var role;
            var town;
			window.onload = function load(){
                var district = localStorage.getItem("district");
				districtcode = localStorage.getItem("districtcode");
				town = localStorage.getItem("town");
				towncode = localStorage.getItem("towncode");
                var town1 = localStorage.getItem("town1");
                towncode1 = localStorage.getItem("towncode1");
                role = localStorage.getItem("ROLE");
				// alert(district+"/"+town);
				$("#towninfo").attr("placeholder",district+"/"+town);//.val("aaaa");//district+"/"+town);

				// 巡查员用户&区级管理员用户
				if(role=="3" ||role=="21"){
				    document.getElementById("streetDiv").style.display="none";
					$("#div_totalcon").hide();
					getListInfo(towncode);
                    queryPatrolStatus();
				}
				// 区级用户
				else if(role=="2"){

					$("#div_totalcon").show();
					//queryQXList(districtcode);
					//getListDistrictInfo(districtcode);
                    queryPatrolStatus();
					queryQXListDistrict(districtcode);

					queryInspectorFind(district);
					//totalInfoArea1();
				}
				// 市级用户
				else if(role=="1"){
					$("#div_totalcon").show();
					// $("#item1").removeClass("mui-active");
					// $("#item2").addClass("mui-active");

					// $("#segmentedControl a").eq(1)[0].className="mui-control-item mui-active";//第二个tab设置当前页
					// $("#segmentedControl a").eq(0)[0].remove();//删第一个tab

					// 获取巡检状态
					queryPatrolStatus();
					// 获取任务清单
					queryQXListDistrict("");

					totalInfoCity();
					queryInspectorFindByCity( );
				}
			};

			function queryQXList(districtcode){
				var strSql = "";
				if(districtcode == "310")
					strSql = "select distinct(t.district) town,t.districtcode towncode from 系统用户信息表 t where t.districtcode !='310' order by districtcode ";
				else
					strSql = "select * from 系统用户信息表 t where districtcode='"+districtcode+"' order by towncode ";
				new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryQXList");
			}
			function queryQXListDistrict(districtcode) {
						/* var strSql="select t.towncode,t.town from 系统用户信息表 t where districtcode='"+districtcode+"' " +
								"union select 0 towncode,to_char('未匹配') town from dual";

						new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryQXListDis"); */

                // var strSql="select distinct t.towncode,to_char(t.town) town from 系统用户信息表新 t where t.districtcode='"+districtcode+"' and t.town is not null " +
                //     "union select 0 towncode,to_char('未匹配') town from dual";
				var strSql="select distinct t.towncode,to_char(t.town) town from 系统用户信息表新 t where t.town is not null ";
                if(districtcode!=""){
					strSql += "and t.districtcode='"+districtcode+"'";
				}
				strSql += " union select 0 towncode,to_char('未匹配') town from dual ";
			    new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryQXListDis");
			}
			function queryPatrolStatus() {
						var strSql="select * from 编码表巡检状态 t where t.id!=5";

						new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryPatrolStatus");
			}
			function queryInspectorFindByCity() {
				document.getElementById("newDataUlFind").innerHTML="";
				var datet = new Date();
				var monthstr = datet.getMonth()+1;
				var where="";

				/*if(monthstr=='1' || monthstr=='2' ||monthstr=='3'){
					where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/01' and '"+datet.getFullYear()+"/03'";
				}else if(monthstr=='4' || monthstr=='5' ||monthstr=='6'){
					where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/04' and '"+datet.getFullYear()+"/06'";
				}
				else if(monthstr=='7' ||monthstr=='8' ||monthstr=='9'){
					where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/07' and '"+datet.getFullYear()+"/09'";
				}else if(monthstr=='10' || monthstr=='11' ||monthstr=='12'){
					where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/10' and '"+datet.getFullYear()+"/12'";
				}*/
                if(monthstr=="1" ||monthstr=="2" ||monthstr=="3" ){
                    where="1,2,3"
                }
                if(monthstr=="4" ||monthstr=="5" ||monthstr=="6" ){
                    where="4,5,6"
                }
                if(monthstr=="7" ||monthstr=="8" ||monthstr=="9" ){
                    where="7,8,9"
                }
                if(monthstr=="10" ||monthstr=="11" ||monthstr=="12" ){
                    where="10,11,12"
                }
				//var strSql="select t.*,y.username,y.mobile from 巡检新增 t left join 系统用户信息表新 y on t.巡查员id=y.id where 1=1 "+where+" order by y.district";
				var strSql="select t.num 身份证,t.name 姓名,t.registere 执业地址," +
					"t.专业 从事专业,t.street 街道,t.时间 上报时间,t.手机  MOBILE from health.view_巡检 t " +
					"where t.sendyear="+datet.getFullYear()+
					" and t.sendmonth in ("+where+") and t.source=4 and t.sourcesub=1";
				new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryInspectorFindByCity");
			}
			function queryInspectorFind(district) {

                var aa=district.substring(0, 2);
						document.getElementById("newDataUlFind").innerHTML="";
						var datet = new Date();
						var monthstr = datet.getMonth()+1;
						var where="";
						/* if(datet.getFullYear()=='2021'){
							if(monthstr=='6'){
								where=" and   to_char(t.上报时间,'yyyy/mm') between '2021/01' and '2021/06'";
							}else if(monthstr=='7' || monthstr=='8' ||monthstr=='9'){
								where=" and  to_char(t.上报时间,'yyyy/mm') between '2021/03' and '2021/09'";
							}else if(monthstr=='10' || monthstr=='11' ||monthstr=='12'){
								where=" and  to_char(t.上报时间,'yyyy/mm') between '2021/05' and '2021/12'";
							}
						}else {
							if(monthstr=='1'||monthstr=='2'||monthstr=='3'){
								where=" and  to_char(t.上报时间,'yyyy/mm') between '"+(datet.getFullYear()-1)+"/07' and '"+datet.getFullYear()+"/03'";
							}else if(monthstr=='4'||monthstr=='5'||monthstr=='6'){
								where=" and  to_char(t.上报时间,'yyyy/mm') between '"+(datet.getFullYear()-1)+"/10' and '"+datet.getFullYear()+"/06'";
							}else if(monthstr=='7'||monthstr=='8'||monthstr=='9'){
								where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/01' and '"+datet.getFullYear()+"/09'";
							}else if(monthstr=='10'||monthstr=='11'||monthstr=='12'){
								where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/04' and '"+datet.getFullYear()+"/12'";
							}
						}
						var strSql="select t.*,y.username,y.mobile from 巡检新增 t left join 系统用户信息表 y on t.巡查员id=y.id where t.区县='"+district+"' "+where+" order by y.towncode";
						console.log(strSql)
						new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryInspectorFind");
						 */
                if(monthstr=="1" ||monthstr=="2" ||monthstr=="3" ){
                    where="1,2,3"
                }
                if(monthstr=="4" ||monthstr=="5" ||monthstr=="6" ){
                    where="4,5,6"
                }
                if(monthstr=="7" ||monthstr=="8" ||monthstr=="9" ){
                    where="7,8,9"
                }
                if(monthstr=="10" ||monthstr=="11" ||monthstr=="12" ){
                    where="10,11,12"
                }


                /*if(monthstr=='1' || monthstr=='2' ||monthstr=='3'){
                    where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/01' and '"+datet.getFullYear()+"/03'";
                }else if(monthstr=='4' || monthstr=='5' ||monthstr=='6'){
                    where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/04' and '"+datet.getFullYear()+"/06'";
                }
                else if(monthstr=='7' ||monthstr=='8' ||monthstr=='9'){
                    where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/07' and '"+datet.getFullYear()+"/09'";
                }else if(monthstr=='10' || monthstr=='11' ||monthstr=='12'){
                    where=" and  to_char(t.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/10' and '"+datet.getFullYear()+"/12'";
                }*/
               // var strSql="select t.*,y.username,y.mobile from 巡检新增 t left join 系统用户信息表新 y on t.巡查员id=y.id where t.区县='"+district+"' "+where+" order by y.towncode";
                var strSql="select t.num 身份证,t.name 姓名,t.registere 执业地址," +
                    "t.专业 从事专业,t.street 街道,t.时间 上报时间,t.手机  MOBILE from health.view_巡检 t " +
                    "where t.sendyear="+datet.getFullYear()+
                    " and t.sendmonth in ("+where+") and t.source=4 and t.sourcesub=1 and t.COUNTYSSTRING='"+district.substring(0, 2)+"'";
						new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryInspectorFind");
					}

			function getListInfo(townCode){
                var datet = new Date();
                var monthstr = datet.getMonth()+1;
                var monthstr1 = "";
                if(monthstr=="1" ||monthstr=="2" ||monthstr=="3" ){
                    monthstr1="1,2,3"
				}
                if(monthstr=="4" ||monthstr=="5" ||monthstr=="6" ){
                    monthstr1="4,5,6"
                }
                if(monthstr=="7" ||monthstr=="8" ||monthstr=="9" ){
                    monthstr1="7,8,9"
                }
                if(monthstr=="10" ||monthstr=="11" ||monthstr=="12" ){
                    monthstr1="10,11,12"
                }
                var whereStr = "";
                if(town=="全街镇"){
                    whereStr+=" and t.county='"+districtcode+"'";
				}else if(towncode!="" && towncode1!=""){
                    whereStr=" and (t.streetid='"+towncode+"' or t.streetid='"+towncode1+"')";
				}else{
                    whereStr=" and t.streetid='"+towncode+"'";
				}
                if(document.getElementById("select_source").value!='0' ){
                    whereStr+=" and t.source="+document.getElementById("select_source").value;
                }
                if(document.getElementById("select_patrol").value!='-1'){
                    if(document.getElementById("select_patrol").value=='0'){
                        whereStr+=" and t.巡检状态ID is not null ";
                    }else {
                        whereStr+=" and t.巡检状态ID is  null ";
                    }
                }
				if(document.getElementById("select_conclusion").value){
                    if(document.getElementById("select_conclusion").value!='-1'){
                        whereStr+=" and t.巡检状态ID="+document.getElementById("select_conclusion").value;
                    }
				}

                var strSql = " select *  "+
                    "from (select to_char(t.id) id, "+
                    "to_char(t.NAME) name, "+
                    "to_char(t.REGISTERE) REGISTERE, "+
                    "to_char(t.NUM) NUM, "+
                    // "0 conent, "+
                    "to_char(nvl(aa.content, '0')) conent, "+
                    "'巡检' as type,t.专业,t.sex,t.street 街镇,t.巡检状态,t.排序,t.ZDPC "+
                    "from VIEW_巡检 t "+
                    "left join (select count(0) content, t.一户一档id "+
                    "from 巡检状态 t where t.时间 between ADD_MONTHS(sysdate, -3) and sysdate "+
                    "group by t.一户一档id) aa "+
                    "on t.id = aa.一户一档id "+
                    "where 1=1 "+whereStr+
                    "and t.sendyear = '"+datet.getFullYear() +"' "+
                    "and t.sendmonth in ("+monthstr1+") "+
                    //"and (t.sendmonth = '1' or t.sendmonth = '2' or  t.sendmonth = '3') "+
                    ") t where 1=1 "+
                    "order by t.排序 ";
                console.log(strSql)
				new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryUser");
				// strSql = "select *  from (select to_char(t.id) id, to_char(t.NAME) name, to_char(t.REGISTERE) REGISTERE, to_char(t.NUM) NUM, 0 conent, '巡检' as type from VIEW_巡检 t where t.streetid = '310118107001' and t.sendyear = '2020' and (t.sendmonth = '7' or t.sendmonth = '8') union all select to_char(a.id) as id, to_char(a.系统标题) as name, to_char(a.系统内容) as registere, '' as num, 0 conent, '推送' as type from 系统推送信息 a where a.所属街道代码 = '310118107001' ) t where 1=1 order by nlssort(t.name, 'NLS_SORT=SCHINESE_PINYIN_M') desc ";
			}

			function getListDistrictInfo(townCode){
                document.getElementById("newDataUl").innerHTML="";
                var datet = new Date();
                var monthstr = datet.getMonth()+1;
                var monthstr1 = "";
                if(monthstr=="1" ||monthstr=="2" ||monthstr=="3" ){
                    monthstr1="1,2,3"
                }
                if(monthstr=="4" ||monthstr=="5" ||monthstr=="6" ){
                    monthstr1="4,5,6"
                }
                if(monthstr=="7" ||monthstr=="8" ||monthstr=="9" ){
                    monthstr1="7,8,9"
                }
                if(monthstr=="10" ||monthstr=="11" ||monthstr=="12" ){
                    monthstr1="10,11,12"
                }
                var whereStr = "";
				console.log("streetid", document.getElementById("select_street").value);
                if(document.getElementById("select_street").value!='-1' ){
                    if(document.getElementById("select_street").value=="0"){
                        whereStr+=" and streetid  is null ";
                    }else{
                        whereStr+=" and streetid='"+document.getElementById("select_street").value+"' ";
                    }

                }
                if(document.getElementById("select_source").value!='0' ){
                    whereStr+=" and source="+document.getElementById("select_source").value;
                }
                if(document.getElementById("select_patrol").value!='-1'){
                    if(document.getElementById("select_patrol").value=='0'){
                        whereStr+=" and 巡检状态ID is not null ";
                    }else {
                        whereStr+=" and 巡检状态ID is  null ";
                    }
                }
				console.log("巡检状态ID", document.getElementById("select_conclusion").value);
				// if (document.getElementById("select_conclusion").value != '-1') {
				// 	whereStr += " and 巡检状态ID=" + document.getElementById("select_conclusion").value;
				// }
				let xc_value = document.getElementById("select_conclusion").value;
				if (xc_value != '-1' && xc_value != "") {
					whereStr += " and 巡检状态ID=" + document.getElementById("select_conclusion").value;
				}

                var strSql = " select *  "+
                    "from (select to_char(t.id) id, "+
                    "to_char(t.NAME) name, "+
                    " to_char(t.streetid) street, "+
                    "to_char(t.REGISTERE) REGISTERE, "+
                    "to_char(t.NUM) NUM, "+
                    // "0 conent, "+
                    "to_char(nvl(aa.content, '0')) conent, "+
                    "'巡检'  type, " +
                    "to_char(t.streetid) streetid,t.专业,t.sex,t.street 街镇,t.巡检状态,t.排序,t.ZDPC " +
                    "from VIEW_巡检 t "+
                    "left join (select count(0) content, t.一户一档id "+
                    "from 巡检状态 t where t.时间 between ADD_MONTHS(sysdate, -3) and sysdate "+
                    "group by t.一户一档id) aa "+
                    "on t.id = aa.一户一档id where 1=1 ";
				// 市级不过滤
				if(role != "1"){
					strSql += "and t.county like '"+districtcode+"%' ";
				}
				strSql += "and t.sendyear = '"+datet.getFullYear() +"' "+
                    "and t.sendmonth in ("+monthstr1+") "+  whereStr +
                    //"and t.sendmonth in (1,2,3) "+  whereStr +
                    "  order by t.排序,t.streetid) t where 1=1";
                console.log(strSql)
                // strSql = "select *  from (select to_char(t.id) id, to_char(t.NAME) name, to_char(t.REGISTERE) REGISTERE, to_char(t.NUM) NUM, 0 conent, '巡检' as type from VIEW_巡检 t where t.streetid = '310118107001' and t.sendyear = '2020' and (t.sendmonth = '7' or t.sendmonth = '8') union all select to_char(a.id) as id, to_char(a.系统标题) as name, to_char(a.系统内容) as registere, '' as num, 0 conent, '推送' as type from 系统推送信息 a where a.所属街道代码 = '310118107001' ) t where 1=1 order by nlssort(t.name, 'NLS_SORT=SCHINESE_PINYIN_M') desc ";
                new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"queryUser");
                $("#total").html("总计0条");
			}

			function querySuccess(evt,token){
                var jsonData = evt.data;

				if(jsonData != null){
					switch (token){
						case "queryUser":
						//console.log(jsonData)
							$("#total").html("总计"+jsonData.length+"条");
							document.getElementById("newDataUl").innerHTML="";
							for(var i=0;i<jsonData.length;i++){
								var address ;
								var name;
								var idcarid;
								var addressInfo = jsonData[i].REGISTERE.toString();
								if(addressInfo.indexOf("身份证:")>0){
									idcarid = addressInfo.substr(addressInfo.indexOf("身份证")+4,18);
									address = addressInfo.substr(addressInfo.indexOf("身份证")+22,addressInfo.length-1);
								}else{
									idcarid = jsonData[i].NUM;
									address = jsonData[i].REGISTERE;
								}
								name = jsonData[i].NAME;
								// 巡查员用户&区级管理员用户
								if(role=="3" ||role=="21"){

									//createNewDataList(jsonData[i].conent,address,name,idcarid,jsonData[i].id,'0');
									createNewDataList(jsonData[i].CONENT,address,name,idcarid,jsonData[i].ID,'0',jsonData[i].SEX,jsonData[i].专业,jsonData[i].街镇,jsonData[i].巡检状态,jsonData[i].ZDPC);


								}else{

									if(jsonData[i].type=='推送'){
										//createNewDataList(jsonData[i].conent,address,name,idcarid,jsonData[i].id,'1');
										createNewDataList(jsonData[i].CONENT,address,name,idcarid,jsonData[i].ID,'1',jsonData[i].SEX,jsonData[i].专业,jsonData[i].街镇,jsonData[i].巡检状态,jsonData[i].ZDPC);

									}else{
										//createNewDataList(jsonData[i].conent,address,name,idcarid,jsonData[i].id,jsonData[i].streetid);
										createNewDataList(jsonData[i].CONENT,address,name,idcarid,jsonData[i].ID,jsonData[i].STREETID,jsonData[i].SEX,jsonData[i].专业,jsonData[i].街镇,jsonData[i].巡检状态,jsonData[i].ZDPC);

									}

								}
							}
							break;
						case "queryQXList":
							Select_DyCreate("select_jd",jsonData,"towncode","town",true);
						//	Select_DyCreate("select_jd1",jsonData,"towncode","town",true);
							break;
						case "queryQXListDis" :
							Select_DyCreate("select_street",jsonData,"TOWNCODE","TOWN",true);
							//区级
							if(role=="2"){
								// 获取完成情况
								totalInfoArea();
								getListDistrictInfo(districtcode);
							}else{
								getListDistrictInfo("");
							}
							break;
						case "queryPatrolStatus":
							Select_DyCreate("select_conclusion",jsonData,"ID","状态",true);

							break;
						case "queryConclusion":
						   if(jsonData.length>0){
							   document.getElementById("newDataUl1").innerHTML="";
							   	for(var i=0;i<jsonData.length;i++) {
							   	    var strTask="";
							   	    var xc="";
							   	    if(jsonData[i].现场查见=='1'){
							   	        xc="在联";
									}
                                    if(jsonData[i].现场查见=='0'){
                                        xc="失联";
                                    }
									var zy="";
									if(jsonData[i].内科=='1'){
                                        zy+="内科,"
									}
                                    if(jsonData[i].牙科=='1'){
                                        zy+="牙科,"
                                    }
                                    if(jsonData[i].医美=='1'){
                                        zy+="医美,"
                                    }
                                    if(jsonData[i].其他=='1'){
                                        zy+=jsonData[i].内容;
                                    }
                                    var height=40;
                                    if(jsonData[i].状态!="已搬离"){
                                        if(zy=="" &&xc==""){
                                            height=40;
                                        }else{
                                            strTask="<label style='width: 65%'>"+zy+"</label><label style='width: 35%'>"+xc+"</label>";
                                            height=80;
										}

                                    }
							   		var str = "	<div class='mui-input-row' style='height:"+height+"px;'>"+
							   			"<label style='width: 65%'>"+jsonData[i].时间.substr(0,11)+"</label><label style='width: 35%'>"+jsonData[i].状态+"</label>"+strTask+
							   			"</div>";
							   			$("#newDataUl1").append(str);
							   	}
							   mui("#conclusionpopover").popover('toggle', document.getElementById("ta"));
						   }
							break;
						case "totalInfo":
							for(var i=0;i<jsonData.length;i++){
								var table = "<tr><td>"+jsonData[i].所属街道.toString()+"</td>"+
								"<td>"+jsonData[i].下发数.toString()+"</td>"+
								"<td>"+jsonData[i].已排查.toString()+"</td>"+
								"<td>"+jsonData[i].未排查.toString()+"</td></tr>";
								$("#tablebody").append(table);
							}
							break;
						case "queryInspectorFindByCity":{
							for(var i=0;i<jsonData.length;i++) {
								var sfz='';
								if(jsonData[i].身份证=="undefined" ||jsonData[i].身份证==''){
									sfz='';
								}else{
									sfz=jsonData[i].身份证;
								}
								var str = "<li id='list' class='mui-table-view-cell mui-media'>" +
										"<a href='javascript:;'>" +
										/*"<div class=' mui-pull-right'>" +
										 "</div>" +*/
										"<div class='mui-media-body  maintext' >" +
										"<p  class='mui-ellipsis'>" +
										"<table style='font-size: 14px;color: grey;'>" +
										"<tr><td>所属街道:</td><td>"+jsonData[i].街道+"</td></tr>" +
										"<tr><td>行医人姓名:</td><td>"+jsonData[i].姓名+"</td></tr>" +
										"<tr><td>地址:</td><td>"+jsonData[i].执业地址+"</td></tr>" +
										"<tr><td>专业:</td><td>"+jsonData[i].从事专业+"</td></tr>" +
										"<tr><td>身份证:</td><td>"+sfz+"</td></tr>" +
										"<tr><td>上报时间:</td><td>"+jsonData[i].上报时间.substring(0,19)+"</td></tr>" +
										"<tr><td>巡查员手机:</td><td>"+jsonData[i].MOBILE+"</td></tr>" +
										"</table>" +
										"</p>"+
										"</div>" +
										"</a>" +
										"</li>";
								$("#newDataUlFind").append(str);
							}
							break;
						}
						case "queryInspectorFind":
							/* for(var i=0;i<jsonData.length;i++) {
								var str = "<li id='list' class='mui-table-view-cell mui-media'>" +
									"<a href='javascript:;'>" +
									"<div class='mui-media-body  maintext' >" +
									"<p  class='mui-ellipsis-'>" + jsonData[i].街道 + "</p>" +
									"<p  class='mui-ellipsis'>" + jsonData[i].姓名 + "</p>" +
									"<p  class='mui-ellipsis'>" + jsonData[i].执业地址 + "</p>" +
									"<p  class='mui-ellipsis'>" + jsonData[i].从事专业 + "</p>" +
									"<p  class='mui-ellipsis' >" + jsonData[i].身份证 + "</p>" +
									"<p  class='mui-ellipsis' >" + jsonData[i].上报时间 + "</p>" +
									"<p  class='mui-ellipsis' >" + jsonData[i].MOBILE + "</p>" +
									"</div>" +
									"</a>" +
									"</li>";
									$("#newDataUlFind").append(str);
							} */

							for(var i=0;i<jsonData.length;i++) {
														var sfz='';
														if(jsonData[i].身份证=="undefined" ||jsonData[i].身份证==''){
															sfz='';
														}else{
															sfz=jsonData[i].身份证;
														}
														var str = "<li id='list' class='mui-table-view-cell mui-media'>" +
																"<a href='javascript:;'>" +
																/*"<div class=' mui-pull-right'>" +
																 "</div>" +*/
																"<div class='mui-media-body  maintext' >" +
																"<p  class='mui-ellipsis'>" +
																"<table style='font-size: 14px;color: grey;'>" +
																"<tr><td>所属街道:</td><td>"+jsonData[i].街道+"</td></tr>" +
																"<tr><td>行医人姓名:</td><td>"+jsonData[i].姓名+"</td></tr>" +
																"<tr><td>地址:</td><td>"+jsonData[i].执业地址+"</td></tr>" +
																"<tr><td>专业:</td><td>"+jsonData[i].从事专业+"</td></tr>" +
																"<tr><td>身份证:</td><td>"+sfz+"</td></tr>" +
																"<tr><td>上报时间:</td><td>"+jsonData[i].上报时间.substring(0,19)+"</td></tr>" +
																"<tr><td>巡查员手机:</td><td>"+jsonData[i].MOBILE+"</td></tr>" +
																"</table>" +
																"</p>"+
																/*"<p  class='mui-ellipsis'>所属街道:" + jsonData[i].街道 + "</p>" +
																"<p  class='mui-ellipsis'>行医人姓名:" + jsonData[i].姓名 + "</p>" +
																"<p  class='mui-ellipsis'>地址:" + jsonData[i].执业地址 + "</p>" +
																"<p  class='mui-ellipsis'>专业:" + jsonData[i].从事专业 + "</p>" +
																"<p  class='mui-ellipsis' >身份证:" + jsonData[i].身份证 + "</p>" +
																"<p  class='mui-ellipsis' >上报时间:" + jsonData[i].上报时间 + "</p>" +
																"<p  class='mui-ellipsis' >巡查员手机:" + jsonData[i].MOBILE + "</p>" +*/
																"</div>" +
																"</a>" +
																"</li>";
														$("#newDataUlFind").append(str);
													}
							break;
						case "totalInfoCity":{

							var xfs=0;
							var ybc=0;
							var xcy=0;
							for(var i=0;i<jsonData.length;i++){
								if(jsonData[i].街道.toString()==""){
									var table="<li class='mui-table-view-cell mui-media'>"+
											"<div class='mui-media-body'>"+
											"<span style='font-size: 16px'>未匹配</span>"+
											"<p class='mui-ellipsis'style='margin-left: 22%'><table style='margin-left: 22%;font-size: 14px;color: grey;border-collapse:collapse;width: 100%'>" +
											"<tr>" +
											"<td style='width: 40%'>下发数:"+jsonData[i].下发数.toString()+"</td>" +
											"<td style='border:80px'>已巡查:"+jsonData[i].已排查.toString()+"</td>" +
											"</tr>" +
											"<tr>" +
                                        	"<td style='width: 40%'>巡查率:"+(jsonData[i].已排查/jsonData[i].下发数*100).toFixed(1)+"%</td>" +
											"<td style='border:80px'>巡查员发现:0</td>" +
											"</tr>" +
											"</table></p>"+
											"</div>"+
											"</li>";
									$("#tablebody").append(table);
								}else{
									var table="<li class='mui-table-view-cell mui-media'>"+
											"<div class='mui-media-body'>"+
											"<span style='font-size: 16px'>区域:"+jsonData[i].街道.toString()+"</span>"+
											"<p class='mui-ellipsis'style='margin-left: 22%'><table style='margin-left: 22%;font-size: 14px;color: grey;border-collapse:collapse;width: 100%'>" +
											"<tr>" +
											"<td style='width: 40%'>下发数:"+jsonData[i].下发数.toString()+"</td>" +
											"<td style='border:80px'>已巡查:"+jsonData[i].已排查.toString()+"</td>" +
											"</tr>" +
											"<tr>" +
                                        	"<td style='width: 40%'>巡查率:"+(jsonData[i].已排查/jsonData[i].下发数*100).toFixed(1)+"%</td>" +
											"<td style='border:80px'>巡查员发现:"+jsonData[i].巡查员发现.toString()+"</td>" +
											"</tr>" +
											"</table></p>"+
											"</div>"+
											"</li>";
									$("#tablebody").append(table);
								}
								xfs+=jsonData[i].下发数-0;
								ybc+=jsonData[i].已排查-0;
								xcy+=jsonData[i].巡查员发现-0;
							}
							/*var table = "<tr><td>合计</td>"+
							 "<td>"+xfs+"</td>"+
							 "<td>"+ybc+"</td>"+
							 "<td>"+(ybc/xfs*100).toFixed(1)+"%</td>" +
							 "<td>"+xcy+"</td>" +
							 "</tr>";*/
							var table="<li class='mui-table-view-cell mui-media'>"+
									"<div class='mui-media-body'>"+
									"<span style='font-size: 16px'>合计</span>"+
									"<p class='mui-ellipsis'style='margin-left: 22%'><span>下发数:"+xfs+" </span><span style='margin-left: 30%'>已巡查:"+ybc+"</span></p>"+
									"<p class='mui-ellipsis'style='margin-left: 22%'><span>巡查率:"+(ybc/xfs*100).toFixed(1)+"%</span><span style='margin-left: 22%'>巡查员发现:"+xcy+"</span></p>"+
									"</div>"+
									"</li>";
							var table="<li class='mui-table-view-cell mui-media'>"+
									"<div class='mui-media-body'>"+
									"<span style='font-size: 16px'>合计</span>"+
									"<p class='mui-ellipsis'style='margin-left: 22%'><table style='margin-left: 22%;font-size: 14px;color: grey;border-collapse:collapse;width: 100%'>" +
									"<tr>" +
									"<td style='width: 40%'>下发数:"+xfs+"</td>" +
									"<td style='border:80'>已巡查:"+ybc+"</td>" +
									"</tr>" +
									"<tr>" +
									"<td style='width: 40%'>巡查率:"+(ybc/xfs*100).toFixed(1)+"%</td>" +
									"<td style='border:80px'>巡查员发现:"+xcy+"</td>" +
									"</tr>" +
									"</table></p>"+
									"</div>"+
									"</li>";
							$("#tablebody").append(table);
							break
						}
						case "totalInfoArea":
							// var xfs=0;
							// var ybc=0;
							// var xcy=0;
							/* for(var i=0;i<jsonData.length;i++){
								var table = "<tr><td>"+jsonData[i].COUNTYSSTRING.toString()+"</td>"+
										"<td>"+jsonData[i].下发数.toString()+"</td>"+
										"<td>"+jsonData[i].已排查.toString()+"</td>"+
										"<td>"+jsonData[i].未排查.toString()+"</td></tr>";
								$("#tablebody").append(table);
							} */

							/* for(var i=0;i<jsonData.length;i++){
								if(jsonData[i].STREET.toString()==""){
									var table = "<tr><td>未匹配</td>"+
									"<td>"+jsonData[i].下发数.toString()+"</td>"+
									"<td>"+jsonData[i].已排查.toString()+"</td>"+
									"<td>"+jsonData[i].巡查率.toString()+"</td>" +
									"<td>0</td>" +
									"</tr>";
									$("#tablebody").append(table);
									}else{
									var table = "<tr><td>"+jsonData[i].STREET.toString()+"</td>"+
									"<td>"+jsonData[i].下发数.toString()+"</td>"+
									"<td>"+jsonData[i].已排查.toString()+"</td>"+
									"<td>"+jsonData[i].巡查率.toString()+"</td>" +
									"<td>"+jsonData[i].巡查员发现.toString()+"</td>" +
									"</tr>";
									$("#tablebody").append(table);
										}
									xfs+=jsonData[i].下发数-0;
									ybc+=jsonData[i].已排查-0;
									xcy+=jsonData[i].巡查员发现-0;
									}
									var table = "<tr><td>合计</td>"+
									"<td>"+xfs+"</td>"+
									"<td>"+ybc+"</td>"+
									"<td>"+(ybc/xfs*100).toFixed(1)+"%</td>" +
									"<td>"+xcy+"</td>" +
									"</tr>";
									$("#tablebody").append(table);
									getListDistrictInfo(districtcode); */

									var xfs=0;
									var ybc=0;
									var xcy=0;
									for(var i=0;i<jsonData.length;i++){
										if(jsonData[i].STREET.toString()==""){
											var table="<li class='mui-table-view-cell mui-media'>"+
													"<div class='mui-media-body'>"+
													"<span style='font-size: 16px'>未匹配</span>"+
													"<p class='mui-ellipsis'style='margin-left: 22%'><table style='margin-left: 22%;font-size: 14px;color: grey;border-collapse:collapse;width: 100%'>" +
													"<tr>" +
													"<td style='width: 40%'>下发数:"+jsonData[i].下发数.toString()+"</td>" +
													"<td style='border:80px'>已巡查:"+jsonData[i].已排查.toString()+"</td>" +
													"</tr>" +
													"<tr>" +
                                                	"<td style='width: 40%'>巡查率:"+(jsonData[i].已排查/jsonData[i].下发数*100).toFixed(1)+"%</td>" +											"<td style='border:80px'>巡查员发现:0</td>" +
													"<td style='border:80px'>巡查员发现:0</td>" +
													"</tr>" +
													"</table></p>"+
													"</div>"+
													"</li>";
												$("#tablebody").append(table);
										}else{
											var table="<li class='mui-table-view-cell mui-media'>"+
													"<div class='mui-media-body'>"+
													"<span style='font-size: 16px'>区域:"+jsonData[i].STREET.toString()+"</span>"+
													"<p class='mui-ellipsis'style='margin-left: 22%'><table style='margin-left: 22%;font-size: 14px;color: grey;border-collapse:collapse;width: 100%'>" +
													"<tr>" +
													"<td style='width: 40%'>下发数:"+jsonData[i].下发数.toString()+"</td>" +
													"<td style='border:80px'>已巡查:"+jsonData[i].已排查.toString()+"</td>" +
													"</tr>" +
													"<tr>" +
                                                	"<td style='width: 40%'>巡查率:"+(jsonData[i].已排查/jsonData[i].下发数*100).toFixed(1)+"%</td>" +
													"<td style='border:80px'>巡查员发现:"+jsonData[i].巡查员发现.toString()+"</td>" +
													"</tr>" +
													"</table></p>"+
													"</div>"+
													"</li>";
												$("#tablebody").append(table);
											}
												xfs+=jsonData[i].下发数-0;
												ybc+=jsonData[i].已排查-0;
												xcy+=jsonData[i].巡查员发现-0;
										}
														/*var table = "<tr><td>合计</td>"+
																"<td>"+xfs+"</td>"+
																"<td>"+ybc+"</td>"+
																"<td>"+(ybc/xfs*100).toFixed(1)+"%</td>" +
																"<td>"+xcy+"</td>" +
																"</tr>";*/
											var table="<li class='mui-table-view-cell mui-media'>"+
													"<div class='mui-media-body'>"+
													"<span style='font-size: 16px'>合计</span>"+
													"<p class='mui-ellipsis'style='margin-left: 22%'><span>下发数:"+xfs+" </span><span style='margin-left: 30%'>已巡查:"+ybc+"</span></p>"+
													"<p class='mui-ellipsis'style='margin-left: 22%'><span>巡查率:"+(ybc/xfs*100).toFixed(1)+"%</span><span style='margin-left: 22%'>巡查员发现:"+xcy+"</span></p>"+
													"</div>"+
													"</li>";
											var table="<li class='mui-table-view-cell mui-media'>"+
													"<div class='mui-media-body'>"+
													"<span style='font-size: 16px'>合计</span>"+
													"<p class='mui-ellipsis'style='margin-left: 22%'><table style='margin-left: 22%;font-size: 14px;color: grey;border-collapse:collapse;width: 100%'>" +
													"<tr>" +
													"<td style='width: 40%'>下发数:"+xfs+"</td>" +
													"<td style='border:80'>已巡查:"+ybc+"</td>" +
													"</tr>" +
													"<tr>" +
													"<td style='width: 40%'>巡查率:"+(ybc/xfs*100).toFixed(1)+"%</td>" +
													"<td style='border:80px'>巡查员发现:"+xcy+"</td>" +
													"</tr>" +
													"</table></p>"+
													"</div>"+
													"</li>";
												$("#tablebody").append(table);
												// getListDistrictInfo(districtcode);
							break;
						case "totalInfoArea1":
							for(var i=0;i<jsonData.length;i++){
								var table = "<tr><td>"+jsonData[i].TOWN.toString()+"</td>"+
										"<td>"+jsonData[i].下发数.toString()+"</td>"+
										"<td>"+jsonData[i].已排查.toString()+"</td>"+
										"<td>"+jsonData[i].未排查.toString()+"</td></tr>";
								$("#tablebody1").append(table);
							}
							break;
						case "totalInfo1":
							for(var i=0;i<jsonData.length;i++){
								var table = "<tr><td>"+jsonData[i].TOWN.toString()+"</td>"+
										"<td>"+jsonData[i].下发数.toString()+"</td>"+
										"<td>"+jsonData[i].已排查.toString()+"</td>"+
										"<td>"+jsonData[i].未排查.toString()+"</td></tr>";
								$("#tablebody1").append(table);
							}
							break;
						case "updateRead":
                            getListDistrictInfo(districtcode);
						    break;
						default:
							break;
					}

				}
			}

			function jdchange(){
				$("#tablebody").html('');
				if(Select_GetSelectText("select_jd") == "全部"){
					document.getElementById("tablebody").innerHTML="";
					totalInfoArea("全部");
					getListDistrictInfo(districtcode);
				}else{
					document.getElementById("tablebody").innerHTML="";
					totalInfo(Select_GetSelectValue("select_jd"));
				}

			}
			function totalInfoArea() {
                var datet = new Date();
                var monthstr = datet.getMonth()+1;
                var monthstr1 = "";
                if(monthstr=="1" ||monthstr=="2" ||monthstr=="3" ){
                    monthstr1="1,2,3"
                }
                if(monthstr=="4" ||monthstr=="5" ||monthstr=="6" ){
                    monthstr1="4,5,6"
                }
                if(monthstr=="7" ||monthstr=="8" ||monthstr=="9" ){
                    monthstr1="7,8,9"
                }
                if(monthstr=="10" ||monthstr=="11" ||monthstr=="12" ){
                    monthstr1="10,11,12"
                }
                var where = "";
                var where1="";
                if(monthstr=='1' || monthstr=='2' || monthstr=='3'){
                    where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/01' and '"+datet.getFullYear()+"/03'";
                }else if(monthstr=='4' || monthstr=='5' ||monthstr=='6'){
                    where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/04' and '"+datet.getFullYear()+"/06'";
                }
                else if(monthstr=='7' || monthstr=='8' ||monthstr=='9'){
                    where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/07' and '"+datet.getFullYear()+"/09'";
                }else if(monthstr=='10' ||monthstr=='11' ||monthstr=='12'){
                    where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/10' and '"+datet.getFullYear()+"/12'";
                }
                var strSql ="select aa.STREET,aa.下发数,NVL(bb.已排查,0) 已排查,round(NVL(bb.已排查, 0)/NVL(aa.下发数, 0),3)*100 || '%' 巡查率,NVL(巡查员发现,0) 巡查员发现 from ( "+
                    "select count(1) 下发数,t.STREETID 街道编码,t.STREET from view_巡检 t where t.sendyear='"+new Date().getFullYear()+"' " +
                    "and t.sendmonth in ("+datet.getMonth()+","+monthstr+","+monthstr1+") and t.county like '"+districtcode+"%' group by t.STREET,t.STREETID) aa "+
                    //"and t.sendmonth in (1,2,3) and t.county like '"+districtcode+"%' group by t.STREET,t.STREETID) aa "+
                    "left join (select count(1) 已排查,t.STREETID 街道编码 from (select distinct(t.一户一档id) from 巡检状态 t ) aa left join view_巡检 t on  t.id=aa.一户一档id "+
                    "where t.sendyear='"+new Date().getFullYear()+"' and t.county like '"+districtcode+"%' and t.sendmonth in ("+monthstr1+") group by t.STREETID) bb "+
                    //"where t.sendyear='"+new Date().getFullYear()+"' and t.county like '"+districtcode+"%' and t.sendmonth in (1,2,3) group by t.STREETID) bb "+
                    "on aa.街道编码=bb.街道编码 " +
                    " left join (select yy.街道 ,count(yy.街道) 巡查员发现  from 巡检新增 yy "+where1+" group by yy.街道) cc on aa.STREET=cc.街道 order by aa.STREET";
                new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"totalInfoArea");

			}
			function totalInfoCity() {
				var datet = new Date();
                var monthstr = datet.getMonth()+1;
                var monthstr1 = "";
                if(monthstr=="1" ||monthstr=="2" ||monthstr=="3" ){
                    monthstr1="1,2,3"
                }
                if(monthstr=="4" ||monthstr=="5" ||monthstr=="6" ){
                    monthstr1="4,5,6"
                }
                if(monthstr=="7" ||monthstr=="8" ||monthstr=="9" ){
                    monthstr1="7,8,9"
                }
                if(monthstr=="10" ||monthstr=="11" ||monthstr=="12" ){
                    monthstr1="10,11,12"
                }
				var where = "";
				var where1="";
				if(monthstr=='1' || monthstr=='2' || monthstr=='3'){
					where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/01' and '"+datet.getFullYear()+"/03'";
				}else if(monthstr=='4' || monthstr=='5' ||monthstr=='6'){
					where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/04' and '"+datet.getFullYear()+"/06'";
				}
				else if(monthstr=='7' || monthstr=='8' ||monthstr=='9'){
					where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/07' and '"+datet.getFullYear()+"/09'";
				}else if(monthstr=='10' ||monthstr=='11' ||monthstr=='12'){
					where1=" where  to_char(yy.上报时间,'yyyy/mm') between '"+datet.getFullYear()+"/10' and '"+datet.getFullYear()+"/12'";
				}
				var strSql ="select aa.街道,aa.下发数,NVL(bb.已排查,0) 已排查,round(NVL(bb.已排查, 0)/NVL(aa.下发数, 0),3)*100 || '%' 巡查率,NVL(巡查员发现,0) 巡查员发现 from ( "+
						"select count(1) 下发数,t.COUNTYSSTRING 街道 ,t.COUNTY from view_巡检 t where t.sendyear='"+new Date().getFullYear()+"' " +
						"and t.sendmonth in ("+datet.getMonth()+","+monthstr+","+monthstr1+")   group by t.COUNTYSSTRING,t.COUNTY) aa "+
						"left join (select count(1) 已排查,t.county 街道编码 from (select distinct(t.一户一档id) from 巡检状态 t ) aa left join view_巡检 t on  t.id=aa.一户一档id "+
						"where t.sendyear='"+new Date().getFullYear()+"'  and t.sendmonth in ("+monthstr1+") group by t.county) bb "+
						"on aa.county=bb.街道编码 " +
						" left join (select yy.区县 ,count(yy.区县) 巡查员发现  from 巡检新增 yy "+where1+" group by yy.区县) cc on '%'||aa.county||'%' like cc.区县 order by aa.county";
				new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"totalInfoCity");
			}
			function totalInfo(street){
				var where = "";
				if(street == "全部"){
					where = " and streetid like '"+districtcode+"%'";
				}else{
					where = " and streetid like '"+street+"%'";
				}
				/* var strSql = "select aa.*,NVL(bb.已排查,0) 已排查,NVL(aa.下发数,0)-NVL(bb.已排查,0) 未排查 from (select count(1) 下发数,aa.town 所属街道,aa.towncode from (select streetid,town,towncode from view_巡检 t left join 系统用户信息表 x on t.streetid=x.towncode where t.sendyear='"+new Date().getFullYear()+"' "+where+") aa group by aa.town,aa.towncode) aa"+
						" left join "+
						" (select count(1) 已排查,x.town 所属街道 from (select distinct(t.一户一档id) from 巡检状态 t ) aa left join view_巡检 t on t.id=aa.一户一档id   left join 系统用户信息表 x on t.streetid=x.towncode where t.sendyear='"+new Date().getFullYear()+"' "+where+" group by x.town ) bb"+
						" on aa.所属街道=bb.所属街道 order by aa.towncode asc"; */
				var strSql = "select aa.*,NVL(bb.已排查,0) 已排查,NVL(aa.下发数,0)-NVL(bb.已排查,0) 未排查 from (select count(1) 下发数,aa.town 所属街道,aa.towncode from (select streetid,town,towncode from view_巡检 t left join 系统用户信息表 x on t.streetid=x.towncode where t.sendyear='"+new Date().getFullYear()+"' "+where+") aa group by aa.town,aa.towncode) aa"+
									" left join "+
									" (select count(1) 已排查,x.town 所属街道 from (select distinct(t.一户一档id) from 巡检状态 t ) aa left join view_巡检 t on t.id=aa.一户一档id   left join 系统用户信息表 x on t.streetid=x.towncode where t.sendyear='"+new Date().getFullYear()+"' "+where+" group by x.town ) bb"+
									" on aa.所属街道=bb.所属街道 order by aa.towncode asc";
				new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"totalInfo");
			}
			function jdchange1(){
				/* $("#tablebody1").html('');
				if(Select_GetSelectText("select_jd1") == "全部"){
					document.getElementById("tablebody1").innerHTML="";
					totalInfoArea1("全部");
				}else{
					document.getElementById("tablebody1").innerHTML="";
					totalInfo1(Select_GetSelectValue("select_jd1"));
				} */

						$("#tablebody1").html('');
						if(Select_GetSelectText("select_jd1") == "全部"){
						document.getElementById("tablebody1").innerHTML="";
						totalInfoArea1("全部");
						}else{
						document.getElementById("tablebody1").innerHTML="";
						totalInfo1(Select_GetSelectValue("select_jd1"));
						}
			}

			function totalInfoArea1() {
				var datet = new Date();
				var monthstr = datet.getMonth()+1;
				var where = "";

				/* var strSql ="select t.下发数,y.town,NVL(t1.已排查,0) 已排查,NVL(t.下发数,0)-NVL(t1.已排查,0) 未排查 from (select count(*) 下发数,a.所属区县代码 from 系统推送信息 a where 1=1 "+

							"and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate group by a.所属区县代码) t "+
							"left join (select count(a.所属区县代码) 已排查,a.所属区县代码 from JSWGISDATA.系统推送信息 a "+
							"left join (select distinct t.一户一档id  from 巡检状态 t "+
							"where 1 = 1 and t.时间 between ADD_MONTHS(sysdate, -2) and sysdate  ) aa on a.id = aa.一户一档id "+
							"where 1 = 1 and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate  group by a.所属区县代码 "+
							") t1  on t.所属区县代码=t1.所属区县代码 "+
							"left join (select distinct(t.district) town,t.districtcode countysstring from 系统用户信息表 t where t.districtcode !='310' order by districtcode) y "+
							"on t.所属区县代码=y.countysstring"; */

					var strSql ="select t.下发数,y.town,NVL(t1.已排查,0) 已排查,NVL(t.下发数,0)-NVL(t1.已排查,0) 未排查 from (select count(*) 下发数,a.所属区县代码 from 系统推送信息 a where 1=1 "+
									"and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate group by a.所属区县代码) t "+
									"left join (select count(a.所属区县代码) 已排查,a.所属区县代码 from 系统推送信息 a "+
									"left join (select distinct t.一户一档id  from 巡检状态 t "+
									"where 1 = 1 and t.时间 between ADD_MONTHS(sysdate, -2) and sysdate  ) aa on a.id = aa.一户一档id "+
									"where 1 = 1 and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate  group by a.所属区县代码 "+
									") t1  on t.所属区县代码=t1.所属区县代码 "+
									"left join (select distinct(t.district) town,t.districtcode countysstring from 系统用户信息表 t where t.districtcode !='310' order by districtcode) y "+
									"on t.所属区县代码=y.countysstring";
				new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"totalInfoArea1");
			}
			function totalInfo1(street){
				var where = "";
				/* if(street == "全部"){
					where = " and streetid like '"+districtcode+"%'";
				}else{
					where = " and 所属街道代码 like '"+street+"%' ";
				} */
				if(street == "全部"){
					where = " and streetid like '"+districtcode+"%'";
				}else{
					where = " and 所属街道代码 like '"+street+"%' ";
				}
				/* var strSql ="select t.下发数,y.town,NVL(t1.已排查,0) 已排查,NVL(t.下发数,0)-NVL(t1.已排查,0) 未排查 from (select count(*) 下发数,a.所属街道代码 from 系统推送信息 a where 1=1 "+

							"and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate  "+where+" group by a.所属街道代码) t "+
							"left join (select count(a.所属街道代码) 已排查,a.所属街道代码 from JSWGISDATA.系统推送信息 a "+
							"left join (select distinct t.一户一档id  from 巡检状态 t "+
							"where 1 = 1 and t.时间 between ADD_MONTHS(sysdate, -2) and sysdate  ) aa on a.id = aa.一户一档id "+
							"where 1 = 1 and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate  "+where+" group by a.所属街道代码 "+
							") t1  on t.所属街道代码=t1.所属街道代码 "+
							"left join (select distinct(t.town) town,t.towncode  from 系统用户信息表 t where t.districtcode !='310'  order by t.towncode) y "+
							"on t.所属街道代码=y.towncode"; */

				var strSql ="select t.下发数,y.town,NVL(t1.已排查,0) 已排查,NVL(t.下发数,0)-NVL(t1.已排查,0) 未排查 from (select count(*) 下发数,a.所属街道代码 from 系统推送信息 a where 1=1 "+
									"and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate  "+where+" group by a.所属街道代码) t "+
									"left join (select count(a.所属街道代码) 已排查,a.所属街道代码 from 系统推送信息 a "+
									"left join (select distinct t.一户一档id  from 巡检状态 t "+
									"where 1 = 1 and t.时间 between ADD_MONTHS(sysdate, -2) and sysdate  ) aa on a.id = aa.一户一档id "+
									"where 1 = 1 and a.推送时间 between  ADD_MONTHS(sysdate,-2) and sysdate  "+where+" group by a.所属街道代码 "+
									") t1  on t.所属街道代码=t1.所属街道代码 "+
									"left join (select distinct(t.town) town,t.towncode  from 系统用户信息表 t where t.districtcode !='310'  order by t.towncode) y "+
									"on t.所属街道代码=y.towncode";

				new WsCommonClass("QueryDataBaseJson",["sql"],[strSql],querySuccess,"totalInfo1");
			}
			function conditionSearch(){
				// if( role=="1"){
				// 	mui.alert('模块更新中 敬请期待!!!', '系统提示', function() {});
				// }else{
				// 	mui("#popover").popover('toggle', document.getElementById("ta"));
				// }
				mui("#popover").popover('toggle', document.getElementById("ta"));
			}
			function conclusionPopover(id) {
				var sql="select  t.时间,y.状态,y1.WHETHERINSCENE 现场查见," +
					"INTERNALMEDICINE 内科,DENTAL 牙科,MEDICAKBEAUTY 医美," +
					"MEDICINEOTHER 其他,MEDICINEOTHERCONTENT 内容  from 巡检状态 t " +
					"left join  编码表巡检状态 y on t.状态=y.id " +
					"left join PATROLSTATUS y1 on t.id=y1.PATROLSTATUSID where t.一户一档id="+id;
				new WsCommonClass("QueryDataBaseJson",["sql"],[sql],querySuccess,"queryConclusion");
			}
			function onclickRead(id) {
                    mui.confirm('是否已读','提示',['取消','确定'],function (e) {
                        if(e.index==1){
                            var sql="update 一户一档 t set t.read=1 where id="+id;
                            new WsCommonClass("QueryDataBaseJson",["sql"],[sql],querySuccess,"updateRead");
                        }else{
                            return
                        }
                    });
            }
			function closeSearch() {
			    // if( role=="2"){
				if( role=="2" || role=="1"){
                    getListDistrictInfo('');
				}else if(role=="21" || role=="3"){
                    getListInfo('');
				}

				mui('#popover').popover('hide');
			}
			function changePass(){
				window.location="changePass.html?date="+getDateStr();
			}

			function help(){
				window.location="help.html?date="+getDateStr();
			}

		</script>
	</head>

<body>


		<header class="mui-bar mui-bar-nav" style="height: 3.75rem;">
			<div style="float: left;margin-top: 0.6rem;margin-left:-0.4375rem;">
				<input type="text" id="towninfo"  class="mui-input-clear" placeholder="青浦区/华新镇" style="width: 8.75rem;" disabled="disabled">
			</div>
			<div id="total" style="margin-top: 1.3rem;margin-left: 0.3rem;width:4.6875rem;float: left;font-size: 15px">
				 总计0条
			</div>
			<div class="headimg">
				<img onclick="conditionSearch()" src="assets/image/sousuo.png" />
			</div>
			<div class="headimg">
				<img onclick="help()"  src="assets/image/help.png"/>
			</div>
			<div class="headimg" >
				<img onclick="changePass()" src="assets/image/update.png"/>
			</div>
		</header>
		<div class="maincontent">
			<div style="padding: 10px 10px;display:none" id="div_totalcon" >
				<div id="segmentedControl" class="mui-segmented-control">
					<a class="mui-control-item mui-active" href="#item1">任务清单</a>
					<a class="mui-control-item" href="#item2">完成情况</a>
					<a class="mui-control-item" href="#item3">巡查员发现</a>
				</div>
			</div>
			<div id="item1" class="mui-control-content mui-active" style="padding-bottom: 3.125rem;">
				<ul class="mui-table-view" id="newDataUl"></ul>
			</div>
			<div id="item2" class="mui-control-content" style="padding-left: 0.3125rem;padding-right: 0.3125rem;padding-bottom: 3.125rem">
				<!-- <select id="select_jd" onchange="jdchange()"  ></select> -->
			<ul width="100%" id="tablebody" class="mui-table-view" style="line-height:25px;"></ul>
				<!-- <table width="100%" class="table" id="tablevalue">
					<tr>
						<th width=40%>区域</th>
						<th width=20%>下发数</th>
						<th width=20%>已巡查</th>
						<th width=20%>巡查率</th>
						<th width=20%>巡查员发现</th>
					</tr>
					<tbody id="tablebody"></tbody>
				</table> -->
			</div>
			<div id="item3" class="mui-control-content" style="padding-left: 0.3125rem;padding-right: 0.3125rem;padding-bottom: 3.125rem">
				<!-- <select id="select_jd1" onchange="jdchange1()"  ></select> -->
				<ul class="mui-table-view" id="newDataUlFind"></ul>
				<!-- <table width="100%" class="table" id="tablevalue1">
					<tr>
						<th width=40%>区域</th>
						<th width=20%>下发数</th>
						<th width=20%>已排查</th>
						<th width=20%>未排查</th>
					</tr>
					<tbody id="tablebody1"></tbody>
				</table> -->
			</div>
		</div>
		<nav class="mui-bar mui-bar-tab">
			<a href="firstPage.html" id="mainpage" class="mui-tab-item mui-active">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">主页</span>
			</a>
			<a href="projectInfo.html" id="addpage" class="mui-tab-item">
				<span class="mui-icon mui-icon-chatboxes"></span>
				<span class="mui-tab-label">添加</span>
			</a>
			<a href="myInfo.html" id="exit" class="mui-tab-item">
				<span class="mui-icon mui-icon-gear"></span>
				<span class="mui-tab-label">退出</span>
			</a>
		</nav>

		<div id="popover" class="mui-popover " style="height:100px;">
			<form class="mui-input-group" style="border-radius: 8px;">
				<!-- <div class="mui-input-row">
					<label>地址</label>
					<input type="text" class="mui-input-clear" placeholder="请输入地址" id="address">
				</div>
				<div class="mui-input-row">
					<label>姓名</label>
					<input type="text" class="mui-input-clear" placeholder="请输入姓名" id="name">
				</div>
				<div class="mui-button-row">
					<button type="button" class="mui-btn mui-btn-primary" onclick="closeSearch('')">确认</button>
				</div> -->

					<div class="mui-input-row" id="streetDiv">
						<label>街镇</label>
						<select id="select_street"   ></select>
					</div>
					<div class="mui-input-row">
						<label>任务来源</label>
						<select id="select_source"  >
							<option value="0">全部</option>
							<option value="1">一户一档</option>
							<option value="2">迁移比对</option>
							<option value="3">既往未巡查</option>
							<option value="4">其他</option>
							<option value="5">区所新增</option>
						</select>
					</div>
					<div class="mui-input-row">
						<label>是否巡查</label>
						<select id="select_patrol"  >
							<option value="-1">全部</option>
							<option value="0">已巡查</option>
							<option value="1">未巡查</option>
						</select>
					</div>
					<div class="mui-input-row">
						<label>巡查结论</label>
						<select id="select_conclusion" ></select>
					</div>
					<div class="mui-button-row">
						<button type="button" class="mui-btn mui-btn-primary" onclick="closeSearch('')">确认</button>
					</div>

			</form>

		</div>
		<div id="conclusionpopover" class="mui-popover " style="height:100px;">
			<form class="mui-input-group" style="border-radius: 8px;" id="newDataUl1">

			</form>

		</div>
		<nav class="mui-bar mui-bar-tab" style="margin: 0 auto;margin-bottom: 100%;border: #6641E2;width: 0px;height: 0px;" id="ta">
		</nav>
	</body>
</html>