|
@@ -10,6 +10,7 @@
|
|
|
#include "service/BusinessConfig.h"
|
|
|
#include "core/sip_config.h"
|
|
|
#include "manager/LanguageManager.h"
|
|
|
+#include "core/utilities.h"
|
|
|
|
|
|
#include "base/strings.hpp"
|
|
|
#include "base/http_client.h"
|
|
@@ -54,29 +55,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
+TcpModel nursingTcpModel;
|
|
|
static bool dataInit = false; // false表示需要从数据库里获取数据,true表示从缓存里获取数据
|
|
|
PartSetting partSetting;
|
|
|
-Json::Value customerData;
|
|
|
-Json::Value nurseConfigOption;
|
|
|
+Json::Value frameRoom;
|
|
|
+Json::Value frameBedList;
|
|
|
Json::Value frameInfo; // 缓存房间名字等
|
|
|
Json::Value rightTitleInfo; // 缓存分机右边医生和护士标题
|
|
|
-Json::Value eventList; // 按键事件的缓存
|
|
|
-Json::Value customerFeeList; // 费用的缓存
|
|
|
-Json::Value customerAdviceList; // 医嘱的缓存
|
|
|
-bool hasNurseConfigOption = false;
|
|
|
static bool reinforce = false; // 判断设备是否处于增援状态
|
|
|
static bool serverInfo = true; // 判断是否需要从服务器获取服务器信息,第一次要,后续不要
|
|
|
-static int nurseConfigNumber = 5; // 护理项的数量,用于左侧显示,最少为5个,最多不限
|
|
|
-TcpModel nursingTcpModel;
|
|
|
-static int customerFeePageNo = 1;
|
|
|
-static int customerFeePageSize = 3;
|
|
|
-static int customerFeeDataTotal = 0;
|
|
|
-static int customerAdvicePageNo = 1;
|
|
|
-static int customerAdvicePageSize = 2;
|
|
|
-static int customerAdviceDataTotal = 0;
|
|
|
+static bool isHelpTimerRegistered = false;
|
|
|
|
|
|
|
|
|
-#define STORE_NURSING_TYPE "nursing_type" // 护理的状态,如果是true,那就在护理中,如果是false,那就不在护理中
|
|
|
+#define HELP_TIMER_HANDLE 3
|
|
|
#define NURSING_TIME_HANDLE 6 // 护理的定时器id
|
|
|
#define OXYGEN_TIME_HANDLE 7 // 吸氧倒计时
|
|
|
#define EVENT_TIME_HANDLE 8 // 事件定时器
|
|
@@ -117,14 +108,12 @@ public:
|
|
|
|
|
|
static void getDeviceInfo(){
|
|
|
if (dataInit){
|
|
|
- getCustomerInfo(StoragePreferences::getString(STORE_CUSTOMER_ID, ""));
|
|
|
getFrameInfo();
|
|
|
- getRightTitle();
|
|
|
//getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
|
|
|
reinforceDispaly();
|
|
|
return;
|
|
|
}
|
|
|
- string url = getHttpGateway()+"/deviceBed/getBedDeviceInfoByEthMac/"+ETHERNETMANAGER->getMacAddr();
|
|
|
+ string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + ETHERNETMANAGER->getMacAddr();
|
|
|
LOGD("请求设备信息. url = %s", url.c_str());
|
|
|
//发起HTTP GET请求
|
|
|
RestClient::Response r = RestClient::get(url);
|
|
@@ -145,13 +134,6 @@ public:
|
|
|
StoragePreferences::putString(SIP_REG_ACCOUNT,root["sip_id"].asString());
|
|
|
StoragePreferences::putString(SIP_REG_PASSWORD, root["sip_password"].asString());
|
|
|
|
|
|
- if (root["customer_id"] != NULL && root["customer_id"].asString() != "") {
|
|
|
- string customerId = root["customer_id"].asString();
|
|
|
- StoragePreferences::putString(STORE_CUSTOMER_ID, customerId);
|
|
|
- //获取病患信息
|
|
|
- getCustomerInfo(customerId);
|
|
|
- }
|
|
|
-
|
|
|
//获取科室设置
|
|
|
string partId = root["part_id"].asString();
|
|
|
StoragePreferences::putString(STORE_PARTID, partId);
|
|
@@ -168,6 +150,7 @@ public:
|
|
|
frameInfo["part_id"] = deviceInfo["part_id"].asInt();
|
|
|
|
|
|
getFrameInfo();
|
|
|
+ getFrameRoom(deviceInfo["frame_id"].asInt());
|
|
|
}
|
|
|
|
|
|
// 读取空间缓存的数据
|
|
@@ -175,57 +158,24 @@ public:
|
|
|
mRoomNamePtr->setText(frameInfo["full_name"].asString());
|
|
|
}
|
|
|
|
|
|
- // 通过https获取用户的数据,并且放进缓存里
|
|
|
- static void getCustomerInfo(string customerId){
|
|
|
- if (dataInit){
|
|
|
- settingCustomer(customerData);
|
|
|
- return;
|
|
|
- }
|
|
|
- string url = getHttpGateway()+"/deviceBed/getCustomerInfo/" + customerId;
|
|
|
- LOGD("请求用户信息. url = %s", url.c_str());
|
|
|
+ static void getFrameRoom(int frame_id) {
|
|
|
+ string url = getHttpGateway() + "/deviceRoom/get_frame_room/" + to_string(frame_id);
|
|
|
+ LOGD("请求房间信息. url = %s", url.c_str());
|
|
|
//发起HTTP GET请求
|
|
|
RestClient::Response r = RestClient::get(url);
|
|
|
- LOGD("获得用户信息. result = %s", r.body.c_str());
|
|
|
+ LOGD("获得房间信息. result = %s", r.body.c_str());
|
|
|
//解析json
|
|
|
Json::Reader reader;
|
|
|
Json::Value root;
|
|
|
if (reader.parse(r.body, root, false)){
|
|
|
- customerData = root;
|
|
|
- settingCustomer(root);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 读取用户的缓存数据
|
|
|
- static void settingCustomer(Json::Value root){
|
|
|
-// mUserNamePtr->setText(root["named"].asString());
|
|
|
-// string sex = root["sex"].asInt()==0?"女":"男";
|
|
|
-// mSexAgePtr->setText(sex+" "+root["age"].asString()+root["age_unit"].asString());
|
|
|
-
|
|
|
- string inDate = root["in_date"].asString();
|
|
|
- time_t timet = stoi(inDate);
|
|
|
- struct tm *t = gmtime(&timet);
|
|
|
- char pDate[25];
|
|
|
- sprintf(pDate,"%d-%02d-%02d",
|
|
|
- 1900 + t->tm_year, 1+ t->tm_mon, t->tm_mday);
|
|
|
-
|
|
|
-// if (root["illness_desc"].asString()==""){
|
|
|
-// mAdvicePtr->setTextTr("Null");
|
|
|
-// } else {
|
|
|
-// mAdvicePtr->setText(root["illness_desc"].asString());
|
|
|
-// }
|
|
|
-
|
|
|
- //护理项
|
|
|
- if (root["list"].isArray() && root["list"].size()>0){
|
|
|
- hasNurseConfigOption = true;
|
|
|
- nurseConfigOption = root["list"];
|
|
|
- nurseConfigNumber = root["list"].size();
|
|
|
-
|
|
|
+ frameRoom = root;
|
|
|
+ frameBedList = root["frame_bed_list"];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
static void getPartSetting(string partId){
|
|
|
- string url = getHttpGateway()+"/deviceBed/getPartSetting/"+partId;
|
|
|
+ string url = getHttpGateway() + "/deviceBed/getPartSetting/" + partId;
|
|
|
LOGD("请求科室信息. url = %s", url.c_str());
|
|
|
//发起HTTP GET请求
|
|
|
RestClient::Response r = RestClient::get(url);
|
|
@@ -321,15 +271,11 @@ public:
|
|
|
rightTitleInfo["doctor_valid"] = partSetting["doctor_valid"].asInt();
|
|
|
rightTitleInfo["nurse_title"] = partSetting["nurse_title"].asString();
|
|
|
rightTitleInfo["nurse_valid"] = partSetting["nurse_valid"].asInt();
|
|
|
- getRightTitle();
|
|
|
- }
|
|
|
-
|
|
|
- static void getRightTitle() {
|
|
|
}
|
|
|
|
|
|
|
|
|
static void getVersion() {
|
|
|
- std::string url = getHttpGateway() + "/deviceBed/getAppVersion?device_type=304&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
|
|
|
+ std::string url = getHttpGateway() + "/deviceRoom/get_app_version?device_type=303&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
|
|
|
std::string content_type = std::string("application/json");
|
|
|
|
|
|
LOGD("请求版本信息. url = %s", url.c_str());
|
|
@@ -364,6 +310,7 @@ public:
|
|
|
static void reinforceDispaly() {
|
|
|
if (reinforce) {
|
|
|
SetPainterInfo(0xFF2F9DF1,"增援已发出");
|
|
|
+ setHelpButton("/button/button_help3.png" ,false);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -457,6 +404,14 @@ void setReinforce(bool result) {
|
|
|
reinforce = result;
|
|
|
}
|
|
|
|
|
|
+void cancelAutoBtnHelpTimer(){
|
|
|
+ if (isHelpTimerRegistered) {
|
|
|
+ mActivityPtr->unregisterUserTimer(HELP_TIMER_HANDLE);
|
|
|
+ isHelpTimerRegistered = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
//标识方法
|
|
|
void SetPainterInfo(uint32_t bgColor, const std::string& msg){
|
|
|
mPainterInfoPtr->setBackgroundColor(bgColor);
|
|
@@ -486,6 +441,11 @@ void setNursingTcpModel(TcpModel tcpModel) {
|
|
|
nursingTcpModel = tcpModel;
|
|
|
}
|
|
|
|
|
|
+void setHelpButton(const char *pPicPath, bool isTouchable){
|
|
|
+ mHelpButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, pPicPath);
|
|
|
+ mHelpButtonPtr->setTouchable(isTouchable);
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 注册定时器
|
|
|
* 填充数组用于注册定时器
|
|
@@ -559,6 +519,15 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
|
|
|
*/
|
|
|
static bool onUI_Timer(int id){
|
|
|
switch (id) {
|
|
|
+
|
|
|
+ case HELP_TIMER_HANDLE: // 不能在线程里面关掉线程
|
|
|
+ {
|
|
|
+ SetPainterInfo(0xFFFFFFFF,"");
|
|
|
+ setReinforce(false);
|
|
|
+ setHelpButton("/button/button_help2.png", true);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -590,11 +559,103 @@ static bool onmainActivityTouchEvent(const MotionEvent &ev) {
|
|
|
}
|
|
|
static int getListItemCount_BedListView(const ZKListView *pListView) {
|
|
|
//LOGD("getListItemCount_BedListView !\n");
|
|
|
- return 3;
|
|
|
+ if (frameBedList.size() > 3) {
|
|
|
+ return frameBedList.size();
|
|
|
+ }
|
|
|
+ return 3;
|
|
|
}
|
|
|
|
|
|
static void obtainListItemData_BedListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
|
|
|
//LOGD(" obtainListItemData_ BedListView !!!\n");
|
|
|
+ if (frameBedList.size() > 0) {
|
|
|
+ pListItem->setText(frameBedList[index]["frame_bed"]["full_name"].asString());
|
|
|
+
|
|
|
+ // 用户相关
|
|
|
+ string customerName = frameBedList[index]["customer_name"].asString();
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerName)->setText(customerName);
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerAge)->setText(frameBedList[index]["customer_age"].asString() + frameBedList[index]["customer_age_unit"].asString());
|
|
|
+
|
|
|
+ string customerSex = frameBedList[index]["customer_sex"].asString();
|
|
|
+ if (customerSex == "0") { // 如果性别为女性,则替换成女性头像,和女性的图标
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerPortrait)->setBackgroundPic("ic_custom_female.png");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerSex)->setBackgroundPic("ic_gender_female.png");
|
|
|
+ }
|
|
|
+ else if (customerSex == "1") {
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerPortrait)->setBackgroundPic("ic_custom_male.png");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerSex)->setBackgroundPic("ic_gender_male.png");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerPortrait)->setBackgroundPic("ic_custom_empty.png");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CustomerSex)->setBackgroundPic("");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 医生护士相关
|
|
|
+ if (rightTitleInfo["doctor_valid"] != 1){
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_DoctorText)->setVisible(false);
|
|
|
+ } else {
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_DoctorText)->setText(rightTitleInfo["doctor_title"].asString());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rightTitleInfo["nurse_valid"] != 1){
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseText)->setVisible(false);
|
|
|
+ } else {
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseText)->setText(rightTitleInfo["nurse_title"].asString());
|
|
|
+ }
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_DoctorName)->setText(frameBedList[index]["doctor_name"].asString());
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseName)->setText(frameBedList[index]["nurse_name"].asString());
|
|
|
+
|
|
|
+
|
|
|
+ // 护理项相关
|
|
|
+ Json::Value nurseConfigList = frameBedList[index]["nurse_config_dtos"];
|
|
|
+ if (nurseConfigList.size() > 0) {
|
|
|
+ for (int i = 0; i < 5; i++) {
|
|
|
+ int nurseConfigColorNumber = ID_MAIN_NurseConfigColor1 + i;
|
|
|
+ int nurseConfigNumber = ID_MAIN_NurseConfig1 + i * 2;
|
|
|
+ int nurseOptionNumber = ID_MAIN_NurseOption1 + i * 2;
|
|
|
+ if (nurseConfigList.size() >= i) {
|
|
|
+ //颜色
|
|
|
+ string nurseConfigColot = nurseConfigList[i]["nurse_color_rbg"].asString();
|
|
|
+ uint32_t bgColor = 0xFFC0C0C0;
|
|
|
+ if (nurseConfigColot != "") {
|
|
|
+ string rgbStr = "FF" + nurseConfigColot;
|
|
|
+ transform(rgbStr.begin(), rgbStr.end(), rgbStr.begin(), ::toupper);
|
|
|
+ bgColor = strtoul(("0x" + rgbStr).c_str(), NULL,16);
|
|
|
+ }
|
|
|
+ pListItem->findSubItemByID(nurseConfigColorNumber)->setBackgroundColor(bgColor);
|
|
|
+ pListItem->findSubItemByID(nurseConfigNumber)->setText(nurseConfigList[i]["nurse_config_name"].asString());
|
|
|
+ string nurseOptionName = nurseConfigList[i]["nurse_option_name"].asString();
|
|
|
+ if (nurseOptionName == "") {
|
|
|
+ nurseOptionName = LANGUAGEMANAGER->getValue("None");
|
|
|
+ }
|
|
|
+ pListItem->findSubItemByID(nurseOptionNumber)->setText(nurseOptionName);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //颜色
|
|
|
+ pListItem->findSubItemByID(nurseConfigColorNumber)->setBackgroundColor(0xFFC0C0C0);
|
|
|
+ pListItem->findSubItemByID(nurseConfigNumber)->setText(nurseConfigList[i]["nurse_config_name"].asString());
|
|
|
+ pListItem->findSubItemByID(nurseOptionNumber)->setText(LANGUAGEMANAGER->getValue("None"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfigColor1)->setBackgroundColor(0xFFC0C0C0);
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfigColor2)->setBackgroundColor(0xFFC0C0C0);
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfigColor3)->setBackgroundColor(0xFFC0C0C0);
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfigColor4)->setBackgroundColor(0xFFC0C0C0);
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfigColor5)->setBackgroundColor(0xFFC0C0C0);
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfig1)->setText("");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfig2)->setText("");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfig3)->setText("");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfig4)->setText("");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseConfig5)->setText("");
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseOption1)->setText(LANGUAGEMANAGER->getValue("None"));
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseOption2)->setText(LANGUAGEMANAGER->getValue("None"));
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseOption3)->setText(LANGUAGEMANAGER->getValue("None"));
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseOption4)->setText(LANGUAGEMANAGER->getValue("None"));
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_NurseOption5)->setText(LANGUAGEMANAGER->getValue("None"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static void onListItemClick_BedListView(ZKListView *pListView, int index, int id) {
|
|
@@ -602,31 +663,223 @@ static void onListItemClick_BedListView(ZKListView *pListView, int index, int id
|
|
|
}
|
|
|
static bool onButtonClick_CallBedButton(ZKButton *pButton) {
|
|
|
LOGD(" ButtonClick CallBedButton !!!\n");
|
|
|
+
|
|
|
+ if (frameBedList.size() > 0) {
|
|
|
+ mCallBebWinPtr->showWnd();
|
|
|
+ } else {
|
|
|
+ mErrorWinPtr->showWnd();
|
|
|
+ mErrorTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoBedList"));
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
static bool onButtonClick_CallNurseButton(ZKButton *pButton) {
|
|
|
LOGD(" ButtonClick CallNurseButton !!!\n");
|
|
|
+
|
|
|
+ if (SIGNAL_TYPE=="SIP"){
|
|
|
+ int port = StoragePreferences::getInt(SIP_REG_PORT, SIP_REG_PORT_DEFAULT);
|
|
|
+ std::string domain = StoragePreferences::getString(SIP_REG_DOMAIN, SIP_REG_DOMAIN_DEFAULT);
|
|
|
+ std::string od_number = StoragePreferences::getString(SIP_REG_DOOR_ACCOUNT, SIP_REG_DOOR_ACCOUNT_DEFAULT);
|
|
|
+ std::string od_number_uri = URI(od_number, domain, port);
|
|
|
+ LOGD("od_number_uri: %s", od_number_uri.c_str());
|
|
|
+ GetTelephone()->MakeCall(od_number_uri);
|
|
|
+ } else {
|
|
|
+ Intent* intent = new Intent();
|
|
|
+ intent->putExtra(isOutgoing, "true");
|
|
|
+ intent->putExtra(audioOnly, "true");
|
|
|
+ EASYUICONTEXT->openActivity("callActivity", intent);
|
|
|
+ }
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
static bool onButtonClick_HelpButton(ZKButton *pButton) {
|
|
|
LOGD(" ButtonClick HelpButton !!!\n");
|
|
|
+
|
|
|
+ TcpModel tcpModel;
|
|
|
+ tcpModel.type = TcpType::REINFORCE;
|
|
|
+ tcpModel.action = ReinforceAction::CALL;
|
|
|
+ tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
|
|
|
+ tcpModel.to_id = 0;
|
|
|
+ std::string req = getTcpModelString(tcpModel);
|
|
|
+ LOGD("REINFORCE CALL : %s",req.c_str());
|
|
|
+// TcpClient::instance()->sendMsg(req.c_str());
|
|
|
+
|
|
|
+ //回调注册
|
|
|
+ TcpCallback callback;
|
|
|
+ callback.tid = tcpModel.tid;
|
|
|
+ callback.jsonStr = req;
|
|
|
+ callback.onSuccess = [](Json::Value json){
|
|
|
+ LOGD("callback success");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ callback.onFalied = [](Json::Value json){
|
|
|
+ LOGD("callback failed");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
|
|
|
+
|
|
|
+ setHelpButton("/button/button_help3.png" ,false);
|
|
|
+ SetPainterInfo(0xFF2F9DF1,"增援已发出");
|
|
|
+ setReinforce(true); // 设置增援状态为true
|
|
|
+ //1分钟后无响应还原颜色
|
|
|
+ if (!isHelpTimerRegistered){
|
|
|
+ mActivityPtr->registerUserTimer(HELP_TIMER_HANDLE, 60000);
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
static bool onButtonClick_CallCencelButton(ZKButton *pButton) {
|
|
|
+
|
|
|
LOGD(" ButtonClick CallCencelButton !!!\n");
|
|
|
+ // 发送tcp, tcp_type = VOICE, tcp_action = CANCEL_BY_DOOR
|
|
|
+ TcpModel tcpModel;
|
|
|
+ tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
|
|
|
+ tcpModel.type = TcpType::VOICE;
|
|
|
+ tcpModel.action = VoiceAction::CANCEL_BY_DOOR;
|
|
|
+ tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
|
|
|
+ tcpModel.to_id = NULL;
|
|
|
+ std::string req = getTcpModelString(tcpModel);
|
|
|
+ LOGD("TCP VOICE : %s",req.c_str());
|
|
|
+
|
|
|
+ //回调注册
|
|
|
+ TcpCallback callback;
|
|
|
+ callback.tid = tcpModel.tid;
|
|
|
+ callback.jsonStr = req;
|
|
|
+ callback.onSuccess = [](Json::Value json){
|
|
|
+ LOGD("side callback success");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ callback.onFalied = [](Json::Value json){
|
|
|
+ LOGD("side callback failed");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
static bool onButtonClick_NursingButton(ZKButton *pButton) {
|
|
|
LOGD(" ButtonClick NursingButton !!!\n");
|
|
|
- EASYUICONTEXT->openActivity("ui3Activity");
|
|
|
+ LOGD("onButtonClick_Nursing 触发护理按钮!!!");
|
|
|
+ mFunctionWinPtr->showWnd();
|
|
|
+ mFunctionTextViewPtr->setText(LANGUAGEMANAGER->getValue("InNursing"));
|
|
|
+ mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("NursingEnd"));
|
|
|
+ mFunctionBackPtr->setVisible(false);
|
|
|
+
|
|
|
+ // 发送tcp, tcp_type = SIDE, tcp_action = NURSING
|
|
|
+ TcpModel tcpModel;
|
|
|
+ tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
|
|
|
+ tcpModel.type = TcpType::SIDE;
|
|
|
+ tcpModel.action = SideAction::NURSING;
|
|
|
+ tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
|
|
|
+ tcpModel.to_id = NULL;
|
|
|
+ std::string req = getTcpModelString(tcpModel);
|
|
|
+ LOGD("TCP SIDE : %s",req.c_str());
|
|
|
+
|
|
|
+ //回调注册
|
|
|
+ TcpCallback callback;
|
|
|
+ callback.tid = tcpModel.tid;
|
|
|
+ callback.jsonStr = req;
|
|
|
+ callback.onSuccess = [](Json::Value json){
|
|
|
+ LOGD("side callback success");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ callback.onFalied = [](Json::Value json){
|
|
|
+ LOGD("side callback failed");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
static bool onButtonClick_MoreButton(ZKButton *pButton) {
|
|
|
LOGD(" ButtonClick MoreButton !!!\n");
|
|
|
EASYUICONTEXT->openActivity("ui3Activity");
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+static bool onButtonClick_FunctionButton(ZKButton *pButton) {
|
|
|
+ LOGD(" ButtonClick FunctionButton !!!\n");
|
|
|
+ mFunctionWinPtr->hideWnd();
|
|
|
+
|
|
|
+ if (nursingTcpModel.json.size() != 0) { // 对比一下,json里面不为空的时候
|
|
|
+ // 发送tcp, tcp_type = SIDE, tcp_action = NURSING_END
|
|
|
+ TcpModel tcpModel;
|
|
|
+ tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
|
|
|
+ tcpModel.type = TcpType::SIDE;
|
|
|
+ tcpModel.action = SideAction::NURSING_END;
|
|
|
+ tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
|
|
|
+ tcpModel.data = nursingTcpModel.json["id"].asString(); // 获取nursingTcpModel里,id字段的数据
|
|
|
+
|
|
|
+ std::string req = getTcpModelString(tcpModel);
|
|
|
+ LOGD("TCP NURSING_END : %s",req.c_str());
|
|
|
+
|
|
|
+ //回调注册
|
|
|
+ TcpCallback callback;
|
|
|
+ callback.tid = tcpModel.tid;
|
|
|
+ callback.jsonStr = req;
|
|
|
+ callback.onSuccess = [](Json::Value json){
|
|
|
+ LOGD("event callback success");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ callback.onFalied = [](Json::Value json){
|
|
|
+ LOGD("event callback failed");
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+ TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
|
|
|
+
|
|
|
+ TcpModel newTcpModel;
|
|
|
+ nursingTcpModel = newTcpModel; // 清空nursingTcpModel
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+static bool onButtonClick_FunctionBack(ZKButton *pButton) {
|
|
|
+ LOGD(" ButtonClick FunctionBack !!!\n");
|
|
|
+ return false;
|
|
|
+}
|
|
|
+static int getListItemCount_CallBedListView(const ZKListView *pListView) {
|
|
|
+ //LOGD("getListItemCount_CallBedListView !\n");
|
|
|
+ return frameBedList.size();
|
|
|
+}
|
|
|
+
|
|
|
+static void obtainListItemData_CallBedListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
|
|
|
+ //LOGD(" obtainListItemData_ CallBedListView !!!\n");
|
|
|
+ pListItem->setText(frameBedList[index]["frame_bed"]["full_name"].asString());
|
|
|
+ pListItem->findSubItemByID(ID_MAIN_CallBedName)->setText(frameBedList[index]["customer_name"].asString());
|
|
|
+}
|
|
|
+
|
|
|
+static void onListItemClick_CallBedListView(ZKListView *pListView, int index, int id) {
|
|
|
+// LOGD(" onListItemClick_ CallBedListView !!!\n");
|
|
|
+
|
|
|
+ string customerName = frameBedList[index]["customer_name"].asString();
|
|
|
+ string toId = frameBedList[index]["bed_device_id"].asString();
|
|
|
+ if (customerName == "") {
|
|
|
+ mErrorTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoCustomer"));
|
|
|
+ mErrorWinPtr->showWnd();
|
|
|
+ }
|
|
|
+ else if (toId == "") {
|
|
|
+ mErrorTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoBedDevice"));
|
|
|
+ mErrorWinPtr->showWnd();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ mCallBebWinPtr->hideWnd();
|
|
|
+ Intent* intent = new Intent();
|
|
|
+ intent->putExtra(isOutgoing, "true");
|
|
|
+ intent->putExtra(audioOnly, "true");
|
|
|
+ intent->putExtra(toIdStr, toId);
|
|
|
+ intent->putExtra(callName, frameBedList[index]["frame_bed"]["full_name"].asString() + " " + customerName);
|
|
|
+ EASYUICONTEXT->openActivity("callActivity", intent);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static bool onButtonClick_CallBedCancel(ZKButton *pButton) {
|
|
|
+ LOGD(" ButtonClick CallBedCancel !!!\n");
|
|
|
+ mCallBebWinPtr->hideWnd();
|
|
|
+ return false;
|
|
|
+}
|
|
|
+static bool onButtonClick_ErrorConfirmButton(ZKButton *pButton) {
|
|
|
+ LOGD(" ButtonClick ErrorConfirmButton !!!\n");
|
|
|
+ mErrorWinPtr->hideWnd();
|
|
|
+ return false;
|
|
|
+}
|