|
@@ -73,6 +73,24 @@ static void getClerkList() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static bool getClerkByPartIdAndPassNo(std::string passNo) {
|
|
|
|
+ string url = getHttpGateway() + "/deviceRoom/get_clerk_by_part_id_and_pass_no/" + StoragePreferences::getString(STORE_PARTID, "") + "/" + passNo;
|
|
|
|
+ LOGD("根据科室id和卡号查询员工. url = %s", url.c_str());
|
|
|
|
+ //发起HTTP GET请求
|
|
|
|
+ RestClient::Response r = RestClient::get(url);
|
|
|
|
+ LOGD("根据科室id和卡号查询员工. result = %s", r.body.c_str());
|
|
|
|
+ //解析json
|
|
|
|
+ Json::Reader reader;
|
|
|
|
+ Json::Value root;
|
|
|
|
+ if (reader.parse(r.body, root, false)){
|
|
|
|
+ if (root.isMember("clerk_id")) {
|
|
|
|
+ clerk = root;
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
std::string getClerkPassNo() {
|
|
std::string getClerkPassNo() {
|
|
return clerk["pass_no"].asCString();
|
|
return clerk["pass_no"].asCString();
|
|
}
|
|
}
|
|
@@ -345,6 +363,59 @@ void logoutMedicalCare() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void loginMedicalCare() {
|
|
|
|
+ mLoginWindowPtr->hideWnd();
|
|
|
|
+ mChooseClerkWindowPtr->hideWnd();
|
|
|
|
+ mMedicalCareWindowPtr->showWnd();
|
|
|
|
+
|
|
|
|
+ Json::Value json;
|
|
|
|
+ json["passNo"] = clerk["pass_no"].asCString();
|
|
|
|
+ json["operationData"] = "";
|
|
|
|
+
|
|
|
|
+ // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
|
|
|
|
+ TcpModel tcpModel;
|
|
|
|
+ tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
|
|
|
|
+ tcpModel.type = TcpType::AUTH;
|
|
|
|
+ tcpModel.action = AuthAction::LOGIN;
|
|
|
|
+ tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
|
|
|
|
+ tcpModel.to_id = 0;
|
|
|
|
+ tcpModel.json = json;
|
|
|
|
+
|
|
|
|
+ sendTcpModel(tcpModel);
|
|
|
|
+
|
|
|
|
+ if (StoragePreferences::getInt(STORE_AUTO_POSITION, 0)) {
|
|
|
|
+ setPosition(true);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void nfcLogin(std::string revStr) {
|
|
|
|
+ if (mActivityPtr == NULL) {
|
|
|
|
+ LOGD("不在医护界面");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (isChoose) {
|
|
|
|
+ LOGD("已经存在员工");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool reslut = getClerkByPartIdAndPassNo(revStr);
|
|
|
|
+ if (reslut) {
|
|
|
|
+ isChoose = true;
|
|
|
|
+ mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
|
|
|
|
+
|
|
|
|
+ loginMedicalCare();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ Intent* intent = new Intent();
|
|
|
|
+ intent->putExtra(functionWindows, "warn");
|
|
|
|
+ intent->putExtra(warnText, LANGUAGEMANAGER->getValue("PassNoError"));
|
|
|
|
+ EASYUICONTEXT->openActivity("functionActivity", intent);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 注册定时器
|
|
* 注册定时器
|
|
* 填充数组用于注册定时器
|
|
* 填充数组用于注册定时器
|
|
@@ -605,27 +676,7 @@ static bool onButtonClick_EnteringButton(ZKButton *pButton) {
|
|
|
|
|
|
mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
|
|
mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
|
|
|
|
|
|
- mChooseClerkWindowPtr->hideWnd();
|
|
|
|
- mMedicalCareWindowPtr->showWnd();
|
|
|
|
-
|
|
|
|
- Json::Value json;
|
|
|
|
- json["passNo"] = clerk["pass_no"].asCString();
|
|
|
|
- json["operationData"] = "";
|
|
|
|
-
|
|
|
|
- // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
|
|
|
|
- TcpModel tcpModel;
|
|
|
|
- tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
|
|
|
|
- tcpModel.type = TcpType::AUTH;
|
|
|
|
- tcpModel.action = AuthAction::LOGIN;
|
|
|
|
- tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
|
|
|
|
- tcpModel.to_id = 0;
|
|
|
|
- tcpModel.json = json;
|
|
|
|
-
|
|
|
|
- sendTcpModel(tcpModel);
|
|
|
|
-
|
|
|
|
- if (StoragePreferences::getInt(STORE_AUTO_POSITION, 0)) {
|
|
|
|
- setPosition(true);
|
|
|
|
- }
|
|
|
|
|
|
+ loginMedicalCare();
|
|
|
|
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|