123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- // HospitalClientMsg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "HospitalClientMsg.h"
- #include "MyMdi.H"
- #include "ModifyDinDan.h"
- #include "NeroDlg.h"
- #include "ClientRequirement.h"
- #include "./helper/ffsco.h"
- #include "SendMsgDlg.h"
- #include "HospitalMsgSet.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #pragma comment(lib, "Shlwapi.lib")
- extern BOOL CovertDate(CString &date, CString &date2);
- /////////////////////////////////////////////////////////////////////////////
- // HospitalClientMsg
- IMPLEMENT_DYNCREATE(HospitalClientMsg, MyFormView)
- HospitalClientMsg::HospitalClientMsg()
- : MyFormView(HospitalClientMsg::IDD)
- {
- //{{AFX_DATA_INIT(HospitalClientMsg)
- m_age1 = 1;
- m_age2 = 100;
- m_radio1 = 0;
- m_bSearchAll=0;
- //}}AFX_DATA_INIT
- }
- HospitalClientMsg::~HospitalClientMsg()
- {
- }
- void HospitalClientMsg::DoDataExchange(CDataExchange* pDX)
- {
- MyFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(HospitalClientMsg)
- DDX_Control(pDX, IDC_SPIN2, m_spin2);
- DDX_Control(pDX, IDC_SPIN1, m_spin1);
- DDX_Control(pDX, IDC_LIST2, m_List1);
- DDX_Control(pDX, IDC_STATIC1, m_static1);
- DDX_Text(pDX, IDC_EDIT1, m_age1);
- DDX_Text(pDX, IDC_EDIT2, m_age2);
- DDX_Radio(pDX, IDC_RADIO1, m_radio1);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(HospitalClientMsg, MyFormView)
- //{{AFX_MSG_MAP(HospitalClientMsg)
- ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
- ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
- ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
- ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
- ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
- ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
- ON_BN_CLICKED(IDC_BUTburncd, OnBUTHospitalClientMsg)
- ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
- ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
- ON_BN_CLICKED(IDC_BUTsendmsg, OnBUTsendmsg)
- ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // HospitalClientMsg diagnostics
- #ifdef _DEBUG
- void HospitalClientMsg::AssertValid() const
- {
- MyFormView::AssertValid();
- }
- void HospitalClientMsg::Dump(CDumpContext& dc) const
- {
- MyFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // HospitalClientMsg message handlers
- void HospitalClientMsg::OnInitialUpdate()
- {
- MyFormView::OnInitialUpdate();
- GetDlgItem(IDC_BUTprint3)->EnableWindow(IsHasRights2new(49));
- // TODO: Add your specialized code here and/or call the base class
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
- // Here we create the outbar control using the splitter as its parent
- // and setting its id to the first pane.
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
- EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
- m_spin1.SetRange (1, 500);
- m_spin2.SetRange (1, 500);
- int idarray[]={IDC_BUTsendmsg,IDC_BUTprint3,IDC_BUTclose};
- int idcount=3;
- int btnwid;
- CRect prerc;
- for(int a=idcount-2; a>=0; a--)
- {
- GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
- ScreenToClient(prerc);
- GetDlgItem(idarray[a])->GetWindowRect (rc2);
- ScreenToClient(rc2);
- btnwid=rc2.Width ();
- rc2.right =prerc.left ;
- rc2.left =rc2.right -btnwid;
- GetDlgItem(idarray[a])->MoveWindow (rc2);
- }
- m_static1.SetFont (&g_titlefont);
- 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" );
- // m_List1.LoadColumnInfo (144);
- m_List1.m_bSortSupport=0;
- GetData();
- }
- void HospitalClientMsg::OnBUTclose()
- {
- // TODO: Add your control notification handler code here
- GetParent()->SendMessage(WM_CLOSE);
- }
- void HospitalClientMsg::OnSelchangeCombo1()
- {
- // TODO: Add your control notification handler code here
- }
- BOOL HospitalClientMsg::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- try
- {
- if(pMsg->message==WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_RETURN:
- OnButton2();
- return 1;
- case 0x43: // copy
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56: //Ctrl + V:
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58: // cut
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A: //undo
- case 0x59: //redo
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
- return MyFormView::PreTranslateMessage(pMsg);
- }
- catch(...)
- {
- }
- return true;
- }
- void HospitalClientMsg::GetSavePath(CString &path)
- {
- }
- int HospitalClientMsg::FindArray(CStringArray *pArray, CString Str)
- {
- return 0;
- }
- void HospitalClientMsg::GetNo(CString str, CStringArray &array)
- {
- }
- CString HospitalClientMsg::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
- {
- return "";
- }
- void HospitalClientMsg::OnBUTexportphoto()
- {
- }
- void HospitalClientMsg::OnBUTimportphoto()
- {
- }
- void HospitalClientMsg::OnBUTshowphoto()
- {
- // TODO: Add your control notification handler code here
- }
- void HospitalClientMsg::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
- // TODO: Add your control notification handler code here
- *pResult = 0;
- }
- void HospitalClientMsg::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- *pResult = 0;
- }
- void HospitalClientMsg::OnBUTsendmsg()
- {
- // TODO: Add your control notification handler code here
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION);
- return;
- }
- int iItem;
- CStringArray array;
- while (pos)
- {
- iItem = m_List1.GetNextSelectedItem(pos);
- if(!m_List1.GetItemText (iItem, 17).IsEmpty ())
- array.Add (m_List1.GetItemText (iItem, 17));
- if(!m_List1.GetItemText (iItem, 18).IsEmpty ())
- array.Add (m_List1.GetItemText (iItem, 18));
- if(!m_List1.GetItemText (iItem, 19).IsEmpty ())
- array.Add (m_List1.GetItemText (iItem, 19));
- if(!m_List1.GetItemText (iItem, 20).IsEmpty ())
- array.Add (m_List1.GetItemText (iItem, 20));
- if(!m_List1.GetItemText (iItem, 21).IsEmpty ())
- array.Add (m_List1.GetItemText (iItem, 21));
- }
- SendMsgDlg dlg;
- dlg.m_mode=2;
- dlg.m_pArray=&array;
- dlg.DoModal ();
- }
- void HospitalClientMsg::OnBUTprint3()
- {
- ListToXLS(&m_List1, "c:\\短信列表.xls", 0);
- }
- void HospitalClientMsg::GetData()
- {
- g_sendhead.bsql=0;
- g_sendhead.code[0]=208;
- g_sendhead.tabcount=1;
- g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
- DataToArray(&m_List1array);
- CString date1,date2,str,sdays,syears,pregnancydays;
- CTime tm=GetTmFromStr(g_date);
- int days;
- for(int i=0; i<m_List1array.GetSize (); i++)
- {
- sdays=syears=pregnancydays="";
- date1=m_List1array.ElementAt (i).ElementAt (6);
- if(m_List1array.ElementAt (i).ElementAt (4)=="1")
- {
- date2.Empty ();
- CovertDate(date1,date2);
- if(date2!="")date1=date2;
- }
- if(date1.GetLength ()==10)
- {
- if(m_List1array.ElementAt (i).ElementAt (5)=="0")
- {
- CTime tm2( atoi(date1.Mid (0,4)), atoi(date1.Mid (5,2)), atoi(date1.Mid (8,2)), 0,0,0);
- CTimeSpan dt=tm-tm2;
- days=dt.GetDays ()+1;
- sdays.Format ("%d", days);
- if(days%365==0)
- days/=365;
- else
- {
- days/=365;
- days++;
- }
- syears.Format ("%d", days);
- if(tm<tm2)sdays=syears="";
- }
- }
- if(atoi(m_List1array.ElementAt (i).ElementAt (7))>0)
- {
- date1=m_List1array.ElementAt (i).ElementAt (9);
- CTime tm2( atoi(date1.Mid (0,4)), atoi(date1.Mid (5,2)), atoi(date1.Mid (8,2)), 0,0,0);
- CTimeSpan dt=tm-tm2;
- pregnancydays.Format ("%d", atoi(m_List1array.ElementAt (i).ElementAt (7))+dt.GetDays ());
- if(atoi(pregnancydays)>288)
- pregnancydays="已生";
- }
- if(sdays=="")sdays="未知";
- if(syears=="")syears="未知";
- if(pregnancydays=="")pregnancydays="未知";
- m_List1array.ElementAt (i).InsertAt (8, pregnancydays);
- m_List1array.ElementAt (i).InsertAt (8, sdays);
- m_List1array.ElementAt (i).InsertAt (8, syears);
- if(m_List1array.ElementAt (i).ElementAt (4)=="1")
- m_List1array.ElementAt (i).SetAt (4, "农历");
- else
- m_List1array.ElementAt (i).SetAt (4, "公历");
- if(m_List1array.ElementAt (i).ElementAt (5)=="0")
- m_List1array.ElementAt (i).SetAt (5, "生日");
- else
- m_List1array.ElementAt (i).SetAt (5, "预产期");
- }
- FillGrid();
- }
- void HospitalClientMsg::FillGrid()
- {
- m_List1.DeleteAllItems2 ();
- int ii=0;
- m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
- int count=0;
- UpdateData();
- if(m_bSearchAll)
- {
- for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
- {
- m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
- }
- }
- else if(m_radio1==0)
- {
- for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
- {
- if(atoi(m_List1array.ElementAt (ii).ElementAt (9))<m_age1 || atoi(m_List1array.ElementAt (ii).ElementAt (9))>m_age2)
- continue;
- m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
- }
- }
- else if(m_radio1==1)
- {
- for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
- {
- if(atoi(m_List1array.ElementAt (ii).ElementAt (8))<m_age1 || atoi(m_List1array.ElementAt (ii).ElementAt (8))>m_age2)
- continue;
- m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
- }
- }
- else if(m_radio1==2)
- {
- for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
- {
- if(atoi(m_List1array.ElementAt (ii).ElementAt (10))<m_age1 || atoi(m_List1array.ElementAt (ii).ElementAt (10))>m_age2)
- continue;
- m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
- }
- }
- m_List1.m_arLabels.SetSize(count, 1);
- ii=count;
- m_List1.m_LabelCount=ii;
- m_List1.SetItemCountEx (ii);
- CString str;
- str.Format ("客人:%d", ii);
- SetDlgItemText(IDC_STATIC2, str);
- }
- void HospitalClientMsg::OnButton2()
- {
- // TODO: Add your control notification handler code here
- m_bSearchAll=0;
- FillGrid();
- }
- void HospitalClientMsg::OnBUTburncd2()
- {
- // TODO: Add your control notification handler code here
- m_bSearchAll=1;
- FillGrid();
- }
- void HospitalClientMsg::OnBUTHospitalClientMsg()
- {
- // TODO: Add your control notification handler code here
- HospitalMsgSet dlg;
- dlg.DoModal ();
- }
|