medicalCareLogic.cc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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. std::string getClerkPassNo() {
  70. return clerk["pass_no"].asCString();
  71. }
  72. void setClerk(std::string clerk_name, std::string pass_no, int _authItid) {
  73. isChoose = true;
  74. clerk["clerk_name"] = clerk_name;
  75. clerk["pass_no"] = pass_no;
  76. authItId = _authItid;
  77. }
  78. int getAuthItId() {
  79. return authItId;
  80. }
  81. void setAuthItId(int id) {
  82. authItId = id;
  83. }
  84. void setPosistionItId(int id) {
  85. positionItId = id;
  86. }
  87. void setRoomCheckItId(int id) {
  88. roomCheckItId = id;
  89. }
  90. void setPositionButton(bool setPosition) {
  91. isPosition = setPosition;
  92. if (mActivityPtr == NULL) {
  93. return;
  94. }
  95. if (setPosition) {
  96. mPositionPainterPtr->setBackgroundPic("medicalCare/ding-y.png");
  97. mPositionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/yellow_225x317.png");
  98. mPositionButtonPtr->setText(LANGUAGEMANAGER->getValue("Positioned"));
  99. mPositionButtonPtr->setTextColor(0xFFFFFFFF);
  100. mPositionTextViewPtr->setTextColor(0xFFFFFFFF);
  101. mPositionButtonPtr->setTouchable(false);
  102. }
  103. else {
  104. mPositionPainterPtr->setBackgroundPic("medicalCare/ding.png");
  105. mPositionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/white_225x317.png");
  106. mPositionButtonPtr->setText(LANGUAGEMANAGER->getValue("Position"));
  107. mPositionButtonPtr->setTextColor(0xFF000000);
  108. mPositionTextViewPtr->setTextColor(0xFF7D7D7D);
  109. mPositionButtonPtr->setTouchable(true);
  110. }
  111. }
  112. void setPosition(bool setPosition) {
  113. if (setPosition) {
  114. setPositionButton(setPosition);
  115. Json::Value json;
  116. json["passNo"] = clerk["pass_no"].asCString();
  117. json["operationData"] = "";
  118. TcpModel tcpModel;
  119. tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  120. tcpModel.type = TcpType::POSITION;
  121. tcpModel.action = PositionAction::POSITION_START;
  122. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  123. tcpModel.to_id = 0;
  124. tcpModel.json = json;
  125. sendTcpModel(tcpModel);
  126. }
  127. else {
  128. setPositionButton(setPosition);
  129. if (positionItId != 0) {
  130. // TcpModel tcpModel;
  131. // tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  132. // tcpModel.type = TcpType::POSITION;
  133. // tcpModel.action = PositionAction::POSITION_END;
  134. // tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  135. // tcpModel.to_id = 0;
  136. // tcpModel.data = to_string(positionItId);
  137. // sendTcpModel(tcpModel);
  138. positionItId = 0;
  139. }
  140. }
  141. }
  142. void setRoomPatrolButton(bool setRoomPatrol) {
  143. isRoomPatrol = setRoomPatrol;
  144. if (mActivityPtr == NULL) {
  145. return;
  146. }
  147. if (setRoomPatrol) {
  148. mRoomPatrolPainterPtr->setBackgroundPic("medicalCare/xun-y.png");
  149. mRoomPatrolButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/green_225x317.png");
  150. mRoomPatrolButtonPtr->setText(LANGUAGEMANAGER->getValue("RoomPatrolCompleted"));
  151. mRoomPatrolButtonPtr->setTextColor(0xFFFFFFFF);
  152. mRoomPatrolTextViewPtr->setTextColor(0xFFFFFFFF);
  153. mRoomPatrolButtonPtr->setTouchable(false);
  154. }
  155. else {
  156. mRoomPatrolPainterPtr->setBackgroundPic("medicalCare/xun.png");
  157. mRoomPatrolButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/white_225x317.png");
  158. mRoomPatrolButtonPtr->setText(LANGUAGEMANAGER->getValue("RoomPatrol"));
  159. mRoomPatrolButtonPtr->setTextColor(0xFF000000);
  160. mRoomPatrolTextViewPtr->setTextColor(0xFF7D7D7D);
  161. mRoomPatrolButtonPtr->setTouchable(true);
  162. }
  163. }
  164. void setRoomPatrol(bool setRoomPatrol) {
  165. if (setRoomPatrol) {
  166. setRoomPatrolButton(setRoomPatrol);
  167. Json::Value json;
  168. json["passNo"] = clerk["pass_no"].asCString();
  169. json["operationData"] = "";
  170. TcpModel tcpModel;
  171. tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  172. tcpModel.type = TcpType::ROOMCHECK;
  173. tcpModel.action = RoomCheckAction::START;
  174. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  175. tcpModel.to_id = 0;
  176. tcpModel.json = json;
  177. sendTcpModel(tcpModel);
  178. }
  179. else {
  180. setRoomPatrolButton(setRoomPatrol);
  181. if (roomCheckItId != 0) {
  182. // TcpModel tcpModel;
  183. // tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  184. // tcpModel.type = TcpType::ROOMCHECK;
  185. // tcpModel.action = RoomCheckAction::END;
  186. // tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  187. // tcpModel.to_id = 0;
  188. // tcpModel.data = to_string(roomCheckItId);
  189. // sendTcpModel(tcpModel);
  190. //
  191. roomCheckItId = 0;
  192. }
  193. }
  194. }
  195. void setNursingEnd() {
  196. StoragePreferences::putBool(STORE_NURSING_TYPE, false);
  197. if (StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, "") != "") { // 对比一下,json里面不为空的时候
  198. // 发送tcp, tcp_type = SIDE, tcp_action = NURSING_END
  199. TcpModel tcpModel;
  200. tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
  201. tcpModel.type = TcpType::SIDE;
  202. tcpModel.action = SideAction::NURSING_END;
  203. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  204. tcpModel.data = StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, ""); // 获取nursingTcpModel里,id字段的数据
  205. sendTcpModel(tcpModel);
  206. // 需要把护理的interactionId清空
  207. StoragePreferences::putString(STORE_NURSING_INTERACTION_ID, "");
  208. }
  209. }
  210. void setNursingButton(bool setNursing) {
  211. isNursing = setNursing;
  212. if (mActivityPtr == NULL) {
  213. return;
  214. }
  215. if (setNursing) {
  216. mNursingPainterPtr->setBackgroundPic("medicalCare/hu-y.png");
  217. mNursingButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/pink_225x317.png");
  218. mNursingButtonPtr->setText(LANGUAGEMANAGER->getValue("InNursing"));
  219. mNursingButtonPtr->setTextColor(0xFFFFFFFF);
  220. mNursingTextViewPtr->setTextColor(0xFFFFFFFF);
  221. }
  222. else {
  223. mNursingPainterPtr->setBackgroundPic("medicalCare/hu.png");
  224. mNursingButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "medicalCare/white_225x317.png");
  225. mNursingButtonPtr->setText(LANGUAGEMANAGER->getValue("Nursing"));
  226. mNursingButtonPtr->setTextColor(0xFF000000);
  227. mNursingTextViewPtr->setTextColor(0xFF7D7D7D);
  228. }
  229. }
  230. void setNursing(bool setNursing) {
  231. if (setNursing) {
  232. setNursingButton(setNursing);
  233. // 门灯控制
  234. std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
  235. if (color != "" && color.size() == 3) {
  236. color = color + "F";
  237. } else {
  238. color = "010F";
  239. }
  240. lightControl("DOORLED", color);
  241. // 发送tcp, tcp_type = SIDE, tcp_action = NURSING
  242. TcpModel tcpModel;
  243. tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
  244. tcpModel.type = TcpType::SIDE;
  245. tcpModel.action = SideAction::NURSING;
  246. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  247. tcpModel.to_id = 0;
  248. sendTcpModel(tcpModel);
  249. // 把护理状态缓存起来
  250. StoragePreferences::putBool(STORE_NURSING_TYPE, true);
  251. }
  252. else {
  253. setNursingButton(setNursing);
  254. lightControl("DOORLED", "000F");
  255. setNursingEnd();
  256. }
  257. }
  258. void logoutMedicalCare() {
  259. isChoose = false;
  260. setPosition(false);
  261. setRoomPatrol(false);
  262. setNursing(false);
  263. clerk.clear();
  264. if (mActivityPtr != NULL) {
  265. mPasswordEditTextPtr->setText("");
  266. mMedicalCareWindowPtr->hideWnd();
  267. mChooseClerkWindowPtr->hideWnd();
  268. mLoginWindowPtr->showWnd();
  269. }
  270. if (authItId != 0) {
  271. // 发送tcp, tcp_type = AUTH, tcp_action = LOGOUT
  272. TcpModel tcpModel;
  273. tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
  274. tcpModel.type = TcpType::AUTH;
  275. tcpModel.action = AuthAction::LOGOUT;
  276. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  277. tcpModel.to_id = 0;
  278. tcpModel.data = to_string(authItId);
  279. sendTcpModel(tcpModel);
  280. authItId = 0;
  281. }
  282. }
  283. /**
  284. * 注册定时器
  285. * 填充数组用于注册定时器
  286. * 注意:id不能重复
  287. */
  288. static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  289. //{0, 6000}, //定时器id=0, 时间间隔6秒
  290. //{1, 1000},
  291. };
  292. /**
  293. * 当界面构造时触发
  294. */
  295. static void onUI_init(){
  296. //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
  297. Json::Value frameRoom = getFrame();
  298. frameFullName = frameRoom["frame_room"]["full_name"].asString();
  299. mPositionTextViewPtr->setText(frameFullName);
  300. mRoomPatrolTextViewPtr->setText(frameFullName);
  301. Json::Value frameBedList = frameRoom["frame_bed_list"];
  302. if (frameBedList.size() > 0) {
  303. for (int i = 0; i < frameBedList.size(); i++) {
  304. string frameBedName = frameBedList[i]["frame_bed"]["full_name"].asString();
  305. int nPos = frameBedName.find("-");
  306. if (nPos != -1) {
  307. frameBedName = frameBedName.substr(nPos + 1, frameBedName.length());
  308. }
  309. frameBedNameList += frameBedName;
  310. frameBedNameList += "、";
  311. }
  312. }
  313. frameBedNameList.substr(0, frameBedNameList.length() - 1);
  314. }
  315. /**
  316. * 当切换到该界面时触发
  317. */
  318. static void onUI_intent(const Intent *intentPtr) {
  319. if (intentPtr != NULL) {
  320. //TODO
  321. }
  322. }
  323. /*
  324. * 当界面显示时触发
  325. */
  326. static void onUI_show() {
  327. if (isChoose) {
  328. mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
  329. mLoginWindowPtr->hideWnd();
  330. mChooseClerkWindowPtr->hideWnd();
  331. mMedicalCareWindowPtr->showWnd();
  332. setPositionButton(isPosition);
  333. setRoomPatrolButton(isRoomPatrol);
  334. setNursingButton(isNursing);
  335. }
  336. else {
  337. chooseId = 0;
  338. mLoginWindowPtr->showWnd();
  339. mChooseClerkWindowPtr->hideWnd();
  340. mMedicalCareWindowPtr->hideWnd();
  341. }
  342. EASYUICONTEXT->showStatusBar();
  343. EASYUICONTEXT->showNaviBar();
  344. }
  345. /*
  346. * 当界面隐藏时触发
  347. */
  348. static void onUI_hide() {
  349. }
  350. /*
  351. * 当界面完全退出时触发
  352. */
  353. static void onUI_quit() {
  354. }
  355. /**
  356. * 串口数据回调接口
  357. */
  358. static void onProtocolDataUpdate(const SProtocolData &data) {
  359. }
  360. /**
  361. * 定时器触发函数
  362. * 不建议在此函数中写耗时操作,否则将影响UI刷新
  363. * 参数: id
  364. * 当前所触发定时器的id,与注册时的id相同
  365. * 返回值: true
  366. * 继续运行当前定时器
  367. * false
  368. * 停止运行当前定时器
  369. */
  370. static bool onUI_Timer(int id){
  371. switch (id) {
  372. default:
  373. break;
  374. }
  375. return true;
  376. }
  377. /**
  378. * 有新的触摸事件时触发
  379. * 参数:ev
  380. * 新的触摸事件
  381. * 返回值:true
  382. * 表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
  383. * false
  384. * 触摸事件将继续传递到控件上
  385. */
  386. static bool onmedicalCareActivityTouchEvent(const MotionEvent &ev) {
  387. switch (ev.mActionStatus) {
  388. case MotionEvent::E_ACTION_DOWN://触摸按下
  389. //LOGD("时刻 = %ld 坐标 x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
  390. break;
  391. case MotionEvent::E_ACTION_MOVE://触摸滑动
  392. break;
  393. case MotionEvent::E_ACTION_UP: //触摸抬起
  394. break;
  395. default:
  396. break;
  397. }
  398. return false;
  399. }
  400. static void onEditTextChanged_JobNumberEditText(const std::string &text) {
  401. //LOGD(" onEditTextChanged_ JobNumberEditText %s !!!\n", text.c_str());
  402. }
  403. static void onEditTextChanged_PasswordEditText(const std::string &text) {
  404. //LOGD(" onEditTextChanged_ PasswordEditText %s !!!\n", text.c_str());
  405. }
  406. static bool onButtonClick_EnteringMedicalCareButton(ZKButton *pButton) {
  407. LOGD(" ButtonClick EnteringMedicalCareButton !!!\n");
  408. string password = mPasswordEditTextPtr->getText();
  409. //密码为当前日时
  410. struct tm *t = TimeHelper::getDateTime();
  411. char cpwd[10];
  412. sprintf(cpwd,"%02d%02d",t->tm_mday,t->tm_hour);
  413. LOGD("cpwd is %s", cpwd);
  414. if (password == cpwd) {
  415. getClerkList();
  416. if (clerkList.size() > 0) {
  417. mLoginWindowPtr->hideWnd();
  418. mChooseClerkWindowPtr->showWnd();
  419. }
  420. else {
  421. Intent* intent = new Intent();
  422. intent->putExtra(functionWindows, "warn");
  423. intent->putExtra(warnText, LANGUAGEMANAGER->getValue("ConfigureEmployeeID"));
  424. EASYUICONTEXT->openActivity("functionActivity", intent);
  425. }
  426. }
  427. else {
  428. Intent* intent = new Intent();
  429. intent->putExtra(functionWindows, "warn");
  430. intent->putExtra(warnText, LANGUAGEMANAGER->getValue("WrongPassword"));
  431. EASYUICONTEXT->openActivity("functionActivity", intent);
  432. }
  433. return false;
  434. }
  435. static bool onButtonClick_PositionButton(ZKButton *pButton) {
  436. LOGD(" ButtonClick PositionButton !!!\n");
  437. setPosition(true);
  438. Intent* intent = new Intent();
  439. intent->putExtra(functionWindows, "position");
  440. intent->putExtra(functionText, frameFullName);
  441. EASYUICONTEXT->openActivity("functionActivity", intent);
  442. return false;
  443. }
  444. static bool onButtonClick_RoomPatrolButton(ZKButton *pButton) {
  445. LOGD(" ButtonClick RoomPatrolButton !!!\n");
  446. setRoomPatrol(true);
  447. Intent* intent = new Intent();
  448. intent->putExtra(functionWindows, "roomPatrol");
  449. intent->putExtra(functionText, frameFullName);
  450. EASYUICONTEXT->openActivity("functionActivity", intent);
  451. return false;
  452. }
  453. static bool onButtonClick_NursingButton(ZKButton *pButton) {
  454. LOGD(" ButtonClick NursingButton !!!\n");
  455. if (!isNursing) {
  456. Intent* intent = new Intent();
  457. intent->putExtra(functionWindows, "nursing");
  458. intent->putExtra(functionText, frameBedNameList);
  459. intent->putExtra(nursingText, frameFullName);
  460. EASYUICONTEXT->openActivity("functionActivity", intent);
  461. }
  462. else {
  463. Intent* intent = new Intent();
  464. intent->putExtra(functionWindows, "nursingEnd");
  465. intent->putExtra(functionText, frameBedNameList);
  466. EASYUICONTEXT->openActivity("functionActivity", intent);
  467. }
  468. return false;
  469. }
  470. static bool onButtonClick_PromptButton(ZKButton *pButton) {
  471. LOGD(" ButtonClick PromptButton !!!\n");
  472. EASYUICONTEXT->openActivity("promptActivity");
  473. return false;
  474. }
  475. static bool onButtonClick_LogoutButton(ZKButton *pButton) {
  476. LOGD(" ButtonClick LogoutButton !!!\n");
  477. Intent* intent = new Intent();
  478. intent->putExtra(functionWindows, "logoutMedicalCare");
  479. intent->putExtra(goActivity, "");
  480. EASYUICONTEXT->openActivity("functionActivity", intent);
  481. return false;
  482. }
  483. static int getListItemCount_ClerkListView(const ZKListView *pListView) {
  484. //LOGD("getListItemCount_ClerkListView !\n");
  485. return clerkList.size();
  486. }
  487. static void obtainListItemData_ClerkListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
  488. //LOGD(" obtainListItemData_ ClerkListView !!!\n");
  489. pListItem->setText(clerkList[index]["clerk_name"].asCString());
  490. if (index == chooseId) {
  491. pListItem->setSelected(true);
  492. clerk = clerkList[index];
  493. LOGD("clerk pass no == %s", clerk["pass_no"].asCString());
  494. }
  495. else {
  496. pListItem->setSelected(false);
  497. }
  498. }
  499. static void onListItemClick_ClerkListView(ZKListView *pListView, int index, int id) {
  500. //LOGD(" onListItemClick_ ClerkListView !!!\n");
  501. chooseId = index;
  502. }
  503. static bool onButtonClick_EnteringButton(ZKButton *pButton) {
  504. LOGD(" ButtonClick EnteringButton !!!\n");
  505. isChoose = true;
  506. mClerkNameTextViewPtr->setText(clerk["clerk_name"].asString() + " " + clerk["role_name"].asString());
  507. mChooseClerkWindowPtr->hideWnd();
  508. mMedicalCareWindowPtr->showWnd();
  509. Json::Value json;
  510. json["passNo"] = clerk["pass_no"].asCString();
  511. json["operationData"] = "";
  512. // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
  513. TcpModel tcpModel;
  514. tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
  515. tcpModel.type = TcpType::AUTH;
  516. tcpModel.action = AuthAction::LOGIN;
  517. tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
  518. tcpModel.to_id = 0;
  519. tcpModel.json = json;
  520. sendTcpModel(tcpModel);
  521. if (StoragePreferences::getInt(STORE_AUTO_POSITION, 0)) {
  522. setPosition(true);
  523. }
  524. return false;
  525. }