zoukankan      html  css  js  c++  java
  • 2021/3/15

    1.今日收获内容
    按班级查出

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="46dp"
            android:text="班级:"
            android:textSize="30dp" />
    
        <EditText
            android:id="@+id/edit_66"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:hint="请输入班级"/>
    
        <Button
            android:id="@+id/button6"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Button" />
    
        <TextView
            android:id="@+id/nn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="15dp"/>
    
    
    
    </LinearLayout>
    package com.example.myapplication2;
    
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.widget.EditText;
    import android.widget.TextView;
    
    import androidx.annotation.Nullable;
    import androidx.appcompat.app.AppCompatActivity;
    
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    public class chakan extends AppCompatActivity implements View.OnClickListener{
        private DatabaseHelper dbHelper;
        private DatabaseHelper2 dbHelper2;
        private EditText editText66;
        private TextView tv;
        int m=0;
        int n1=0,n2=0,n3=0;
        String k="";
        double j;
        String h="";
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_chakan2);
    
            tv=(TextView)findViewById(R.id.nn);
    
            editText66 = (EditText) findViewById(R.id.edit_66);
    
            m3();
    
        }
    
        private void m3() {
            findViewById(R.id.button6).setOnClickListener(this);
        }
    
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.button6://执行按钮1
    
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");// HH:mm:ss
                    //获取当前时间
                    Date date = new Date(System.currentTimeMillis());
                    k=simpleDateFormat.format(date);
    
    
                    String mm=editText66.getText().toString();
                    dbHelper2=new DatabaseHelper2(this,"TTList2.db",null,3);
                    SQLiteDatabase db=dbHelper2.getWritableDatabase();
                    Cursor cursor=db.query("TTList2",null,"班级=?",new String[]{mm},
                            null,null,null);//读取数据库里面专业是软件工程的所有信息
                    if(cursor.moveToFirst()){
                        do{
                            String name=cursor.getString(cursor.getColumnIndex("姓名"));
    
                            dbHelper=new DatabaseHelper(this,"TTList3.db",null,3);
                            SQLiteDatabase db2=dbHelper.getWritableDatabase();
                            Cursor cursor2 = db2.query("TTList3", null, "姓名=?", new String[]{name}, null, null, null);//读取数据库所有信息
                            // Cursor cursor=db.query("tt",null,"专业=?",new String[]{"软件工程"},
                            //null,null,null);//读取数据库里面专业是软件工程的所有信息
                            if(cursor2.moveToFirst()){
                                do{
                                    Log.i("chakan","ss");
                                    String time=cursor2.getString(cursor2.getColumnIndex("日期时间"));
                                    String str = time.substring(0, time.indexOf(" "));
                                    Log.i("chakan",str);
                                    Log.i("chakan",k);
                                    if(str.equals(k)) {
                                        String tt = cursor2.getString(cursor2.getColumnIndex("体温"));
                                        j = Double.parseDouble(tt);
                                        n1++;
                                        if (j < 37.3 &&j > 35) {
                                            n2++;
                                        } else {
                                            n3++;
                                        }
                                    }
                                }while (cursor2.moveToNext());
                            }
                            cursor2.close();
                            m++;
                        }while (cursor.moveToNext());
                    }
                    cursor.close();
    
    
    
    
    
    
    
                    h="(体温t,35.0<t<37.3正常)
    "+k+"
    "+"一共"+String.valueOf(m)+"人
    正常上报"+String.valueOf(n2)+"人,体温异常"+String.valueOf(n3)+"人,未上报体温"+String.valueOf(m-n1)+"";
    
                    tv.setText(h);//打印信息
    
            }
        }
    }



    2.遇到的问题

    班级里是否填写调出,同一个人写两次就出问题
    3.明天目标

    解决问题

  • 相关阅读:
    avalon ms-repeat avalon1
    抓取各个浏览器引擎关键字,,百度学术关键字
    JS中Float类型加减乘除 修复
    js jquery 权限单选 bug修改以及正确代码 购物车数量加减
    图片加载错误默认显示图片
    文本框中焦点竖杆长度控制
    Go语言中 Print,Println 和 Printf 的区别(八)
    typescript中新增的基本数据类型
    尝试自己搭一个简单的typescript运行环境
    Go语言流程控制中的break,continue和goto(七)
  • 原文地址:https://www.cnblogs.com/qiangini/p/14905786.html
Copyright © 2011-2022 走看看