Ejemplo n.º 1
0
 public static void upload() {
   if (SignApplication.uploadList.size() > 0) {
     for (int i = 0; i < SignApplication.uploadList.size(); i++) {
       if (!SignApplication.uploadList.get(i).need.equals("true")
           || SignApplication.uploadList.get(i).updated.equals("true")) {
         continue;
       }
       Message msg = ConnectHttp.wcHandler.obtainMessage();
       msg.what = 19;
       Bundle myBundle = new Bundle();
       myBundle.putString(
           "url",
           ConnectHttp.postUpload(
               SignApplication.uploadList.get(i).patientid,
               SignApplication.uploadList.get(i).datatype,
               SignApplication.uploadList.get(i).dataid,
               SignApplication.uploadList.get(i).datavalue,
               SignApplication.uploadList.get(i).recordtime,
               SystemInfo.accesstoken));
       myBundle.putString("key", SystemInfo.accesstoken);
       myBundle.putString("uploaddataId", SignApplication.uploadList.get(i).dataid);
       myBundle.putString("uploadpId", SignApplication.uploadList.get(i).patientid);
       myBundle.putString("retime", SignApplication.uploadList.get(i).recordtime);
       msg.obj = myBundle;
       msg.sendToTarget();
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public void run() {
    super.run();

    SignApplication.GetDBInfo("Sign");
    SignApplication.GetDBInfo("Service");
    SignApplication.GetDBInfo("Menu");
    SignApplication.GetDBInfo("Patient");
    SignApplication.GetDBInfo("Push");
    SignApplication.GetDBInfo("Room");

    while (true) {
      hospitalMd5 = false;
      signMd5 = false;
      serviceMd5 = false;
      menuMd5 = false;
      patientMd5 = false;
      pushMd5 = false;
      roomMd5 = false;
      if (networkStatusOK(MainActivity.context)
          && SignApplication.userInfoList.get(0).userauto.equals("true")) {

        Message msg = ConnectHttp.wcHandler.obtainMessage();

        msg.what = 5;
        Bundle myBundle = new Bundle();
        myBundle.putString("url", ConnectHttp.postOfficeInfo(false, SystemInfo.accesstoken));
        myBundle.putString("key", SystemInfo.accesstoken);
        msg.obj = myBundle;
        msg.sendToTarget();

        msg = new Message();
        myBundle = new Bundle();
        msg.what = 7;
        myBundle.putString("url", ConnectHttp.postSignList(false, SystemInfo.accesstoken));
        myBundle.putString("key", SystemInfo.accesstoken);
        msg.obj = myBundle;
        ConnectHttp.wcHandler.sendMessage(msg);

        msg = new Message();
        myBundle = new Bundle();
        msg.what = 9;
        myBundle.putString("url", ConnectHttp.postServiceList(false, SystemInfo.accesstoken));
        myBundle.putString("key", SystemInfo.accesstoken);
        msg.obj = myBundle;
        ConnectHttp.wcHandler.sendMessage(msg);

        msg = new Message();
        myBundle = new Bundle();
        msg.what = 11;
        myBundle.putString("url", ConnectHttp.postMenuList(false, SystemInfo.accesstoken));
        myBundle.putString("key", SystemInfo.accesstoken);
        msg.obj = myBundle;
        ConnectHttp.wcHandler.sendMessage(msg);

        msg = new Message();
        myBundle = new Bundle();
        msg.what = 13;
        myBundle.putString("url", ConnectHttp.postPatientList(false, SystemInfo.accesstoken));
        myBundle.putString("key", SystemInfo.accesstoken);
        msg.obj = myBundle;
        ConnectHttp.wcHandler.sendMessage(msg);

        msg = new Message();
        myBundle = new Bundle();
        msg.what = 15;
        myBundle.putString("url", ConnectHttp.postPushList(false, SystemInfo.accesstoken));
        myBundle.putString("key", SystemInfo.accesstoken);
        msg.obj = myBundle;
        ConnectHttp.wcHandler.sendMessage(msg);

        msg = new Message();
        myBundle = new Bundle();
        msg.what = 17;
        myBundle.putString("url", ConnectHttp.postRoomList(false, SystemInfo.accesstoken));
        myBundle.putString("key", SystemInfo.accesstoken);
        msg.obj = myBundle;
        ConnectHttp.wcHandler.sendMessage(msg);

        SignApplication.db.open();

        SignApplication.dbuser.put("autoUpdateThread", "true");

        if (SignApplication.userInfoList.get(0).auto.equals("true")) {
          upload();
        }

        SignApplication.dbuser.remove("autoUpdateThread");

        SignApplication.db.close();

      } else if (!networkStatusOK(MainActivity.context)) {
        SignApplication.GetDBInfo("Sign");
        SignApplication.GetDBInfo("Service");
        SignApplication.GetDBInfo("Menu");
        SignApplication.GetDBInfo("Patient");
        SignApplication.GetDBInfo("Push");
        SignApplication.GetDBInfo("Room");
      }

      try {
        Thread.sleep(1000 * 60 * 60);
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }