medicalCareLogic.cc 18 KB

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