2024/5/3(冲刺第七天)

 所学时间:2小时

代码行数:150

博客园数:1篇

所学知识:加班第二天

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".check_in"
android:orientation="vertical">


<EditText
android:id="@+id/blood_pressure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="血压"
android:padding="16dp"
android:layout_margin="16dp"/>

<EditText
android:id="@+id/blood_suger"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="血糖"
android:padding="16dp"
android:layout_margin="16dp"/>

<EditText
android:id="@+id/blood_oxygen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="血氧"
android:padding="16dp"
android:layout_margin="16dp"/>

<EditText
android:id="@+id/blood_lipids"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="血脂"
android:padding="16dp"
android:layout_margin="16dp"/>

<EditText
android:id="@+id/heart_rate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="心率"
android:padding="16dp"
android:layout_margin="16dp"/>

<Button
android:id="@+id/check_in_Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="打卡"
android:backgroundTint="@color/green"
android:textColor="@android:color/white"
android:padding="16dp"
android:layout_margin="16dp"/>

</LinearLayout>
package com.example.kanglaojian;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class check_in extends AppCompatActivity {
private EditText blood_pressure,blood_suger,blood_oxygen,blood_lipids,heart_rate;

private Button check_in_Button;
private String str_blood_pressure,str_blood_suger,str_blood_oxygen,str_blood_lipids,str_heart_rate;
private String blood_pressure_case,blood_suger_case,blood_oxygen_case,blood_lipids_case,heart_rate_case;
private String health_status,health_status_case;
private MySQLConnector mySQLConnector;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_check_in);
blood_pressure = findViewById(R.id.blood_pressure);
blood_suger = findViewById(R.id.blood_suger);
blood_oxygen = findViewById(R.id.blood_oxygen);
blood_lipids = findViewById(R.id.blood_lipids);
heart_rate = findViewById(R.id.heart_rate);
check_in_Button = findViewById(R.id.check_in_Button);

check_in_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
insert_check_in();
}
});
}
private void insert_check_in(){
str_blood_pressure=blood_pressure.getText().toString();
int a1=Integer.parseInt(str_blood_pressure);
if(a1>120){
blood_pressure_case="高";
} else if (a1<80) {
blood_pressure_case="低";
}
str_blood_suger=blood_suger.getText().toString();
int a2=Integer.parseInt(str_blood_suger);
if(a2>120){
blood_pressure_case="高";
} else if (a1<80) {
blood_pressure_case="低";
}
str_blood_oxygen=blood_oxygen.getText().toString();
int a3=Integer.parseInt(str_blood_oxygen);
if(a3>120){
blood_pressure_case="高";
} else if (a1<80) {
blood_pressure_case="低";
}
str_blood_lipids=blood_lipids.getText().toString();
int a4=Integer.parseInt(str_blood_lipids);
if(a4>120){
blood_pressure_case="高";
} else if (a1<80) {
blood_pressure_case="低";
}
str_heart_rate=heart_rate.getText().toString();
int a5=Integer.parseInt(str_heart_rate);
if(a5>120){
blood_pressure_case="高";
} else if (a1<80) {
blood_pressure_case="低";
}
health_status="良好";
try{
Log.e("666666666666666666666","66666666666666666");
mySQLConnector.insert_check_in(str_blood_pressure,blood_pressure_case,str_blood_suger,blood_suger_case,str_blood_oxygen,blood_oxygen_case,str_blood_lipids,blood_lipids_case,str_heart_rate,heart_rate_case,health_status);
Intent intent=new Intent(check_in.this,older.class);
startActivity(intent);
}catch(Exception e){
e.printStackTrace();
}
}
}
posted @ 2024-05-03 18:25  为20岁努力  阅读(10)  评论(0编辑  收藏  举报