diff --git a/app/src/main/java/com/linwankaifa/linwancunyi/bean/PatientBean.java b/app/src/main/java/com/linwankaifa/linwancunyi/bean/PatientBean.java
index 9f5556355650eaff8d1563c55c62333b00e24c00..b51f5d5fbc5133f68fce921d3f4f22a146d25c65 100644
--- a/app/src/main/java/com/linwankaifa/linwancunyi/bean/PatientBean.java
+++ b/app/src/main/java/com/linwankaifa/linwancunyi/bean/PatientBean.java
@@ -115,13 +115,10 @@ public class PatientBean implements Serializable {
this.ismarriage = ismarriage;
}
- public String getIsallergy() {
- return isallergy;
- }
+ public String getIsallergy() {return isallergy;}
+
+ public void setIsallergy(String isallergy) {this.isallergy = isallergy;}
- public void setIsallergy(String isallergy) {
- this.isallergy = isallergy;
- }
public String getAllergens() {
return allergens;
diff --git a/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_hospital.java b/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_hospital.java
index 0572abb17b4977dbf7471ad371635b698b34a6ce..5262f822e2f6ec3c0d12dfda223c90f2aca0f71b 100644
--- a/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_hospital.java
+++ b/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_hospital.java
@@ -1,15 +1,108 @@
package com.linwankaifa.linwancunyi.ui.back;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.Toast;
import com.linwankaifa.linwancunyi.R;
+import com.linwankaifa.linwancunyi.bean.DoctorBean;
+import com.linwankaifa.linwancunyi.bean.HospitalBean;
+import com.linwankaifa.linwancunyi.bean.PatientBean;
+import com.linwankaifa.linwancunyi.helper.Data_whole;
+import com.linwankaifa.linwancunyi.ui.login.log_in;
+import com.linwankaifa.linwancunyi.ui.login.register;
+import com.linwankaifa.linwancunyi.util.JsonTransformation;
+
+import java.io.IOException;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
public class add_hospital extends AppCompatActivity {
+ EditText addhospital;
+ EditText addplace;
+ EditText addjianjie;
+ String SHAREDPREFERENCES_NAME = "shared.xml";
+ SharedPreferences preferences;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_hospital);
+ preferences = getSharedPreferences(SHAREDPREFERENCES_NAME, Context.MODE_PRIVATE);
+
+ addhospital = (EditText) findViewById(R.id.addhospital);
+ addplace = (EditText) findViewById(R.id.addplace);
+ addjianjie = (EditText) findViewById(R.id.addjianjie);
+ }
+ public void addhospitalBtn(View view) {
+ OkHttpClient client = new OkHttpClient();
+
+ RequestBody requestBody = null;
+ String hospital = addhospital.getText().toString();
+ String place = addplace.getText().toString();
+ String jianjie = addjianjie.getText().toString();
+ HospitalBean hospitalen = new HospitalBean();
+ hospitalen.setHospitalname(hospital);
+ hospitalen.setArea(place);
+ hospitalen.setIntroduction(jianjie);
+ requestBody = RequestBody.create(MediaType.parse("text; charset=utf-8"),
+ JsonTransformation.objectToJson(hospitalen));
+ Log.e("dynamic", JsonTransformation.objectToJson(hospitalen));
+
+ String url = "http://49.234.4.35:8080/back/inserthospital";
+
+ Log.e("dynamic", url);
+ Request request = new Request.Builder()
+ .url(url)
+ .post(requestBody)
+ .build();
+ okhttp3.Call call = client.newCall(request);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+ Toast toast = Toast.makeText(getApplicationContext(), "返回失败", Toast.LENGTH_SHORT);
+ toast.show();
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) throws IOException {
+ final String isSuccess = response.body().string();
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+
+ switch (isSuccess) {
+ case "404":
+ Toast.makeText(getApplicationContext(), "该医院已存在", Toast.LENGTH_SHORT).show();
+ break;
+ case "200":
+ Toast.makeText(getApplicationContext(), "添加成功", Toast.LENGTH_SHORT).show();
+ break;
+ default:
+ break;
+ }
+ }
+ });
+
+ }
+ });
+
}
+
+
}
+
diff --git a/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_huati.java b/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_huati.java
index e868d3f1c4133972822f4f5b4303446681d7016d..e980405333261dca7f4b3f7e6daaaf70e24ed4ac 100644
--- a/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_huati.java
+++ b/app/src/main/java/com/linwankaifa/linwancunyi/ui/back/add_huati.java
@@ -1,15 +1,97 @@
package com.linwankaifa.linwancunyi.ui.back;
+import android.content.Context;
+import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.Toast;
import com.linwankaifa.linwancunyi.R;
+import com.linwankaifa.linwancunyi.bean.HospitalBean;
+import com.linwankaifa.linwancunyi.bean.HuatiBean;
+import com.linwankaifa.linwancunyi.util.JsonTransformation;
+
+import java.io.IOException;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
public class add_huati extends AppCompatActivity {
+ EditText addbiaoti;
+ EditText addneirong;
+ String SHAREDPREFERENCES_NAME = "shared.xml";
+ SharedPreferences preferences;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_huati);
+ preferences = getSharedPreferences(SHAREDPREFERENCES_NAME, Context.MODE_PRIVATE);
+
+ addbiaoti = (EditText) findViewById(R.id.addbiaoti);
+ addneirong= (EditText) findViewById(R.id.addneirong);
+ }
+ public void addhuatiBtn(View view) {
+ OkHttpClient client = new OkHttpClient();
+
+ RequestBody requestBody = null;
+ String biaoti = addbiaoti.getText().toString();
+ String neirong = addneirong.getText().toString();
+ HuatiBean huatien = new HuatiBean();
+ huatien.setBriefintroduction(biaoti);
+ huatien.setFabucontent(neirong);
+ requestBody = RequestBody.create(MediaType.parse("text; charset=utf-8"),
+ JsonTransformation.objectToJson(huatien));
+ Log.e("dynamic", JsonTransformation.objectToJson(huatien));
+
+ String url = "http://49.234.4.35:8080/back/inserttopic";
+
+ Log.e("dynamic", url);
+ Request request = new Request.Builder()
+ .url(url)
+ .post(requestBody)
+ .build();
+ okhttp3.Call call = client.newCall(request);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+ Toast toast = Toast.makeText(getApplicationContext(), "返回失败", Toast.LENGTH_SHORT);
+ toast.show();
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) throws IOException {
+ final String isSuccess = response.body().string();
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+
+ switch (isSuccess) {
+ case "404":
+ Toast.makeText(getApplicationContext(), "该话题已存在", Toast.LENGTH_SHORT).show();
+ break;
+ case "200":
+ Toast.makeText(getApplicationContext(), "添加成功", Toast.LENGTH_SHORT).show();
+ break;
+ default:
+ break;
+ }
+ }
+ });
+
+ }
+ });
+
}
+
}
diff --git a/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/PatientHealthCard.java b/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/PatientHealthCard.java
index 148114a10233b8b181ae6e1581f3488e064ad3f6..788d0607eb3436b752443b757da351f1aa742804 100644
--- a/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/PatientHealthCard.java
+++ b/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/PatientHealthCard.java
@@ -2,12 +2,43 @@ package com.linwankaifa.linwancunyi.ui.patient;
import android.app.TabActivity;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
import android.widget.TabHost;
+import android.widget.TextView;
+import android.widget.Toast;
import com.linwankaifa.linwancunyi.R;
+import com.linwankaifa.linwancunyi.bean.HospitalBean;
+import com.linwankaifa.linwancunyi.bean.PatientBean;
+import com.linwankaifa.linwancunyi.util.JsonTransformation;
+
+import java.io.IOException;
+
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
public class PatientHealthCard extends TabActivity {
+ TextView tv_hunying;
+ TextView tv_guomingshi;
+ EditText tv_shengao;
+ EditText tv_tizhong;
+ TextView tv_couyan;
+ TextView tv_yingjiu;
+ TextView tv_yingshi;
+ TextView tv_shuimian;
+ TextView tv_daxiaobian;
+ TextView tv_chuimianyao;
+ String SHAREDPREFERENCES_NAME = "shared.xml";
+ SharedPreferences preferences;
private TabHost mTabHost;
@@ -27,4 +58,72 @@ public class PatientHealthCard extends TabActivity {
mTabHost.addTab(tabSpec1);
mTabHost.addTab(tabSpec2);
}
+ public void addhealthcardBtn(View view) {
+ OkHttpClient client = new OkHttpClient();
+ RequestBody requestBody = null;
+ String shengao =tv_shengao.getText().toString();
+ String tizhong =tv_tizhong.getText().toString();
+ String hunying = tv_hunying.getText().toString();
+ String guomingshi = tv_guomingshi.getText().toString();
+ String couyan = tv_couyan.getText().toString();
+ String yingjiu = tv_yingjiu.getText().toString();
+ String yingshi = tv_yingshi.getText().toString();
+ String shuimian = tv_shuimian.getText().toString();
+ String daxiaobian = tv_daxiaobian.getText().toString();
+ String chuimianyao = tv_chuimianyao.getText().toString();
+
+ PatientBean patient = new PatientBean();
+ if(shengao!=null)
+ patient.setHeight(Integer.parseInt(shengao));
+ if(tizhong!=null)
+ patient.setWeight(Integer.parseInt(tizhong));
+ if(hunying!=null&&guomingshi!=null&&couyan!=null&&yingjiu!=null&&yingshi!=null&&shuimian!=null&&daxiaobian!=null&&chuimianyao!=null) {
+ patient.setIsmarriage(hunying);
+ patient.setIsallergy(guomingshi);
+ }
+
+ requestBody = RequestBody.create(MediaType.parse("text; charset=utf-8"),
+ JsonTransformation.objectToJson(patient));
+ Log.e("dynamic", JsonTransformation.objectToJson(patient));
+
+ String url = "http://49.234.4.35:8080/back/patientifio";
+
+ Log.e("dynamic", url);
+ Request request = new Request.Builder()
+ .url(url)
+ .post(requestBody)
+ .build();
+ okhttp3.Call call = client.newCall(request);
+
+ call.enqueue(new Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+ Toast toast = Toast.makeText(getApplicationContext(), "返回失败", Toast.LENGTH_SHORT);
+ toast.show();
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) throws IOException {
+ final String isSuccess = response.body().string();
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+
+ switch (isSuccess) {
+ case "404":
+ Toast.makeText(getApplicationContext(), "健康档案更新失败", Toast.LENGTH_SHORT).show();
+ break;
+ case "200":
+ Toast.makeText(getApplicationContext(), "健康档案更新成功", Toast.LENGTH_SHORT).show();
+ break;
+ default:
+ break;
+ }
+ }
+ });
+
+ }
+ });
+
+ }
}
diff --git a/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/Tab_personData.java b/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/Tab_personData.java
index d288a692f0f5ae72294d08252d9eac09c5a280f5..5ca04758250fab2381cf719c94ee8bf085d5a625 100644
--- a/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/Tab_personData.java
+++ b/app/src/main/java/com/linwankaifa/linwancunyi/ui/patient/Tab_personData.java
@@ -2,11 +2,14 @@ package com.linwankaifa.linwancunyi.ui.patient;
import android.app.Activity;
import android.app.Dialog;
+import android.content.Context;
import android.content.DialogInterface;
+import android.content.SharedPreferences;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
+import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@@ -15,12 +18,19 @@ import com.linwankaifa.linwancunyi.R;
public class Tab_personData extends AppCompatActivity {
TextView tv_hunying;
TextView tv_guomingshi;
+ EditText tv_shengao;
+ EditText tv_tizhong;
+ String SHAREDPREFERENCES_NAME = "shared.xml";
+ SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tab_person_data);
+ preferences = getSharedPreferences(SHAREDPREFERENCES_NAME, Context.MODE_PRIVATE);
+ tv_shengao = (EditText) findViewById(R.id.tv_shengao);
+ tv_tizhong = (EditText) findViewById(R.id.tv_tizhong);
tv_hunying = (TextView) findViewById(R.id.tv_hunying);
tv_guomingshi = (TextView) findViewById(R.id.tv_guomingshi);
}
diff --git a/app/src/main/res/layout/activity_add_hospital.xml b/app/src/main/res/layout/activity_add_hospital.xml
index 94596bbf428d02ab5315748d1c2fc8eecb6b34e3..a4ce735ea49e1cc39ffca1afc072953e6e642848 100644
--- a/app/src/main/res/layout/activity_add_hospital.xml
+++ b/app/src/main/res/layout/activity_add_hospital.xml
@@ -23,12 +23,22 @@
app:srcCompat="@drawable/ic_chevron_left_green_30dp" />
+
+
+
+ android:background="@null"
+ android:hint="请输入"
+ android:textSize="18dp" />
@@ -78,12 +89,13 @@
android:textSize="18dp"/>
+ android:background="@null"
+ android:hint="请输入"
+ android:textSize="18dp" />
@@ -97,6 +109,7 @@
android:layout_height="match_parent">
+
@@ -72,6 +81,7 @@
diff --git a/app/src/main/res/layout/activity_tab_person_data.xml b/app/src/main/res/layout/activity_tab_person_data.xml
index 93024ae1413d0faf0a42c2b72d23e6e68e556b43..6bc86a64c38723cfe41955d1ed11e91ffea900ee 100644
--- a/app/src/main/res/layout/activity_tab_person_data.xml
+++ b/app/src/main/res/layout/activity_tab_person_data.xml
@@ -32,6 +32,7 @@
android:textSize="15dp"/>
+