HospitalClientMsg.cpp 11 KB

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