HospitalClient.cpp 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061
  1. // HospitalClient.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "HospitalClient.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "NeroDlg.h"
  9. #include "ClientRequirement.h"
  10. #include "ChooseDesignSkin.h"
  11. #include "./helper/ffsco.h"
  12. #include "AddHospitalClient.h"
  13. #include "SendMsgDlg.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. #pragma comment(lib, "Shlwapi.lib")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // HospitalClient
  22. IMPLEMENT_DYNCREATE(HospitalClient, MyFormView)
  23. HospitalClient::HospitalClient()
  24. : MyFormView(HospitalClient::IDD)
  25. {
  26. m_datetype = 0;
  27. m_date2 = GetTmFromStr(g_date);
  28. m_date1 = m_date2 - CTimeSpan(30, 0, 0, 0);
  29. m_addr = _T("");
  30. m_phone = _T("");
  31. m_bSearchAll = 0;
  32. m_id = _T("");
  33. m_name = _T("");
  34. //}}AFX_DATA_INIT
  35. }
  36. HospitalClient::~HospitalClient()
  37. {
  38. }
  39. void HospitalClient::DoDataExchange(CDataExchange* pDX)
  40. {
  41. MyFormView::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(HospitalClient)
  43. DDX_Control(pDX, IDC_COMBOclerk, clerkCombo);
  44. DDX_Control(pDX, IDC_COMBOtype, typeCombo);
  45. DDX_Control(pDX, IDC_COMBOfrom, fromCombo);
  46. DDX_Control(pDX, IDC_COMBOhospital, hospitalCombo);
  47. DDX_Control(pDX, IDC_COMBObusinessintention, businessintentionCombo);
  48. DDX_Control(pDX, IDC_COMBObusinesstype, businesstypeCombo);
  49. DDX_Control(pDX, IDC_LIST2, m_List1);
  50. DDX_Control(pDX, IDC_STATIC1, m_static1);
  51. DDX_Radio(pDX, IDC_RADIO1, m_datetype);
  52. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKERdate1, m_date1);
  53. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKERdate2, m_date2);
  54. DDX_Text(pDX, IDC_EDITaddr1, m_addr);
  55. DDX_Text(pDX, IDC_EDITphone1, m_phone);
  56. DDX_Text(pDX, IDC_EDITid, m_id);
  57. DDX_Text(pDX, IDC_EDITname, m_name);
  58. //}}AFX_DATA_MAP
  59. }
  60. BEGIN_MESSAGE_MAP(HospitalClient, MyFormView)
  61. //{{AFX_MSG_MAP(HospitalClient)
  62. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  63. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  64. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  65. ON_WM_TIMER()
  66. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  67. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  68. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  69. ON_BN_CLICKED(IDC_BUTburncd, OnBUTHospitalClient)
  70. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  71. ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
  72. ON_BN_CLICKED(IDC_BUTburncd3, OnBUTburncd3)
  73. ON_BN_CLICKED(IDC_BUTsendmsg, OnBUTsendmsg)
  74. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  75. //}}AFX_MSG_MAP
  76. END_MESSAGE_MAP()
  77. /////////////////////////////////////////////////////////////////////////////
  78. // HospitalClient diagnostics
  79. #ifdef _DEBUG
  80. void HospitalClient::AssertValid() const
  81. {
  82. MyFormView::AssertValid();
  83. }
  84. void HospitalClient::Dump(CDumpContext& dc) const
  85. {
  86. MyFormView::Dump(dc);
  87. }
  88. #endif //_DEBUG
  89. /////////////////////////////////////////////////////////////////////////////
  90. // HospitalClient message handlers
  91. void HospitalClient::OnInitialUpdate()
  92. {
  93. //AfxMessageBox("意向查询");//Jeff
  94. MyFormView::OnInitialUpdate();
  95. // GetDlgItem(IDC_BUTburncd)->EnableWindow(IsHasRights2new(0));
  96. // GetDlgItem(IDC_BUTburncd2)->EnableWindow(IsHasRights2new(0));
  97. GetDlgItem(IDC_BUTburncd3)->EnableWindow(IsHasRights2new(49));
  98. GetDlgItem(IDC_BUTprint3)->EnableWindow(IsHasRights2new(49));
  99. // TODO: Add your specialized code here and/or call the base class
  100. CMyMdi Mdi;
  101. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  102. // Here we create the outbar control using the splitter as its parent
  103. // and setting its id to the first pane.
  104. CRect rc2;
  105. GetWindowRect(rc2);
  106. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  107. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  108. #if defined(VC70) || defined(VC80)
  109. typeCombo.GetWindowRect(rc2);
  110. rc2.bottom += 200;
  111. ScreenToClient(rc2);
  112. typeCombo.MoveWindow(rc2);
  113. fromCombo.GetWindowRect(rc2);
  114. rc2.bottom += 200;
  115. ScreenToClient(rc2);
  116. fromCombo.MoveWindow(rc2);
  117. hospitalCombo.GetWindowRect(rc2);
  118. rc2.bottom += 200;
  119. ScreenToClient(rc2);
  120. hospitalCombo.MoveWindow(rc2);
  121. businessintentionCombo.GetWindowRect(rc2);
  122. rc2.bottom += 200;
  123. ScreenToClient(rc2);
  124. businessintentionCombo.MoveWindow(rc2);
  125. businesstypeCombo.GetWindowRect(rc2);
  126. rc2.bottom += 200;
  127. ScreenToClient(rc2);
  128. businesstypeCombo.MoveWindow(rc2);
  129. #endif
  130. int idarray[] = { IDC_BUTburncd, IDC_BUTburncd2, IDC_BUTburncd3, IDC_BUTsendmsg, IDC_BUTprint3, IDC_BUTclose };
  131. int idcount = 6;
  132. int btnwid;
  133. CRect prerc;
  134. for (int a = idcount - 2; a >= 0; a--)
  135. {
  136. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  137. ScreenToClient(prerc);
  138. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  139. ScreenToClient(rc2);
  140. btnwid = rc2.Width();
  141. rc2.right = prerc.left;
  142. rc2.left = rc2.right - btnwid;
  143. GetDlgItem(idarray[a])->MoveWindow(rc2);
  144. }
  145. m_static1.SetFont(&g_titlefont);
  146. #if 0 // Jeff 2014.05.19
  147. m_List1.SetHeadings("来单批号,100;客户姓名,100;宝宝姓名,100;宝宝性别,100;区域,100;类别,100;医院,100;电话1,100;电话2,100;QQ,100;地址1,100;地址2,100;地址3,100;录入日期,100;门市,100;录入员,100;业务种类,100;业务意向,100;预约日期,100;上门地址,100;备注,100" );
  148. #else
  149. m_List1.SetHeadings("来单批号,100;客户姓名,100;宝宝姓名,100;宝宝性别,100;生日类型,100;宝宝生日/预产期,130;区域,100;类别,100;医院,100;电话1,100;电话2,100;QQ,100;地址1,100;地址2,100;地址3,100;录入日期,100;门市,100;录入员,100;业务种类,100;业务意向,100;预约日期,100;上门地址,100;备注,100");
  150. #endif
  151. m_List1.LoadColumnInfo(144);
  152. m_List1.m_bSortSupport = 0;
  153. g_sendhead.bsql = 0;
  154. g_sendhead.code[0] = 200;
  155. g_sendhead.code[1] = 201;
  156. g_sendhead.code[2] = 202;
  157. g_sendhead.code[3] = 203;
  158. g_sendhead.code[4] = 82;
  159. g_sendhead.tabcount = 5;
  160. //LOG4C((LOG_NOTICE,"ProcessChatMessageRequest2=3"));
  161. g_pMainWnd->ProcessChatMessageRequest2(3);
  162. if (g_bSendOK)
  163. {
  164. CArray<CStringArray, CStringArray>List1array;
  165. CArray<CStringArray, CStringArray>List2array;
  166. CArray<CStringArray, CStringArray>List3array;
  167. CArray<CStringArray, CStringArray>List4array;
  168. CArray<CStringArray, CStringArray>List5array;
  169. DataToArray(&List1array, &List2array, &List3array, &List4array, &List5array);
  170. int ii = 0;
  171. for ( ii = 0; ii < List1array.GetSize(); ii++)
  172. businesstypeCombo.AddString(List1array.ElementAt(ii).ElementAt(0));
  173. for (ii = 0; ii < List2array.GetSize(); ii++)
  174. businessintentionCombo.AddString(List2array.ElementAt(ii).ElementAt(0));
  175. for (ii = 0; ii < List3array.GetSize(); ii++)
  176. typeCombo.AddString(List3array.ElementAt(ii).ElementAt(0));
  177. for (ii = 0; ii < List4array.GetSize(); ii++)
  178. hospitalCombo.AddString(List4array.ElementAt(ii).ElementAt(0));
  179. for (ii = 0; ii < List5array.GetSize(); ii++)
  180. fromCombo.AddString(List5array.ElementAt(ii).ElementAt(0));
  181. businesstypeCombo.AddString("");
  182. businessintentionCombo.AddString("");
  183. typeCombo.AddString("");
  184. hospitalCombo.AddString("");
  185. fromCombo.AddString("");
  186. }
  187. GetData();
  188. }
  189. void HospitalClient::OnBUTclose()
  190. {
  191. // TODO: Add your control notification handler code here
  192. GetParent()->SendMessage(WM_CLOSE);
  193. }
  194. void HospitalClient::OnSelchangeCombo1()
  195. {
  196. // TODO: Add your control notification handler code here
  197. SetTimer(1, 100, NULL);
  198. }
  199. void HospitalClient::OnTimer(UINT nIDEvent)
  200. {
  201. // TODO: Add your message handler code here and/or call default
  202. KillTimer(nIDEvent);
  203. OnButton1();
  204. }
  205. BOOL HospitalClient::PreTranslateMessage(MSG* pMsg)
  206. {
  207. // TODO: Add your specialized code here and/or call the base class
  208. try
  209. {
  210. if (pMsg->message == WM_KEYDOWN)
  211. {
  212. switch (pMsg->wParam)
  213. {
  214. case VK_RETURN:
  215. OnButton1();
  216. return 1;
  217. case 0x43: // copy
  218. if ((GetKeyState(VK_CONTROL) & 0x80))
  219. {
  220. GetFocus()->SendMessage(WM_COPY);
  221. return TRUE;
  222. }
  223. break;
  224. case 0x56: //Ctrl + V:
  225. if ((GetKeyState(VK_CONTROL) & 0x80))
  226. {
  227. GetFocus()->SendMessage(WM_PASTE);
  228. return TRUE;
  229. }
  230. break;
  231. case 0x58: // cut
  232. if ((GetKeyState(VK_CONTROL) & 0x80))
  233. {
  234. GetFocus()->SendMessage(WM_CUT);
  235. return TRUE;
  236. }
  237. break;
  238. case 0x5A: //undo
  239. case 0x59: //redo
  240. if ((GetKeyState(VK_CONTROL) & 0x80))
  241. {
  242. GetFocus()->SendMessage(WM_UNDO);
  243. return TRUE;
  244. }
  245. break;
  246. }
  247. }
  248. }
  249. catch (...)
  250. {
  251. }
  252. return MyFormView::PreTranslateMessage(pMsg);
  253. }
  254. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  255. /*{
  256. switch(msg)
  257. {
  258. case BFFM_INITIALIZED:
  259. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  260. break;
  261. case BFFM_SELCHANGED:
  262. {
  263. char szFileName[MAX_PATH];
  264. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  265. SHGetPathFromIDList(pidlCurrent, szFileName);
  266. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  267. }
  268. break;
  269. }
  270. return 0;
  271. }*/
  272. void HospitalClient::GetSavePath(CString &path)
  273. {
  274. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  275. LPITEMIDLIST pidlDesktop, pidlCurrent;
  276. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
  277. == NOERROR)
  278. {
  279. BROWSEINFO bi;
  280. bi.hwndOwner = this->m_hWnd;
  281. bi.pidlRoot = pidlDesktop;
  282. bi.pszDisplayName = lpszDisplayName;
  283. bi.lpszTitle = "\n文档保存的目录:";
  284. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  285. bi.lpfn = BrowseProc;
  286. bi.lParam = 0;
  287. bi.iImage = 0;
  288. pidlCurrent = SHBrowseForFolder(&bi);
  289. SHGetPathFromIDList(pidlCurrent, szFileName);
  290. path = szFileName;
  291. }
  292. }
  293. int HospitalClient::FindArray(CStringArray *pArray, CString Str)
  294. {
  295. for (int i = 0; i < pArray->GetSize(); i++)
  296. {
  297. if (pArray->ElementAt(i) == Str)
  298. return i;
  299. }
  300. return -1;
  301. }
  302. void HospitalClient::GetNo(CString str, CStringArray &array)
  303. {
  304. if (!str.IsEmpty())
  305. {
  306. #ifdef USE_SEP_VEB
  307. int pos = str.Find(SEPS_VEB);
  308. #else
  309. int pos = str.Find(",");
  310. #endif
  311. while (pos != -1)
  312. {
  313. if (FindArray(&array, str.Left(pos)) == -1)
  314. array.Add(str.Left(pos));
  315. str = str.Right(str.GetLength() - pos - 1);
  316. #ifdef USE_SEP_VEB
  317. pos = str.Find(SEPS_VEB);
  318. #else
  319. pos = str.Find(",");
  320. #endif
  321. }
  322. if (FindArray(&array, str) == -1)
  323. array.Add(str);
  324. }
  325. }
  326. CString HospitalClient::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  327. {
  328. CString ret;
  329. #ifdef USE_SEP_VEB
  330. name = SEPS_VEB + name + SEPS_VEB;
  331. #else
  332. name = "," + name + ",";
  333. #endif
  334. CString str;
  335. for (int i = 0; i < spnamearray.GetSize(); i++)
  336. {
  337. #ifdef USE_SEP_VEB
  338. str = SEPS_VEB + spnamearray.ElementAt(i).ElementAt(6) + SEPS_VEB;
  339. #else
  340. str = "," + spnamearray.ElementAt(i).ElementAt(6) + ",";
  341. #endif
  342. if (str.Find(name) != -1)
  343. {
  344. ret += spnamearray.ElementAt(i).ElementAt(5);
  345. ret += ";";
  346. }
  347. }
  348. ret.TrimRight(";");
  349. ret.Replace("*", "x");
  350. return ret;
  351. }
  352. void HospitalClient::OnBUTshowphoto()
  353. {
  354. // TODO: Add your control notification handler code here
  355. POSITION pos;
  356. pos = m_List1.GetFirstSelectedItemPosition();
  357. if (pos == NULL)
  358. {
  359. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  360. return;
  361. }
  362. int iItem = m_List1.GetNextSelectedItem(pos);
  363. CString status = m_List1.GetItemText(iItem, 4);
  364. CString id = m_List1.GetItemText(iItem, 0);
  365. if (status == "未设计")
  366. {
  367. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  368. return;
  369. }
  370. /* ShowPic dlg;
  371. dlg.m_path=g_path3+"\\";
  372. dlg.m_path+=id;
  373. dlg.m_path +="\\";
  374. dlg.DoModal ();*/
  375. ChooseDesignSkin dlg;
  376. dlg.SetLiaPath("3.lia");
  377. dlg.m_strOrderNumber = id;
  378. dlg.m_path = g_path3 + "\\";
  379. dlg.m_path += id;
  380. dlg.m_path += "\\";
  381. dlg.DoModal();
  382. for (int i = 0; i < m_List1array.GetSize(); i++)
  383. {
  384. if (id == m_List1array.ElementAt(i).ElementAt(0))
  385. {
  386. m_List1array.ElementAt(i).SetAt(7, dlg.m_bz2);
  387. // FillGrid();
  388. break;
  389. }
  390. }
  391. }
  392. // Jeff 2014.05.20:开始查询按钮;
  393. void HospitalClient::OnButton1() // 开始查询按钮;
  394. {
  395. // TODO: Add your control notification handler code here
  396. m_bSearchAll = 0;
  397. FillGrid();
  398. }
  399. // 全部查询按钮;
  400. void HospitalClient::OnButton2()// 全部查询按钮;
  401. {
  402. // TODO: Add your control notification handler code here
  403. m_bSearchAll = 1;
  404. FillGrid();
  405. }
  406. void HospitalClient::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  407. {
  408. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  409. // TODO: Add your control notification handler code here
  410. *pResult = 0;
  411. }
  412. void HospitalClient::OnBUTHospitalClient()
  413. {
  414. // TODO: Add your control notification handler code here
  415. AddHospitalClient dlg;
  416. dlg.DoModal();
  417. GetData();
  418. }
  419. void HospitalClient::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  420. {
  421. // TODO: Add your control notification handler code here
  422. POSITION pos;
  423. pos = m_List1.GetFirstSelectedItemPosition();
  424. if (pos == NULL)return;
  425. OnBUTburncd2();
  426. *pResult = 0;
  427. }
  428. void HospitalClient::OnBUTburncd2() // 修改按钮;
  429. {
  430. // TODO: Add your control notification handler code here
  431. POSITION pos;
  432. pos = m_List1.GetFirstSelectedItemPosition();
  433. if (pos == NULL)
  434. {
  435. AfxMessageBox("请先选中您要修改的客户!", MB_ICONINFORMATION);
  436. return;
  437. }
  438. int iItem = m_List1.GetNextSelectedItem(pos);
  439. CString id = m_List1.GetItemText(iItem, 0);
  440. while (id == "")
  441. {
  442. iItem--;
  443. id = m_List1.GetItemText(iItem, 0);
  444. }
  445. AddHospitalClient dlg;
  446. dlg.bAdd = 0;
  447. dlg.no = id;
  448. dlg.DoModal();
  449. GetData();
  450. }
  451. void HospitalClient::OnBUTburncd3()
  452. {
  453. // TODO: Add your control notification handler code here
  454. POSITION pos;
  455. pos = m_List1.GetFirstSelectedItemPosition();
  456. if (pos == NULL)
  457. {
  458. AfxMessageBox("请先选中您要删除的客户!", MB_ICONINFORMATION);
  459. return;
  460. }
  461. int iItem = m_List1.GetNextSelectedItem(pos);
  462. CString id = m_List1.GetItemText(iItem, 0);
  463. while (id == "")
  464. {
  465. iItem--;
  466. id = m_List1.GetItemText(iItem, 0);
  467. }
  468. if (AfxMessageBox("确认删除吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  469. CString sql;
  470. sql.Format("delete from hospitalclient where id='%s'***delete from hospitalclientcontactreg where id='%s'", id, id);
  471. g_sendhead.bsql = 1;
  472. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  473. GetData();
  474. }
  475. void HospitalClient::OnBUTsendmsg() // 发短信 按钮;
  476. {
  477. // TODO: Add your control notification handler code here
  478. POSITION pos;
  479. pos = m_List1.GetFirstSelectedItemPosition();
  480. if (pos == NULL)
  481. {
  482. AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION);
  483. return;
  484. }
  485. int iItem;
  486. CStringArray array;
  487. while (pos)
  488. {
  489. iItem = m_List1.GetNextSelectedItem(pos);
  490. // 获取手机号码;
  491. if (!m_List1.GetItemText(iItem, 9).IsEmpty())
  492. array.Add(m_List1.GetItemText(iItem, 9));
  493. if (!m_List1.GetItemText(iItem, 10).IsEmpty())
  494. array.Add(m_List1.GetItemText(iItem, 10));
  495. }
  496. SendMsgDlg dlg;
  497. dlg.m_mode = 2;
  498. dlg.m_pArray = &array;
  499. dlg.DoModal();
  500. }
  501. void HospitalClient::OnBUTprint3() // 导出按钮;
  502. {
  503. ListToXLS(&m_List1, "c:\\意向单列表.xls", 0);
  504. }
  505. // 获取数据
  506. void HospitalClient::GetData()
  507. {
  508. g_sendhead.bsql = 0;
  509. g_sendhead.code[0] = 205;
  510. g_sendhead.tabcount = 1;
  511. g_pMainWnd->ProcessChatMessageRequest2(1);
  512. if (g_bSendOK == 0)
  513. return;
  514. DataToArray(&m_List1array);
  515. if (m_List1array.GetSize())
  516. {
  517. CString id = m_List1array.ElementAt(0).ElementAt(0);
  518. for (int ii = 1; ii < m_List1array.GetSize(); ii++)
  519. {
  520. if (m_List1array.ElementAt(ii).ElementAt(0) == id)
  521. {
  522. m_List1array.ElementAt(ii).SetAt(0, "");
  523. m_List1array.ElementAt(ii).SetAt(1, "");
  524. m_List1array.ElementAt(ii).SetAt(2, "");
  525. m_List1array.ElementAt(ii).SetAt(3, "");
  526. m_List1array.ElementAt(ii).SetAt(4, "");
  527. m_List1array.ElementAt(ii).SetAt(5, "");
  528. m_List1array.ElementAt(ii).SetAt(6, "");
  529. m_List1array.ElementAt(ii).SetAt(7, "");
  530. m_List1array.ElementAt(ii).SetAt(8, "");
  531. m_List1array.ElementAt(ii).SetAt(9, "");
  532. m_List1array.ElementAt(ii).SetAt(10, "");
  533. m_List1array.ElementAt(ii).SetAt(11, "");
  534. m_List1array.ElementAt(ii).SetAt(12, "");
  535. m_List1array.ElementAt(ii).SetAt(13, "");
  536. m_List1array.ElementAt(ii).SetAt(14, "");
  537. m_List1array.ElementAt(ii).SetAt(15, "");
  538. m_List1array.ElementAt(ii).SetAt(21, "");
  539. m_List1array.ElementAt(ii).SetAt(22, "");
  540. m_List1array.ElementAt(ii).SetAt(23, ""); // Jeff Add 20014.05.20
  541. m_List1array.ElementAt(ii).SetAt(24, ""); // Jeff Add 20014.05.20
  542. }
  543. else
  544. id = m_List1array.ElementAt(ii).ElementAt(0);
  545. }
  546. }
  547. FillGrid();
  548. }
  549. void HospitalClient::FillGrid()
  550. {
  551. UpdateData();
  552. m_List1.DeleteAllItems2();
  553. int ii = 0;
  554. int maxsize = m_List1array.GetSize();
  555. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  556. CArray<int, int>signarray;
  557. int i = 0;
  558. for ( i = 0; i < maxsize; i++)
  559. signarray.Add(1);
  560. int count = 0;
  561. CArray<int, int>posarray;
  562. if (m_bSearchAll) // 查询全部hostpitalview的记录;
  563. {
  564. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  565. {
  566. #if 0 // Jeff;
  567. // LOG4C((LOG_NOTICE,"生日类型:%s",m_List1array.ElementAt(ii).ElementAt(4)));
  568. if ( m_List1array.ElementAt(ii).ElementAt(4) == "0")
  569. m_List1array.ElementAt(ii).SetAt(4,"宝宝生日");
  570. else
  571. m_List1array.ElementAt(ii).SetAt(4,"预产期");
  572. #endif
  573. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  574. }
  575. }
  576. else
  577. {
  578. CString date1 = m_date1.Format("%Y-%m-%d");
  579. CString date2 = m_date2.Format("%Y-%m-%d");
  580. CString type, hospital, from, clerk, businesstype, businessintention;
  581. // 客户类别;
  582. int pos = typeCombo.GetCurSel();
  583. if (pos != -1)
  584. {
  585. typeCombo.GetLBText(pos, type);
  586. }
  587. // 来单医院;
  588. pos = hospitalCombo.GetCurSel();
  589. if (pos != -1)
  590. {
  591. hospitalCombo.GetLBText(pos, hospital);
  592. }
  593. // 客户区域;
  594. pos = fromCombo.GetCurSel();
  595. if (pos != -1)
  596. {
  597. fromCombo.GetLBText(pos, from);
  598. }
  599. // 门市;
  600. pos = clerkCombo.GetCurSel();
  601. if (pos != -1)
  602. {
  603. clerkCombo.GetLBText(pos, clerk);
  604. }
  605. // 业务种类;
  606. pos = businesstypeCombo.GetCurSel();
  607. if (pos != -1)
  608. {
  609. businesstypeCombo.GetLBText(pos, businesstype);
  610. }
  611. // 业务意向;
  612. pos = businessintentionCombo.GetCurSel();
  613. if (pos != -1)
  614. {
  615. businessintentionCombo.GetLBText(pos, businessintention);
  616. }
  617. // 上门时间;
  618. if (m_datetype)
  619. {
  620. BOOL bFinded = 0;
  621. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  622. {
  623. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  624. {
  625. continue;
  626. }
  627. //if(m_List1array.ElementAt (ii).ElementAt (13)<date1 || m_List1array.ElementAt (ii).ElementAt (13)>date2)//Jeff:hostpitalview加了两个字段,这里不是13
  628. if (m_List1array.ElementAt(ii).ElementAt(15) < date1 || m_List1array.ElementAt(ii).ElementAt(15) > date2)
  629. {
  630. signarray.SetAt(ii, 0);
  631. bFinded = 0;
  632. continue;
  633. }
  634. bFinded = 1;
  635. }
  636. }
  637. // 客户区域;
  638. if (from != "")
  639. {
  640. BOOL bFinded = 0;
  641. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  642. {
  643. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  644. {
  645. continue;
  646. }
  647. //if(m_List1array.ElementAt (ii).ElementAt (4)!=from)////Jeff:hostpitalview加了两个字段,这里不为4
  648. if (m_List1array.ElementAt(ii).ElementAt(6) != from)
  649. {
  650. signarray.SetAt(ii, 0);
  651. bFinded = 0;
  652. continue;
  653. }
  654. bFinded = 1;
  655. }
  656. }
  657. // 客户类别;
  658. if (type != "")
  659. {
  660. BOOL bFinded = 0;
  661. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  662. {
  663. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  664. {
  665. continue;
  666. }
  667. //if(m_List1array.ElementAt (ii).ElementAt (5)!=type)//Jeff:hostpitalview加了两个字段,这里不为5
  668. if (m_List1array.ElementAt(ii).ElementAt(7) != type)
  669. {
  670. signarray.SetAt(ii, 0);
  671. bFinded = 0;
  672. continue;
  673. }
  674. bFinded = 1;
  675. }
  676. }
  677. // 来单医院;
  678. if (hospital != "")
  679. {
  680. BOOL bFinded = 0;
  681. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  682. {
  683. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  684. {
  685. continue;
  686. }
  687. //if(m_List1array.ElementAt (ii).ElementAt (6)!=hospital)//Jeff:hostpitalview加了两个字段,这里不为6
  688. if (m_List1array.ElementAt(ii).ElementAt(8) != hospital)
  689. {
  690. signarray.SetAt(ii, 0);
  691. bFinded = 0;
  692. continue;
  693. }
  694. bFinded = 1;
  695. }
  696. }
  697. // 门市;
  698. if (clerk != "")
  699. {
  700. BOOL bFinded = 0;
  701. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  702. {
  703. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  704. {
  705. continue;
  706. }
  707. //if(m_List1array.ElementAt (ii).ElementAt (14)!=clerk)//Jeff:hostpitalview加了两个字段,这里不为14
  708. if (m_List1array.ElementAt(ii).ElementAt(16) != clerk)//
  709. {
  710. signarray.SetAt(ii, 0);
  711. bFinded = 0;
  712. continue;
  713. }
  714. bFinded = 1;
  715. }
  716. }
  717. // 手机;
  718. if (m_phone != "")
  719. {
  720. BOOL bFinded = 0;
  721. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  722. {
  723. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  724. {
  725. continue;
  726. }
  727. //Jeff:hostpitalview加了两个字段,这里不为7/8
  728. //if(m_List1array.ElementAt (ii).ElementAt (7).Find(m_phone)==-1 && m_List1array.ElementAt (ii).ElementAt (8).Find(m_phone)==-1)
  729. if (m_List1array.ElementAt(ii).ElementAt(9).Find(m_phone) == -1 && m_List1array.ElementAt(ii).ElementAt(10).Find(m_phone) == -1)
  730. {
  731. signarray.SetAt(ii, 0);
  732. bFinded = 0;
  733. continue;
  734. }
  735. bFinded = 1;
  736. }
  737. }
  738. // 地址;
  739. if (m_addr != "")
  740. {
  741. BOOL bFinded = 0;
  742. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  743. {
  744. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  745. {
  746. continue;
  747. }
  748. //Jeff:hostpitalview加了两个字段,这里不为10/11/12
  749. //if(m_List1array.ElementAt (ii).ElementAt (10).Find(m_addr)==-1 && m_List1array.ElementAt (ii).ElementAt (11).Find(m_addr)==-1 && m_List1array.ElementAt (ii).ElementAt (12).Find(m_addr)==-1)
  750. if (m_List1array.ElementAt(ii).ElementAt(12).Find(m_addr) == -1 && m_List1array.ElementAt(ii).ElementAt(13).Find(m_addr) == -1 && m_List1array.ElementAt(ii).ElementAt(14).Find(m_addr) == -1)
  751. {
  752. signarray.SetAt(ii, 0);
  753. bFinded = 0;
  754. continue;
  755. }
  756. bFinded = 1;
  757. }
  758. }
  759. // 单号;
  760. if (m_id != "")
  761. {
  762. BOOL bFinded = 0;
  763. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  764. {
  765. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  766. {
  767. continue;
  768. }
  769. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_id) == -1)
  770. {
  771. signarray.SetAt(ii, 0);
  772. bFinded = 0;
  773. continue;
  774. }
  775. bFinded = 1;
  776. }
  777. }
  778. // 名字;
  779. if (m_name != "")
  780. {
  781. m_name.MakeUpper();
  782. BOOL bFinded = 0;
  783. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  784. {
  785. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0).IsEmpty())
  786. {
  787. continue;
  788. }
  789. //Jeff:hostpitalview加了两个字段,这里不为21/22
  790. //if(m_List1array.ElementAt (ii).ElementAt (1).Find(m_name)==-1 && m_List1array.ElementAt (ii).ElementAt (2).Find(m_name)==-1 && m_List1array.ElementAt (ii).ElementAt (21).Find(m_name)==-1 && m_List1array.ElementAt (ii).ElementAt (22).Find(m_name)==-1)
  791. if (m_List1array.ElementAt(ii).ElementAt(1).Find(m_name) == -1 && m_List1array.ElementAt(ii).ElementAt(2).Find(m_name) == -1 && m_List1array.ElementAt(ii).ElementAt(23).Find(m_name) == -1 && m_List1array.ElementAt(ii).ElementAt(24).Find(m_name) == -1)
  792. {
  793. signarray.SetAt(ii, 0);
  794. bFinded = 0;
  795. continue;
  796. }
  797. bFinded = 1;
  798. }
  799. }
  800. // 日期类型;
  801. if (m_datetype == 0)
  802. {
  803. BOOL bFinded = 0;
  804. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  805. {
  806. if (0)//bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  807. {
  808. continue;
  809. }
  810. //Jeff:hostpitalview加了两个字段,这里不为18
  811. //if(m_List1array.ElementAt (ii).ElementAt (18)<date1 || m_List1array.ElementAt (ii).ElementAt (18)>date2)
  812. if (m_List1array.ElementAt(ii).ElementAt(20) < date1 || m_List1array.ElementAt(ii).ElementAt(20) > date2)
  813. {
  814. signarray.SetAt(ii, 0);
  815. bFinded = 0;
  816. continue;
  817. }
  818. bFinded = 1;
  819. }
  820. }
  821. // 业务类型;
  822. if (businesstype != "")
  823. {
  824. BOOL bFinded = 0;
  825. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  826. {
  827. if (0)//bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  828. {
  829. continue;
  830. }
  831. //Jeff:hostpitalview加了两个字段,这里不为16
  832. //if(m_List1array.ElementAt (ii).ElementAt (16)!=businesstype)
  833. if (m_List1array.ElementAt(ii).ElementAt(18) != businesstype)
  834. {
  835. signarray.SetAt(ii, 0);
  836. bFinded = 0;
  837. continue;
  838. }
  839. bFinded = 1;
  840. }
  841. }
  842. // 业务意向;
  843. if (businessintention != "")
  844. {
  845. BOOL bFinded = 0;
  846. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  847. {
  848. if (0)//bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  849. {
  850. continue;
  851. }
  852. //Jeff:hostpitalview加了两个字段,这里不为17
  853. //if(m_List1array.ElementAt (ii).ElementAt (17)!=businessintention)
  854. if (m_List1array.ElementAt(ii).ElementAt(19) != businessintention)
  855. {
  856. signarray.SetAt(ii, 0);
  857. bFinded = 0;
  858. continue;
  859. }
  860. bFinded = 1;
  861. }
  862. }
  863. for (ii = 0; ii < signarray.GetSize(); ii++)
  864. {
  865. if (signarray.ElementAt(ii))
  866. {
  867. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  868. posarray.Add(ii);
  869. }
  870. }
  871. }
  872. m_List1.m_arLabels.SetSize(count, 1);
  873. // 非全部查询;
  874. if (m_bSearchAll == 0)
  875. {
  876. for ( i = 0; i < posarray.GetSize(); i++)
  877. {
  878. int pos = posarray.ElementAt(i);
  879. CString id = m_List1array.ElementAt(pos).ElementAt(0);
  880. while (id == "")
  881. {
  882. pos--;
  883. id = m_List1array.ElementAt(pos).ElementAt(0);
  884. }
  885. posarray.SetAt(i, pos);
  886. }
  887. for (i = 0; i < count; i++)
  888. {
  889. if (m_List1.m_arLabels.ElementAt(i).ElementAt(0) == "")
  890. {
  891. int pos = posarray.ElementAt(i);
  892. m_List1.m_arLabels.ElementAt(i).SetAt(0, m_List1array.ElementAt(pos).ElementAt(0));
  893. m_List1.m_arLabels.ElementAt(i).SetAt(1, m_List1array.ElementAt(pos).ElementAt(1));
  894. m_List1.m_arLabels.ElementAt(i).SetAt(2, m_List1array.ElementAt(pos).ElementAt(2));
  895. m_List1.m_arLabels.ElementAt(i).SetAt(3, m_List1array.ElementAt(pos).ElementAt(3));
  896. #if 0 // Jeff
  897. // LOG4C((LOG_NOTICE,"生日类型:%s",m_List1array.ElementAt(pos).ElementAt(4)));
  898. // 生日类型:预产期、
  899. CString strBirthdayType = "";
  900. if ( m_List1array.ElementAt(pos).ElementAt(4) == "0")
  901. {
  902. strBirthdayType = "宝宝生日";
  903. }
  904. else
  905. {
  906. strBirthdayType = "预产期";
  907. }
  908. m_List1.m_arLabels.ElementAt (i).SetAt (4, strBirthdayType );
  909. #else
  910. m_List1.m_arLabels.ElementAt(i).SetAt(4, m_List1array.ElementAt(pos).ElementAt(4));
  911. #endif
  912. m_List1.m_arLabels.ElementAt(i).SetAt(5, m_List1array.ElementAt(pos).ElementAt(5));
  913. m_List1.m_arLabels.ElementAt(i).SetAt(6, m_List1array.ElementAt(pos).ElementAt(6));
  914. m_List1.m_arLabels.ElementAt(i).SetAt(7, m_List1array.ElementAt(pos).ElementAt(7));
  915. m_List1.m_arLabels.ElementAt(i).SetAt(8, m_List1array.ElementAt(pos).ElementAt(8));
  916. m_List1.m_arLabels.ElementAt(i).SetAt(9, m_List1array.ElementAt(pos).ElementAt(9));
  917. m_List1.m_arLabels.ElementAt(i).SetAt(10, m_List1array.ElementAt(pos).ElementAt(10));
  918. m_List1.m_arLabels.ElementAt(i).SetAt(11, m_List1array.ElementAt(pos).ElementAt(11));
  919. m_List1.m_arLabels.ElementAt(i).SetAt(12, m_List1array.ElementAt(pos).ElementAt(12));
  920. m_List1.m_arLabels.ElementAt(i).SetAt(13, m_List1array.ElementAt(pos).ElementAt(13));
  921. m_List1.m_arLabels.ElementAt(i).SetAt(14, m_List1array.ElementAt(pos).ElementAt(14));
  922. m_List1.m_arLabels.ElementAt(i).SetAt(15, m_List1array.ElementAt(pos).ElementAt(15));
  923. m_List1.m_arLabels.ElementAt(i).SetAt(21, m_List1array.ElementAt(pos).ElementAt(21));
  924. m_List1.m_arLabels.ElementAt(i).SetAt(22, m_List1array.ElementAt(pos).ElementAt(22));
  925. m_List1.m_arLabels.ElementAt(i).SetAt(23, m_List1array.ElementAt(pos).ElementAt(21));// add Jeff 0214.05.21
  926. m_List1.m_arLabels.ElementAt(i).SetAt(24, m_List1array.ElementAt(pos).ElementAt(22));// add Jeff 0214.05.21
  927. }
  928. }
  929. if (m_List1.m_arLabels.GetSize())
  930. {
  931. CString id = m_List1.m_arLabels.ElementAt(0).ElementAt(0);
  932. for (int ii = 1; ii < m_List1.m_arLabels.GetSize(); ii++)
  933. {
  934. if (m_List1.m_arLabels.ElementAt(ii).ElementAt(0) == id)
  935. {
  936. m_List1.m_arLabels.ElementAt(ii).SetAt(0, "");
  937. m_List1.m_arLabels.ElementAt(ii).SetAt(1, "");
  938. m_List1.m_arLabels.ElementAt(ii).SetAt(2, "");
  939. m_List1.m_arLabels.ElementAt(ii).SetAt(3, "");
  940. m_List1.m_arLabels.ElementAt(ii).SetAt(4, "");
  941. m_List1.m_arLabels.ElementAt(ii).SetAt(5, "");
  942. m_List1.m_arLabels.ElementAt(ii).SetAt(6, "");
  943. m_List1.m_arLabels.ElementAt(ii).SetAt(7, "");
  944. m_List1.m_arLabels.ElementAt(ii).SetAt(8, "");
  945. m_List1.m_arLabels.ElementAt(ii).SetAt(9, "");
  946. m_List1.m_arLabels.ElementAt(ii).SetAt(10, "");
  947. m_List1.m_arLabels.ElementAt(ii).SetAt(11, "");
  948. m_List1.m_arLabels.ElementAt(ii).SetAt(12, "");
  949. m_List1.m_arLabels.ElementAt(ii).SetAt(13, "");
  950. m_List1.m_arLabels.ElementAt(ii).SetAt(14, "");
  951. m_List1.m_arLabels.ElementAt(ii).SetAt(15, "");
  952. m_List1.m_arLabels.ElementAt(ii).SetAt(21, "");
  953. m_List1.m_arLabels.ElementAt(ii).SetAt(22, "");
  954. m_List1.m_arLabels.ElementAt(ii).SetAt(23, "");// add by Jeff 2014.05.21
  955. m_List1.m_arLabels.ElementAt(ii).SetAt(24, "");// add by Jeff 2014.05.21
  956. }
  957. else
  958. id = m_List1.m_arLabels.ElementAt(ii).ElementAt(0);
  959. }
  960. }
  961. }
  962. ii = count;
  963. m_List1.m_LabelCount = ii;
  964. m_List1.SetItemCountEx(ii);
  965. CString str;
  966. str.Format("项目:%d", ii);
  967. SetDlgItemText(IDC_STATIC2, str);
  968. }