medicalCareLogic.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. #pragma once
  2. #include "uart/ProtocolSender.h"
  3. #include "core/utilities.h"
  4. #include "base/strings.hpp"
  5. #include "service/BusinessConfig.h"
  6. #include "restclient-cpp/restclient.h"
  7. /*
  8. *此文件由GUI工具生成
  9. *文件功能:用于处理用户的逻辑相应代码
  10. *功能说明:
  11. *========================onButtonClick_XXXX
  12. 当页面中的按键按下后系统会调用对应的函数,XXX代表GUI工具里面的[ID值]名称,
  13. 如Button1,当返回值为false的时候系统将不再处理这个按键,返回true的时候系统将会继续处理此按键。比如SYS_BACK.
  14. *========================onSlideWindowItemClick_XXXX(int index)
  15. 当页面中存在滑动窗口并且用户点击了滑动窗口的图标后系统会调用此函数,XXX代表GUI工具里面的[ID值]名称,
  16. 如slideWindow1;index 代表按下图标的偏移值
  17. *========================onSeekBarChange_XXXX(int progress)
  18. 当页面中存在滑动条并且用户改变了进度后系统会调用此函数,XXX代表GUI工具里面的[ID值]名称,
  19. 如SeekBar1;progress 代表当前的进度值
  20. *========================ogetListItemCount_XXXX()
  21. 当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表的总数目,XXX代表GUI工具里面的[ID值]名称,
  22. 如List1;返回值为当前列表的总条数
  23. *========================oobtainListItemData_XXXX(ZKListView::ZKListItem *pListItem, int index)
  24. 当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表当前条目下的内容信息,XXX代表GUI工具里面的[ID值]名称,
  25. 如List1;pListItem 是贴图中的单条目对象,index是列表总目的偏移量。具体见函数说明
  26. *========================常用接口===============
  27. *LOGD(...) 打印调试信息的接口
  28. *mTextXXXPtr->setText("****") 在控件TextXXX上显示文字****
  29. *mButton1Ptr->setSelected(true); 将控件mButton1设置为选中模式,图片会切换成选中图片,按钮文字会切换为选中后的颜色
  30. *mSeekBarPtr->setProgress(12) 在控件mSeekBar上将进度调整到12
  31. *mListView1Ptr->refreshListView() 让mListView1 重新刷新,当列表数据变化后调用
  32. *mDashbroadView1Ptr->setTargetAngle(120) 在控件mDashbroadView1上指针显示角度调整到120度
  33. *
  34. * 在Eclipse编辑器中 使用 “alt + /” 快捷键可以打开智能提示
  35. */
  36. Json::Value clerk;
  37. Json::Value clerkList;
  38. static string frameFullName;
  39. static string frameBedNameList = "";
  40. static bool isPosition = false;
  41. static bool isRoomPatrol = false;
  42. static bool isNursing = false;
  43. static int positionItId = 0;
  44. static int roomCheckItId = 0;
  45. static int authItId = 0;
  46. static int chooseId = 0;
  47. static bool isChoose = false;
  48. static void getClerkList() {
  49. string url = getHttpGateway() + "/deviceRoom/get_clerk_by_part_id/" + StoragePreferences::getString(STORE_PARTID, "");
  50. LOGD("请求科室所有员工. url = %s", url.c_str());
  51. //发起HTTP GET请求
  52. RestClient::Response r = RestClient::get(url);
  53. LOGD("获得科室所有员工列表. result = %s", r.body.c_str());
  54. //解析json
  55. Json::Reader reader;
  56. Json::Value root;
  57. if (reader.parse(r.body, root, false)){
  58. if (root.size() > 0) {
  59. Json::Value clerks;
  60. for (int i = 0; i < root.size(); i++) {
  61. if (root[i]["pass_no"].asString() != "") {
  62. clerks.append(root[i]);
  63. }
  64. }
  65. clerkList = clerks;
  66. }
  67. }
  68. }
  69. static bool getClerkByPartIdAndPassNo(std::string passNo) {
  70. string url = getHttpGateway() + "/deviceRoom/get_clerk_by_part_id_and_pass_no/" + StoragePreferences::getString(STORE_PARTID, "") + "/" + passNo;
  71. LOGD("根据科室id和卡号查询员工. url = %s", url.c_str());
  72. //发起HTTP GET请求
  73. RestClient::Response r = RestClient::get(url);
  74. LOGD("根据科室id和卡号查询员工. result = %s", r.body.c_str());
  75. //解析json
  76. Json::Reader reader;
  77. Json::Value root;
  78. if (reader.parse(r.body, root, false)){
  79. if (root.isMember("clerk_id")) {
  80. clerk = root;
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. std::string getClerkPassNo() {
  87. return clerk["pass_no"].asCString();
  88. }
  89. void setClerk(std::string clerk_name, std::string pass_no, int _authItid) {
  90. isChoose = true;
  91. clerk["clerk_name"] = clerk_name;
  92. clerk["pass_no"] = pass_no;
  93. authItId = _authItid;
  94. }
  95. int getAuthItId() {
  96. return authItId;
  97. }
  98. void setAuthItId(int id) {
  99. authItId = id;
  100. }
  101. void setPosistionItId(int id) {
  102. positionItId = id;
  103. }
  104. void setRoomCheckItId(int id) {
  105. roomCheckItId = id;
  106. }
  107. void setPositionButton(bool setPosition) {
  108. isPosition = setPosition;
  109. if (mActivityPtr == NULL) {
  110. return;
  111. }
  112. if (setPosition) {
  113. mPositionPainterPtr->setBackgroundPic("medicalCare/ding-y.png");
  114. mPositionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/yellow_199x281.png");
  115. mPositionButtonPtr->setText(LANGUAGEMANAGER->getValue("Positioned"));
  116. mPositionButtonPtr->setTextColor(0xFFFFFFFF);
  117. mPositionTextViewPtr->setTextColor(0xFFFFFFFF);
  118. mPositionButtonPtr->setTouchable(false);
  119. }
  120. else {
  121. mPositionPainterPtr->setBackgroundPic("medicalCare/ding.png");
  122. mPositionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/white_199x281.png");
  123. mPositionButtonPtr->setText(LANGUAGEMANAGER->getValue("Position"));
  124. mPositionButtonPtr->setTextColor(0xFF000000);
  125. mPositionTextViewPtr->setTextColor(0xFF7D7D7D);
  126. mPositionButtonPtr->setTouchable(true);
  127. }
  128. }
  129. void setPosition(bool setPosition) {
  130. if (setPosition) {
  131. setPositionButton(setPosition);
  132. Json::Value json;
  133. json["passNo"] = clerk["pass_no"].asCString();
  134. json["operationData"] = "";
  135. TcpModel tcpModel;
  136. tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  137. tcpModel.type = TcpType::POSITION;
  138. tcpModel.action = PositionAction::POSITION_START;
  139. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  140. tcpModel.to_id = 0;
  141. tcpModel.json = json;
  142. sendTcpModel(tcpModel);
  143. }
  144. else {
  145. setPositionButton(setPosition);
  146. if (positionItId != 0) {
  147. // TcpModel tcpModel;
  148. // tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  149. // tcpModel.type = TcpType::POSITION;
  150. // tcpModel.action = PositionAction::POSITION_END;
  151. // tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  152. // tcpModel.to_id = 0;
  153. // tcpModel.data = to_string(positionItId);
  154. // sendTcpModel(tcpModel);
  155. positionItId = 0;
  156. }
  157. }
  158. }
  159. void setRoomPatrolButton(bool setRoomPatrol) {
  160. isRoomPatrol = setRoomPatrol;
  161. if (mActivityPtr == NULL) {
  162. return;
  163. }
  164. if (setRoomPatrol) {
  165. mRoomPatrolPainterPtr->setBackgroundPic("medicalCare/xun-y.png");
  166. mRoomPatrolButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/green_199x281.png");
  167. mRoomPatrolButtonPtr->setText(LANGUAGEMANAGER->getValue("RoomPatrolCompleted"));
  168. mRoomPatrolButtonPtr->setTextColor(0xFFFFFFFF);
  169. mRoomPatrolTextViewPtr->setTextColor(0xFFFFFFFF);
  170. mRoomPatrolButtonPtr->setTouchable(false);
  171. }
  172. else {
  173. mRoomPatrolPainterPtr->setBackgroundPic("medicalCare/xun.png");
  174. mRoomPatrolButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/white_199x281.png");
  175. mRoomPatrolButtonPtr->setText(LANGUAGEMANAGER->getValue("RoomPatrol"));
  176. mRoomPatrolButtonPtr->setTextColor(0xFF000000);
  177. mRoomPatrolTextViewPtr->setTextColor(0xFF7D7D7D);
  178. mRoomPatrolButtonPtr->setTouchable(true);
  179. }
  180. }
  181. void setRoomPatrol(bool setRoomPatrol) {
  182. if (setRoomPatrol) {
  183. setRoomPatrolButton(setRoomPatrol);
  184. Json::Value json;
  185. json["passNo"] = clerk["pass_no"].asCString();
  186. json["operationData"] = "";
  187. TcpModel tcpModel;
  188. tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  189. tcpModel.type = TcpType::ROOMCHECK;
  190. tcpModel.action = RoomCheckAction::START;
  191. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  192. tcpModel.to_id = 0;
  193. tcpModel.json = json;
  194. sendTcpModel(tcpModel);
  195. }
  196. else {
  197. setRoomPatrolButton(setRoomPatrol);
  198. if (roomCheckItId != 0) {
  199. // TcpModel tcpModel;
  200. // tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  201. // tcpModel.type = TcpType::ROOMCHECK;
  202. // tcpModel.action = RoomCheckAction::END;
  203. // tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  204. // tcpModel.to_id = 0;
  205. // tcpModel.data = to_string(roomCheckItId);
  206. // sendTcpModel(tcpModel);
  207. //
  208. roomCheckItId = 0;
  209. }
  210. }
  211. }
  212. void setNursingEnd() {
  213. StoragePreferences::putBool(STORE_NURSING_TYPE, false);
  214. if (StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, "") != "") { // 对比一下,json里面不为空的时候
  215. // 发送tcp, tcp_type = SIDE, tcp_action = NURSING_END
  216. TcpModel tcpModel;
  217. tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  218. tcpModel.type = TcpType::SIDE;
  219. tcpModel.action = SideAction::NURSING_END;
  220. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  221. tcpModel.data = StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, ""); // 获取nursingTcpModel里,id字段的数据
  222. sendTcpModel(tcpModel);
  223. // 需要把护理的interactionId清空
  224. StoragePreferences::putString(STORE_NURSING_INTERACTION_ID, "");
  225. }
  226. }
  227. void setNursingButton(bool setNursing) {
  228. isNursing = setNursing;
  229. if (mActivityPtr == NULL) {
  230. return;
  231. }
  232. if (setNursing) {
  233. mNursingPainterPtr->setBackgroundPic("medicalCare/hu-y.png");
  234. mNursingButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/pink_199x281.png");
  235. mNursingButtonPtr->setText(LANGUAGEMANAGER->getValue("InNursing"));
  236. mNursingButtonPtr->setTextColor(0xFFFFFFFF);
  237. mNursingTextViewPtr->setTextColor(0xFFFFFFFF);
  238. }
  239. else {
  240. mNursingPainterPtr->setBackgroundPic("medicalCare/hu.png");
  241. mNursingButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/white_199x281.png");
  242. mNursingButtonPtr->setText(LANGUAGEMANAGER->getValue("Nursing"));
  243. mNursingButtonPtr->setTextColor(0xFF000000);
  244. mNursingTextViewPtr->setTextColor(0xFF7D7D7D);
  245. }
  246. }
  247. void setNursing(bool setNursing) {
  248. if (setNursing) {
  249. setNursingButton(setNursing);
  250. // 门灯控制
  251. std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
  252. if (color != "" && color.size() == 3) {
  253. color = color + "F";
  254. } else {
  255. color = "010F";
  256. }
  257. lightControl("DOORLED", color);
  258. // 发送tcp, tcp_type = SIDE, tcp_action = NURSING
  259. TcpModel tcpModel;
  260. tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
  261. tcpModel.type = TcpType::SIDE;
  262. tcpModel.action = SideAction::NURSING;
  263. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  264. tcpModel.to_id = 0;
  265. sendTcpModel(tcpModel);
  266. // 把护理状态缓存起来
  267. StoragePreferences::putBool(STORE_NURSING_TYPE, true);
  268. }
  269. else {
  270. setNursingButton(setNursing);
  271. lightControl("DOORLED", "000F");
  272. setNursingEnd();
  273. }
  274. }
  275. void logoutMedicalCare() {
  276. isChoose = false;
  277. setPosition(false);
  278. setRoomPatrol(false);
  279. setNursing(false);
  280. clerk.clear();
  281. if (mActivityPtr != NULL) {
  282. mPasswordEditTextPtr->setText("");
  283. mMedicalCareWindowPtr->hideWnd();
  284. mChooseClerkWindowPtr->hideWnd();
  285. mLoginWindowPtr->showWnd();
  286. }
  287. if (authItId != 0) {
  288. // 发送tcp, tcp_type = AUTH, tcp_action = LOGOUT
  289. TcpModel tcpModel;
  290. tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
  291. tcpModel.type = TcpType::AUTH;
  292. tcpModel.action = AuthAction::LOGOUT;
  293. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  294. tcpModel.to_id = 0;
  295. tcpModel.data = to_string(authItId);
  296. sendTcpModel(tcpModel);
  297. authItId = 0;
  298. }
  299. }
  300. void loginMedicalCare() {
  301. mLoginWindowPtr->hideWnd();
  302. mChooseClerkWindowPtr->hideWnd();
  303. mMedicalCareWindowPtr->showWnd();
  304. Json::Value json;
  305. json["passNo"] = clerk["pass_no"].asCString();
  306. json["operationData"] = "";
  307. // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
  308. TcpModel tcpModel;
  309. tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
  310. tcpModel.type = TcpType::AUTH;
  311. tcpModel.action = AuthAction::LOGIN;
  312. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  313. tcpModel.to_id = 0;
  314. tcpModel.json = json;
  315. sendTcpModel(tcpModel);
  316. if (StoragePreferences::getInt(STORE_AUTO_POSITION, 0)) {
  317. setPosition(true);
  318. }
  319. }
  320. void nfcLogin(std::string revStr) {
  321. if (mActivityPtr == NULL) {
  322. LOGD("不在医护界面");
  323. return;
  324. }
  325. if (isChoose) {
  326. LOGD("已经存在员工");
  327. return;
  328. }
  329. bool reslut = getClerkByPartIdAndPassNo(revStr);
  330. if (reslut) {
  331. isChoose = true;
  332. mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
  333. loginMedicalCare();
  334. }
  335. else {
  336. Intent* intent = new Intent();
  337. intent->putExtra(functionWindows, "warn");
  338. intent->putExtra(warnText, LANGUAGEMANAGER->getValue("PassNoError"));
  339. EASYUICONTEXT->openActivity("functionActivity", intent);
  340. }
  341. }
  342. /**
  343. * 注册定时器
  344. * 填充数组用于注册定时器
  345. * 注意:id不能重复
  346. */
  347. static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  348. //{0, 6000}, //定时器id=0, 时间间隔6秒
  349. //{1, 1000},
  350. };
  351. /**
  352. * 当界面构造时触发
  353. */
  354. static void onUI_init(){
  355. //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
  356. Json::Value frameRoom = getFrame();
  357. frameFullName = frameRoom["frame_room"]["full_name"].asString();
  358. mPositionTextViewPtr->setText(frameFullName);
  359. mRoomPatrolTextViewPtr->setText(frameFullName);
  360. Json::Value frameBedList = frameRoom["frame_bed_list"];
  361. if (frameBedList.size() > 0) {
  362. for (int i = 0; i < frameBedList.size(); i++) {
  363. string frameBedName = frameBedList[i]["frame_bed"]["full_name"].asString();
  364. int nPos = frameBedName.find("-");
  365. if (nPos != -1) {
  366. frameBedName = frameBedName.substr(nPos + 1, frameBedName.length());
  367. }
  368. frameBedNameList += frameBedName;
  369. frameBedNameList += "、";
  370. }
  371. }
  372. frameBedNameList.substr(0, frameBedNameList.length() - 1);
  373. }
  374. /**
  375. * 当切换到该界面时触发
  376. */
  377. static void onUI_intent(const Intent *intentPtr) {
  378. if (intentPtr != NULL) {
  379. //TODO
  380. }
  381. }
  382. /*
  383. * 当界面显示时触发
  384. */
  385. static void onUI_show() {
  386. if (isChoose) {
  387. mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
  388. mLoginWindowPtr->hideWnd();
  389. mChooseClerkWindowPtr->hideWnd();
  390. mMedicalCareWindowPtr->showWnd();
  391. setPositionButton(isPosition);
  392. setRoomPatrolButton(isRoomPatrol);
  393. setNursingButton(isNursing);
  394. }
  395. else {
  396. chooseId = 0;
  397. mLoginWindowPtr->showWnd();
  398. mChooseClerkWindowPtr->hideWnd();
  399. mMedicalCareWindowPtr->hideWnd();
  400. }
  401. }
  402. /*
  403. * 当界面隐藏时触发
  404. */
  405. static void onUI_hide() {
  406. }
  407. /*
  408. * 当界面完全退出时触发
  409. */
  410. static void onUI_quit() {
  411. }
  412. /**
  413. * 串口数据回调接口
  414. */
  415. static void onProtocolDataUpdate(const SProtocolData &data) {
  416. }
  417. /**
  418. * 定时器触发函数
  419. * 不建议在此函数中写耗时操作,否则将影响UI刷新
  420. * 参数: id
  421. * 当前所触发定时器的id,与注册时的id相同
  422. * 返回值: true
  423. * 继续运行当前定时器
  424. * false
  425. * 停止运行当前定时器
  426. */
  427. static bool onUI_Timer(int id){
  428. switch (id) {
  429. default:
  430. break;
  431. }
  432. return true;
  433. }
  434. /**
  435. * 有新的触摸事件时触发
  436. * 参数:ev
  437. * 新的触摸事件
  438. * 返回值:true
  439. * 表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
  440. * false
  441. * 触摸事件将继续传递到控件上
  442. */
  443. static bool onmedicalCareActivityTouchEvent(const MotionEvent &ev) {
  444. switch (ev.mActionStatus) {
  445. case MotionEvent::E_ACTION_DOWN://触摸按下
  446. //LOGD("时刻 = %ld 坐标 x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
  447. break;
  448. case MotionEvent::E_ACTION_MOVE://触摸滑动
  449. break;
  450. case MotionEvent::E_ACTION_UP: //触摸抬起
  451. break;
  452. default:
  453. break;
  454. }
  455. return false;
  456. }
  457. static void onEditTextChanged_JobNumberEditText(const std::string &text) {
  458. //LOGD(" onEditTextChanged_ JobNumberEditText %s !!!\n", text.c_str());
  459. }
  460. static void onEditTextChanged_PasswordEditText(const std::string &text) {
  461. //LOGD(" onEditTextChanged_ PasswordEditText %s !!!\n", text.c_str());
  462. }
  463. static bool onButtonClick_EnteringMedicalCareButton(ZKButton *pButton) {
  464. LOGD(" ButtonClick EnteringMedicalCareButton !!!\n");
  465. string password = mPasswordEditTextPtr->getText();
  466. //密码为当前日时
  467. struct tm *t = TimeHelper::getDateTime();
  468. char cpwd[10];
  469. sprintf(cpwd,"%02d%02d",t->tm_mday,t->tm_hour);
  470. LOGD("cpwd is %s", cpwd);
  471. if (password == cpwd) {
  472. getClerkList();
  473. if (clerkList.size() > 0) {
  474. mLoginWindowPtr->hideWnd();
  475. mChooseClerkWindowPtr->showWnd();
  476. }
  477. else {
  478. Intent* intent = new Intent();
  479. intent->putExtra(functionWindows, "warn");
  480. intent->putExtra(warnText, LANGUAGEMANAGER->getValue("ConfigureEmployeeID"));
  481. EASYUICONTEXT->openActivity("functionActivity", intent);
  482. }
  483. }
  484. else {
  485. Intent* intent = new Intent();
  486. intent->putExtra(functionWindows, "warn");
  487. intent->putExtra(warnText, LANGUAGEMANAGER->getValue("WrongPassword"));
  488. EASYUICONTEXT->openActivity("functionActivity", intent);
  489. }
  490. return false;
  491. }
  492. static bool onButtonClick_PositionButton(ZKButton *pButton) {
  493. LOGD(" ButtonClick PositionButton !!!\n");
  494. setPosition(true);
  495. Intent* intent = new Intent();
  496. intent->putExtra(functionWindows, "position");
  497. intent->putExtra(functionText, frameFullName);
  498. EASYUICONTEXT->openActivity("functionActivity", intent);
  499. return false;
  500. }
  501. static bool onButtonClick_RoomPatrolButton(ZKButton *pButton) {
  502. LOGD(" ButtonClick RoomPatrolButton !!!\n");
  503. setRoomPatrol(true);
  504. Intent* intent = new Intent();
  505. intent->putExtra(functionWindows, "roomPatrol");
  506. intent->putExtra(functionText, frameFullName);
  507. EASYUICONTEXT->openActivity("functionActivity", intent);
  508. return false;
  509. }
  510. static bool onButtonClick_NursingButton(ZKButton *pButton) {
  511. LOGD(" ButtonClick NursingButton !!!\n");
  512. if (!isNursing) {
  513. Intent* intent = new Intent();
  514. intent->putExtra(functionWindows, "nursing");
  515. intent->putExtra(functionText, frameBedNameList);
  516. intent->putExtra(nursingText, frameFullName);
  517. EASYUICONTEXT->openActivity("functionActivity", intent);
  518. }
  519. else {
  520. Intent* intent = new Intent();
  521. intent->putExtra(functionWindows, "nursingEnd");
  522. intent->putExtra(functionText, frameBedNameList);
  523. EASYUICONTEXT->openActivity("functionActivity", intent);
  524. }
  525. return false;
  526. }
  527. static bool onButtonClick_PromptButton(ZKButton *pButton) {
  528. LOGD(" ButtonClick PromptButton !!!\n");
  529. EASYUICONTEXT->openActivity("promptActivity");
  530. return false;
  531. }
  532. static bool onButtonClick_LogoutButton(ZKButton *pButton) {
  533. LOGD(" ButtonClick LogoutButton !!!\n");
  534. Intent* intent = new Intent();
  535. intent->putExtra(functionWindows, "logoutMedicalCare");
  536. intent->putExtra(goActivity, "");
  537. EASYUICONTEXT->openActivity("functionActivity", intent);
  538. return false;
  539. }
  540. static int getListItemCount_ClerkListView(const ZKListView *pListView) {
  541. //LOGD("getListItemCount_ClerkListView !\n");
  542. return clerkList.size();
  543. }
  544. static void obtainListItemData_ClerkListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
  545. //LOGD(" obtainListItemData_ ClerkListView !!!\n");
  546. pListItem->setText(clerkList[index]["clerk_name"].asCString());
  547. if (index == chooseId) {
  548. pListItem->setSelected(true);
  549. clerk = clerkList[index];
  550. LOGD("clerk pass no == %s", clerk["pass_no"].asCString());
  551. }
  552. else {
  553. pListItem->setSelected(false);
  554. }
  555. }
  556. static void onListItemClick_ClerkListView(ZKListView *pListView, int index, int id) {
  557. //LOGD(" onListItemClick_ ClerkListView !!!\n");
  558. chooseId = index;
  559. }
  560. static bool onButtonClick_EnteringButton(ZKButton *pButton) {
  561. LOGD(" ButtonClick EnteringButton !!!\n");
  562. isChoose = true;
  563. mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
  564. mChooseClerkWindowPtr->hideWnd();
  565. mMedicalCareWindowPtr->showWnd();
  566. loginMedicalCare();
  567. return false;
  568. }