HospitalClientMsg.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. // HospitalClientMsg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "HospitalClientMsg.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "TakeMoney2.h"
  10. #include "NeroDlg.h"
  11. #include "ClientRequirement.h"
  12. #include "ChoosePhotoSkin2.h"
  13. #include "./helper/ffsco.h"
  14. #include "SendMsgDlg.h"
  15. #include "HospitalMsgSet.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. #pragma comment(lib, "Shlwapi.lib")
  22. extern BOOL CovertDate(CString &date, CString &date2);
  23. /////////////////////////////////////////////////////////////////////////////
  24. // HospitalClientMsg
  25. IMPLEMENT_DYNCREATE(HospitalClientMsg, MyFormView)
  26. HospitalClientMsg::HospitalClientMsg()
  27. : MyFormView(HospitalClientMsg::IDD)
  28. {
  29. //{{AFX_DATA_INIT(HospitalClientMsg)
  30. m_age1 = 1;
  31. m_age2 = 100;
  32. m_radio1 = 0;
  33. m_bSearchAll=0;
  34. //}}AFX_DATA_INIT
  35. }
  36. HospitalClientMsg::~HospitalClientMsg()
  37. {
  38. }
  39. void HospitalClientMsg::DoDataExchange(CDataExchange* pDX)
  40. {
  41. MyFormView::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(HospitalClientMsg)
  43. DDX_Control(pDX, IDC_SPIN2, m_spin2);
  44. DDX_Control(pDX, IDC_SPIN1, m_spin1);
  45. DDX_Control(pDX, IDC_LIST2, m_List1);
  46. DDX_Control(pDX, IDC_STATIC1, m_static1);
  47. DDX_Text(pDX, IDC_EDIT1, m_age1);
  48. DDX_Text(pDX, IDC_EDIT2, m_age2);
  49. DDX_Radio(pDX, IDC_RADIO1, m_radio1);
  50. //}}AFX_DATA_MAP
  51. }
  52. BEGIN_MESSAGE_MAP(HospitalClientMsg, MyFormView)
  53. //{{AFX_MSG_MAP(HospitalClientMsg)
  54. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  55. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  56. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  57. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  58. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  59. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  60. ON_BN_CLICKED(IDC_BUTburncd, OnBUTHospitalClientMsg)
  61. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  62. ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
  63. ON_BN_CLICKED(IDC_BUTsendmsg, OnBUTsendmsg)
  64. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  65. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  66. //}}AFX_MSG_MAP
  67. END_MESSAGE_MAP()
  68. /////////////////////////////////////////////////////////////////////////////
  69. // HospitalClientMsg diagnostics
  70. #ifdef _DEBUG
  71. void HospitalClientMsg::AssertValid() const
  72. {
  73. MyFormView::AssertValid();
  74. }
  75. void HospitalClientMsg::Dump(CDumpContext& dc) const
  76. {
  77. MyFormView::Dump(dc);
  78. }
  79. #endif //_DEBUG
  80. /////////////////////////////////////////////////////////////////////////////
  81. // HospitalClientMsg message handlers
  82. void HospitalClientMsg::OnInitialUpdate()
  83. {
  84. MyFormView::OnInitialUpdate();
  85. GetDlgItem(IDC_BUTprint3)->EnableWindow(IsHasRights2new(49));
  86. // TODO: Add your specialized code here and/or call the base class
  87. CMyMdi Mdi;
  88. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  89. // Here we create the outbar control using the splitter as its parent
  90. // and setting its id to the first pane.
  91. CRect rc2;
  92. GetWindowRect(rc2);
  93. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  94. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  95. m_spin1.SetRange (1, 500);
  96. m_spin2.SetRange (1, 500);
  97. int idarray[]={IDC_BUTsendmsg,IDC_BUTprint3,IDC_BUTclose};
  98. int idcount=3;
  99. int btnwid;
  100. CRect prerc;
  101. for(int a=idcount-2; a>=0; a--)
  102. {
  103. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  104. ScreenToClient(prerc);
  105. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  106. ScreenToClient(rc2);
  107. btnwid=rc2.Width ();
  108. rc2.right =prerc.left ;
  109. rc2.left =rc2.right -btnwid;
  110. GetDlgItem(idarray[a])->MoveWindow (rc2);
  111. }
  112. m_static1.SetFont (&g_titlefont);
  113. m_List1.SetHeadings("来单批号,100;客户姓名,100;宝宝姓名,100;宝宝性别,100;是否农历,100;日期类型,100;日期,100;怀孕周期,100;宝宝年龄,100;宝宝天数,100;怀孕天数,100;QQ,100;来单日期,100;区域,100;门市,100;客户类型,100;医院,100;电话1,100;电话2,100;电话3,100;电话4,100;电话5,100" );
  114. // m_List1.LoadColumnInfo (144);
  115. m_List1.m_bSortSupport=0;
  116. GetData();
  117. }
  118. void HospitalClientMsg::OnBUTclose()
  119. {
  120. // TODO: Add your control notification handler code here
  121. GetParent()->SendMessage(WM_CLOSE);
  122. }
  123. void HospitalClientMsg::OnSelchangeCombo1()
  124. {
  125. // TODO: Add your control notification handler code here
  126. }
  127. BOOL HospitalClientMsg::PreTranslateMessage(MSG* pMsg)
  128. {
  129. // TODO: Add your specialized code here and/or call the base class
  130. try
  131. {
  132. if(pMsg->message==WM_KEYDOWN)
  133. {
  134. switch (pMsg->wParam)
  135. {
  136. case VK_RETURN:
  137. OnButton2();
  138. return 1;
  139. case 0x43: // copy
  140. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  141. {
  142. GetFocus()->SendMessage(WM_COPY);
  143. return TRUE;
  144. }
  145. break;
  146. case 0x56: //Ctrl + V:
  147. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  148. {
  149. GetFocus()->SendMessage(WM_PASTE);
  150. return TRUE;
  151. }
  152. break;
  153. case 0x58: // cut
  154. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  155. {
  156. GetFocus()->SendMessage(WM_CUT);
  157. return TRUE;
  158. }
  159. break;
  160. case 0x5A: //undo
  161. case 0x59: //redo
  162. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  163. {
  164. GetFocus()->SendMessage(WM_UNDO);
  165. return TRUE;
  166. }
  167. break;
  168. }
  169. }
  170. return MyFormView::PreTranslateMessage(pMsg);
  171. }
  172. catch(...)
  173. {
  174. }
  175. }
  176. void HospitalClientMsg::GetSavePath(CString &path)
  177. {
  178. }
  179. int HospitalClientMsg::FindArray(CStringArray *pArray, CString Str)
  180. {
  181. return 0;
  182. }
  183. void HospitalClientMsg::GetNo(CString str, CStringArray &array)
  184. {
  185. }
  186. CString HospitalClientMsg::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  187. {
  188. return "";
  189. }
  190. void HospitalClientMsg::OnBUTexportphoto()
  191. {
  192. }
  193. void HospitalClientMsg::OnBUTimportphoto()
  194. {
  195. }
  196. void HospitalClientMsg::OnBUTshowphoto()
  197. {
  198. // TODO: Add your control notification handler code here
  199. }
  200. void HospitalClientMsg::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  201. {
  202. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  203. // TODO: Add your control notification handler code here
  204. *pResult = 0;
  205. }
  206. void HospitalClientMsg::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  207. {
  208. // TODO: Add your control notification handler code here
  209. *pResult = 0;
  210. }
  211. void HospitalClientMsg::OnBUTsendmsg()
  212. {
  213. // TODO: Add your control notification handler code here
  214. POSITION pos;
  215. pos=m_List1.GetFirstSelectedItemPosition();
  216. if(pos==NULL)
  217. {
  218. AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION);
  219. return;
  220. }
  221. int iItem;
  222. CStringArray array;
  223. while (pos)
  224. {
  225. iItem = m_List1.GetNextSelectedItem(pos);
  226. if(!m_List1.GetItemText (iItem, 17).IsEmpty ())
  227. array.Add (m_List1.GetItemText (iItem, 17));
  228. if(!m_List1.GetItemText (iItem, 18).IsEmpty ())
  229. array.Add (m_List1.GetItemText (iItem, 18));
  230. if(!m_List1.GetItemText (iItem, 19).IsEmpty ())
  231. array.Add (m_List1.GetItemText (iItem, 19));
  232. if(!m_List1.GetItemText (iItem, 20).IsEmpty ())
  233. array.Add (m_List1.GetItemText (iItem, 20));
  234. if(!m_List1.GetItemText (iItem, 21).IsEmpty ())
  235. array.Add (m_List1.GetItemText (iItem, 21));
  236. }
  237. SendMsgDlg dlg;
  238. dlg.m_mode=2;
  239. dlg.m_pArray=&array;
  240. dlg.DoModal ();
  241. }
  242. void HospitalClientMsg::OnBUTprint3()
  243. {
  244. ListToXLS(&m_List1, "c:\\短信列表.xls", 0);
  245. }
  246. void HospitalClientMsg::GetData()
  247. {
  248. g_sendhead.bsql=0;
  249. g_sendhead.code[0]=208;
  250. g_sendhead.tabcount=1;
  251. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  252. DataToArray(&m_List1array);
  253. CString date1,date2,str,sdays,syears,pregnancydays;
  254. CTime tm=GetTmFromStr(g_date);
  255. int days;
  256. for(int i=0; i<m_List1array.GetSize (); i++)
  257. {
  258. sdays=syears=pregnancydays="";
  259. date1=m_List1array.ElementAt (i).ElementAt (6);
  260. if(m_List1array.ElementAt (i).ElementAt (4)=="1")
  261. {
  262. date2.Empty ();
  263. CovertDate(date1,date2);
  264. if(date2!="")date1=date2;
  265. }
  266. if(date1.GetLength ()==10)
  267. {
  268. if(m_List1array.ElementAt (i).ElementAt (5)=="0")
  269. {
  270. CTime tm2( atoi(date1.Mid (0,4)), atoi(date1.Mid (5,2)), atoi(date1.Mid (8,2)), 0,0,0);
  271. CTimeSpan dt=tm-tm2;
  272. days=dt.GetDays ()+1;
  273. sdays.Format ("%d", days);
  274. if(days%365==0)
  275. days/=365;
  276. else
  277. {
  278. days/=365;
  279. days++;
  280. }
  281. syears.Format ("%d", days);
  282. if(tm<tm2)sdays=syears="";
  283. }
  284. }
  285. if(atoi(m_List1array.ElementAt (i).ElementAt (7))>0)
  286. {
  287. date1=m_List1array.ElementAt (i).ElementAt (9);
  288. CTime tm2( atoi(date1.Mid (0,4)), atoi(date1.Mid (5,2)), atoi(date1.Mid (8,2)), 0,0,0);
  289. CTimeSpan dt=tm-tm2;
  290. pregnancydays.Format ("%d", atoi(m_List1array.ElementAt (i).ElementAt (7))+dt.GetDays ());
  291. if(atoi(pregnancydays)>288)
  292. pregnancydays="已生";
  293. }
  294. if(sdays=="")sdays="未知";
  295. if(syears=="")syears="未知";
  296. if(pregnancydays=="")pregnancydays="未知";
  297. m_List1array.ElementAt (i).InsertAt (8, pregnancydays);
  298. m_List1array.ElementAt (i).InsertAt (8, sdays);
  299. m_List1array.ElementAt (i).InsertAt (8, syears);
  300. if(m_List1array.ElementAt (i).ElementAt (4)=="1")
  301. m_List1array.ElementAt (i).SetAt (4, "农历");
  302. else
  303. m_List1array.ElementAt (i).SetAt (4, "公历");
  304. if(m_List1array.ElementAt (i).ElementAt (5)=="0")
  305. m_List1array.ElementAt (i).SetAt (5, "生日");
  306. else
  307. m_List1array.ElementAt (i).SetAt (5, "预产期");
  308. }
  309. FillGrid();
  310. }
  311. void HospitalClientMsg::FillGrid()
  312. {
  313. m_List1.DeleteAllItems2 ();
  314. int ii=0;
  315. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  316. int count=0;
  317. UpdateData();
  318. if(m_bSearchAll)
  319. {
  320. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  321. {
  322. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  323. }
  324. }
  325. else if(m_radio1==0)
  326. {
  327. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  328. {
  329. if(atoi(m_List1array.ElementAt (ii).ElementAt (9))<m_age1 || atoi(m_List1array.ElementAt (ii).ElementAt (9))>m_age2)
  330. continue;
  331. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  332. }
  333. }
  334. else if(m_radio1==1)
  335. {
  336. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  337. {
  338. if(atoi(m_List1array.ElementAt (ii).ElementAt (8))<m_age1 || atoi(m_List1array.ElementAt (ii).ElementAt (8))>m_age2)
  339. continue;
  340. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  341. }
  342. }
  343. else if(m_radio1==2)
  344. {
  345. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  346. {
  347. if(atoi(m_List1array.ElementAt (ii).ElementAt (10))<m_age1 || atoi(m_List1array.ElementAt (ii).ElementAt (10))>m_age2)
  348. continue;
  349. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  350. }
  351. }
  352. m_List1.m_arLabels.SetSize(count, 1);
  353. ii=count;
  354. m_List1.m_LabelCount=ii;
  355. m_List1.SetItemCountEx (ii);
  356. CString str;
  357. str.Format ("客人:%d", ii);
  358. SetDlgItemText(IDC_STATIC2, str);
  359. }
  360. void HospitalClientMsg::OnButton2()
  361. {
  362. // TODO: Add your control notification handler code here
  363. m_bSearchAll=0;
  364. FillGrid();
  365. }
  366. void HospitalClientMsg::OnBUTburncd2()
  367. {
  368. // TODO: Add your control notification handler code here
  369. m_bSearchAll=1;
  370. FillGrid();
  371. }
  372. void HospitalClientMsg::OnBUTHospitalClientMsg()
  373. {
  374. // TODO: Add your control notification handler code here
  375. HospitalMsgSet dlg;
  376. dlg.DoModal ();
  377. }