AddHospitalClient.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. // AddHospitalClient.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "AddHospitalClient.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // AddHospitalClient dialog
  13. AddHospitalClient::AddHospitalClient(CWnd* pParent /*=NULL*/)
  14. : CDialog(AddHospitalClient::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(AddHospitalClient)
  17. checkmsg = FALSE;
  18. name1 = _T("");
  19. name2 = _T("");
  20. food = _T("");
  21. sex = _T("");
  22. check1 = FALSE;
  23. birthdaytype = 0;
  24. birthday = _T("");
  25. pregnancydays = _T("");
  26. qq = _T("");
  27. date1 = GetTmFromStr(g_date);
  28. no = _T("");
  29. from = _T("");
  30. clerk = _T("");
  31. type = _T("");
  32. hospital = _T("");
  33. remark = _T("");
  34. phone1 = _T("");
  35. phone2 = _T("");
  36. phone3 = _T("");
  37. phone4 = _T("");
  38. phone5 = _T("");
  39. addr1 = _T("");
  40. addr2 = _T("");
  41. addr3 = _T("");
  42. post1 = _T("");
  43. post2 = _T("");
  44. post3 = _T("");
  45. businesstype = _T("");
  46. businessintention = _T("");
  47. bookingdate = GetTmFromStr(g_date);
  48. desaddr = _T("");
  49. businessremark = _T("");
  50. alarmcheck = FALSE;
  51. alarmdate = GetTmFromStr(g_date);
  52. bAdd=1;
  53. //}}AFX_DATA_INIT
  54. }
  55. void AddHospitalClient::DoDataExchange(CDataExchange* pDX)
  56. {
  57. CDialog::DoDataExchange(pDX);
  58. //{{AFX_DATA_MAP(AddHospitalClient)
  59. DDX_Control(pDX, IDC_LIST2, m_List1);
  60. DDX_Control(pDX, IDC_EDITBirthday, m_datectrl);
  61. DDX_Control(pDX, IDC_COMBObusinessintention, businessintentionCombo);
  62. DDX_Control(pDX, IDC_COMBOtype, typeCombo);
  63. DDX_Control(pDX, IDC_COMBOsex, sexCombo);
  64. DDX_Control(pDX, IDC_COMBOhospital, hospitalCombo);
  65. DDX_Control(pDX, IDC_COMBOfrom, fromCombo);
  66. DDX_Control(pDX, IDC_COMBOfood, foodCombo);
  67. DDX_Control(pDX, IDC_COMBOdesaddr, desaddrCombo);
  68. DDX_Control(pDX, IDC_COMBOclerk, clerkCombo);
  69. DDX_Control(pDX, IDC_COMBObusinesstype, businesstypeCombo);
  70. DDX_Check(pDX, IDC_CHECK1, check1);
  71. DDX_Check(pDX, IDC_CHECKalarmcheck, alarmcheck);
  72. DDX_Check(pDX, IDC_CHECKmsg, checkmsg);
  73. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKERalarmdate, alarmdate);
  74. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKERbookingdate, bookingdate);
  75. DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKERdate1, date1);
  76. DDX_Text(pDX, IDC_EDITaddr1, addr1);
  77. DDX_Text(pDX, IDC_EDITaddr2, addr2);
  78. DDX_Text(pDX, IDC_EDITaddr3, addr3);
  79. DDX_Text(pDX, IDC_EDITBirthday, birthday);
  80. DDX_Text(pDX, IDC_EDITbusinessremark, businessremark);
  81. DDX_Text(pDX, IDC_EDITname1, name1);
  82. DDX_Text(pDX, IDC_EDITname2, name2);
  83. DDX_Text(pDX, IDC_EDITno, no);
  84. DDX_Text(pDX, IDC_EDITphone1, phone1);
  85. DDX_Text(pDX, IDC_EDITphone2, phone2);
  86. DDX_Text(pDX, IDC_EDITphone3, phone3);
  87. DDX_Text(pDX, IDC_EDITphone4, phone4);
  88. DDX_Text(pDX, IDC_EDITphone5, phone5);
  89. DDX_Text(pDX, IDC_EDITpost1, post1);
  90. DDX_Text(pDX, IDC_EDITpost2, post2);
  91. DDX_Text(pDX, IDC_EDITpost3, post3);
  92. DDX_Text(pDX, IDC_EDITpregnancydays, pregnancydays);
  93. DDX_Text(pDX, IDC_EDITqq, qq);
  94. DDX_Text(pDX, IDC_EDITremark, remark);
  95. DDX_Radio(pDX, IDC_RADIO1, birthdaytype);
  96. //}}AFX_DATA_MAP
  97. }
  98. BEGIN_MESSAGE_MAP(AddHospitalClient, CDialog)
  99. //{{AFX_MSG_MAP(AddHospitalClient)
  100. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  101. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  102. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  103. //}}AFX_MSG_MAP
  104. END_MESSAGE_MAP()
  105. /////////////////////////////////////////////////////////////////////////////
  106. // AddHospitalClient message handlers
  107. extern BOOL CALLBACK EnumChildProc2(HWND hwnd,LPARAM lParam);
  108. BOOL AddHospitalClient::OnInitDialog()
  109. {
  110. CDialog::OnInitDialog();
  111. CRect rc2;
  112. GetWindowRect(rc2);
  113. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  114. g_WidthScale2 = (float)g_rc.Width()/(float)rc2.Width(); // new/Old
  115. g_HeightScale2 = (float)g_rc.Height()/(float)rc2.Height();
  116. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc2,0);
  117. m_List1.SetHeadings("id,0;业务种类,100;业务意向,100;预约日期,100;上门地址,100;备注,100;是否提醒,100;提醒日期,100" );
  118. // m_List1.LoadColumnInfo (118);
  119. foodCombo.AddString ("母乳");
  120. foodCombo.AddString ("人工");
  121. foodCombo.AddString ("混合");
  122. desaddrCombo.AddString ("自家地址");
  123. desaddrCombo.AddString ("婆家地址");
  124. desaddrCombo.AddString ("娘家地址");
  125. sexCombo.AddString ("男");
  126. sexCombo.AddString ("女");
  127. g_sendhead.bsql=0;
  128. g_sendhead.code[0]=200;
  129. g_sendhead.code[1]=201;
  130. g_sendhead.code[2]=202;
  131. g_sendhead.code[3]=203;
  132. g_sendhead.code[4]=82;
  133. g_sendhead.tabcount=5;
  134. g_pMainWnd->ProcessChatMessageRequest2(3);
  135. if(g_bSendOK==0)
  136. {
  137. CDialog::OnCancel ();
  138. return 0;
  139. }
  140. CArray<CStringArray, CStringArray>List1array;
  141. CArray<CStringArray, CStringArray>List2array;
  142. CArray<CStringArray, CStringArray>List3array;
  143. CArray<CStringArray, CStringArray>List4array;
  144. CArray<CStringArray, CStringArray>List5array;
  145. DataToArray(&List1array, &List2array, &List3array, &List4array, &List5array);
  146. for(int ii=0; ii<List1array.GetSize (); ii++)
  147. businesstypeCombo.AddString ( List1array.ElementAt (ii).ElementAt(0) );
  148. for( ii=0; ii<List2array.GetSize (); ii++)
  149. businessintentionCombo.AddString ( List2array.ElementAt (ii).ElementAt(0) );
  150. for( ii=0; ii<List3array.GetSize (); ii++)
  151. typeCombo.AddString ( List3array.ElementAt (ii).ElementAt(0) );
  152. for( ii=0; ii<List4array.GetSize (); ii++)
  153. hospitalCombo.AddString ( List4array.ElementAt (ii).ElementAt(0) );
  154. for( ii=0; ii<List5array.GetSize (); ii++)
  155. fromCombo.AddString ( List5array.ElementAt (ii).ElementAt(0) );
  156. if(bAdd)
  157. {
  158. if(NewID()==0)
  159. {
  160. CDialog::OnCancel();return 0;
  161. }
  162. }
  163. else
  164. {
  165. SetWindowText("客户资料-修改");
  166. CString filter="id='"+no+"';id='"+no+"'";
  167. g_sendhead.bsql=0;
  168. g_sendhead.code[0]=206;
  169. g_sendhead.code[1]=204;
  170. g_sendhead.tabcount=2;
  171. g_pMainWnd->ProcessChatMessageRequest2(filter);
  172. if(g_bSendOK==0)
  173. {
  174. CDialog::OnCancel();return 0;
  175. }
  176. CArray<CStringArray, CStringArray>List1array;
  177. DataToArray(&List1array, &g_List1array);
  178. if(List1array.GetSize ()==0)
  179. {
  180. AfxMessageBox("此客人记录已被删除!");
  181. CDialog::OnCancel();return 0;
  182. }
  183. checkmsg = atoi(List1array.ElementAt (0).ElementAt (0));
  184. name1 = List1array.ElementAt (0).ElementAt (1);
  185. name2 = List1array.ElementAt (0).ElementAt (2);
  186. food = List1array.ElementAt (0).ElementAt (3);
  187. sex = List1array.ElementAt (0).ElementAt (4);
  188. check1 = atoi(List1array.ElementAt (0).ElementAt (5));
  189. birthdaytype = atoi(List1array.ElementAt (0).ElementAt (6));
  190. birthday = List1array.ElementAt (0).ElementAt (7);
  191. pregnancydays = List1array.ElementAt (0).ElementAt (8);
  192. qq = List1array.ElementAt (0).ElementAt (9);
  193. date1 = GetTmFromStr(List1array.ElementAt (0).ElementAt (10));
  194. no = List1array.ElementAt (0).ElementAt (11);
  195. from = List1array.ElementAt (0).ElementAt (12);
  196. clerk = List1array.ElementAt (0).ElementAt (13);
  197. type = List1array.ElementAt (0).ElementAt (14);
  198. hospital = List1array.ElementAt (0).ElementAt (15);
  199. remark = List1array.ElementAt (0).ElementAt (16);
  200. phone1 = List1array.ElementAt (0).ElementAt (17);
  201. phone2 = List1array.ElementAt (0).ElementAt (18);
  202. phone3 = List1array.ElementAt (0).ElementAt (19);
  203. phone4 = List1array.ElementAt (0).ElementAt (20);
  204. phone5 = List1array.ElementAt (0).ElementAt (21);
  205. addr1 = List1array.ElementAt (0).ElementAt (22);
  206. addr2 = List1array.ElementAt (0).ElementAt (23);
  207. addr3 = List1array.ElementAt (0).ElementAt (24);
  208. post1 = List1array.ElementAt (0).ElementAt (25);
  209. post2 = List1array.ElementAt (0).ElementAt (26);
  210. post3 = List1array.ElementAt (0).ElementAt (27);
  211. if(foodCombo.FindString (0, food)==-1)
  212. foodCombo.AddString (food);
  213. foodCombo.SetCurSel (foodCombo.FindString (0, food));
  214. if(sexCombo.FindString (0, sex)==-1)
  215. sexCombo.AddString (sex);
  216. sexCombo.SetCurSel (sexCombo.FindString (0, sex));
  217. if(typeCombo.FindString (0, type)==-1)
  218. typeCombo.AddString (type);
  219. typeCombo.SetCurSel (typeCombo.FindString (0, type));
  220. if(hospitalCombo.FindString (0, hospital)==-1)
  221. hospitalCombo.AddString (hospital);
  222. hospitalCombo.SetCurSel (hospitalCombo.FindString (0, hospital));
  223. if(fromCombo.FindString (0, from)==-1)
  224. fromCombo.AddString (from);
  225. fromCombo.SetCurSel (fromCombo.FindString (0, from));
  226. if(clerkCombo.FindString (0, clerk)==-1)
  227. clerkCombo.AddString (clerk);
  228. clerkCombo.SetCurSel (clerkCombo.FindString (0, clerk));
  229. m_List1.DeleteAllItems2 ();
  230. int ii=0;
  231. m_List1.m_arLabels.SetSize( g_List1array.GetSize (), 1 );
  232. int count=0;
  233. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  234. {
  235. m_List1.m_arLabels.ElementAt (count++).Copy (g_List1array.ElementAt (ii));
  236. }
  237. m_List1.m_arLabels.SetSize(count, 1);
  238. ii=count;
  239. m_List1.m_LabelCount=ii;
  240. m_List1.SetItemCountEx (ii);
  241. UpdateData(0);
  242. }
  243. clerkCombo.RefDroppedWidth();
  244. return false; // return TRUE unless you set the focus to a control
  245. // EXCEPTION: OCX Property Pages should return FALSE
  246. }
  247. // 保存资料;
  248. void AddHospitalClient::OnOK()
  249. {
  250. if(bAdd)
  251. {
  252. if(NewID()==0)
  253. {
  254. return;
  255. }
  256. }
  257. // TODO: Add extra validation here
  258. UpdateData();
  259. name1.TrimLeft ();
  260. name1.TrimRight ();
  261. name2.TrimLeft ();
  262. name2.TrimRight ();
  263. if(name1.IsEmpty () && name2.IsEmpty ())
  264. {
  265. AfxMessageBox("姓名不能为空!", MB_ICONINFORMATION);return;
  266. }
  267. if(!CheckDateOK(birthday))return;
  268. phone1.TrimLeft ();
  269. phone1.TrimRight ();
  270. if(!phone1.IsEmpty ())
  271. {
  272. if(phone1.Left (1)=="1")
  273. {
  274. if(CheckPhoneType(phone1)==-1)
  275. {
  276. AfxMessageBox("手机号码:"+phone1+"错误!", MB_ICONINFORMATION);
  277. return;
  278. }
  279. }
  280. }
  281. phone2.TrimLeft ();
  282. phone2.TrimRight ();
  283. if(!phone2.IsEmpty ())
  284. {
  285. if(phone2.Left (1)=="1")
  286. {
  287. if(CheckPhoneType(phone2)==-1)
  288. {
  289. AfxMessageBox("手机号码:"+phone2+"错误!", MB_ICONINFORMATION);
  290. return;
  291. }
  292. }
  293. }
  294. food=sex=type=hospital=from=clerk="";
  295. int pos=foodCombo.GetCurSel ();
  296. if(pos!=-1)
  297. {
  298. foodCombo.GetLBText (pos, food);
  299. }
  300. pos=sexCombo.GetCurSel ();
  301. if(pos!=-1)
  302. {
  303. sexCombo.GetLBText (pos, sex);
  304. }
  305. pos=typeCombo.GetCurSel ();
  306. if(pos!=-1)
  307. {
  308. typeCombo.GetLBText (pos, type);
  309. }
  310. pos=hospitalCombo.GetCurSel ();
  311. if(pos!=-1)
  312. {
  313. hospitalCombo.GetLBText (pos, hospital);
  314. }
  315. pos=fromCombo.GetCurSel ();
  316. if(pos!=-1)
  317. {
  318. fromCombo.GetLBText (pos, from);
  319. }
  320. pos=clerkCombo.GetCurSel ();
  321. if(pos!=-1)
  322. {
  323. clerkCombo.GetLBText (pos, clerk);
  324. }
  325. CString strRes1,strRes2;
  326. GetFirstLetter(name1, strRes1);
  327. GetFirstLetter(name2, strRes2);
  328. CString sql,sql2;
  329. if(bAdd)
  330. sql.Format ("insert into [hospitalclient] ([id],[checkmsg],[name1],[name2],[food],[sex],[check1],[birthdaytype],[birthday],[pregnancydays],[qq],[date1],[from],[clerk],[type],[hospital],[remark],[phone1],[phone2],[phone3],[phone4],[phone5],[addr1],[addr2],[addr3],[post1],[post2],[post3],[pinyin1],[pinyin2],[inputdate],[inputer])values('%s','%d','%s','%s','%s','%s','%d','%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",
  331. no,checkmsg,name1,name2,food,sex,check1,birthdaytype,birthday,pregnancydays,qq,date1.Format ("%Y-%m-%d"),from,clerk,type,hospital,remark,phone1,phone2,phone3,phone4,phone5,addr1,addr2,addr3,post1,post2,post3,strRes1,strRes2,g_date,g_user.name);
  332. else
  333. sql.Format ("update [hospitalclient] set [checkmsg]='%d',[name1]='%s',[name2]='%s',[food]='%s',[sex]='%s',[check1]='%d',[birthdaytype]='%d',[birthday]='%s',[pregnancydays]='%s',[qq]='%s',[date1]='%s',[from]='%s',[clerk]='%s',[type]='%s',[hospital]='%s',[remark]='%s',[phone1]='%s',[phone2]='%s',[phone3]='%s',[phone4]='%s',[phone5]='%s',[addr1]='%s',[addr2]='%s',[addr3]='%s',[post1]='%s',[post2]='%s',[post3]='%s',[pinyin1]='%s',[pinyin2]='%s' where [id]='%s'",
  334. checkmsg,name1,name2,food,sex,check1,birthdaytype,birthday,pregnancydays,qq,date1.Format ("%Y-%m-%d"),from,clerk,type,hospital,remark,phone1,phone2,phone3,phone4,phone5,addr1,addr2,addr3,post1,post2,post3,strRes1,strRes2,no);
  335. g_sendhead.bsql=1;
  336. g_pMainWnd->ProcessChatMessageRequest2(sql);
  337. if(g_bSendOK==0)
  338. return;
  339. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  340. bAdd=0;
  341. }
  342. BOOL AddHospitalClient::NewID()
  343. {
  344. g_bNoConnDlg=1;
  345. CString date=g_date;date.Replace("-", "");
  346. CString sql;
  347. sql="select max(id) as cot from [hospitalclient] where id like '"+date+"%' ";
  348. g_sendhead.bsql=1;
  349. g_pMainWnd->ProcessChatMessageRequest2(sql);
  350. g_bNoConnDlg=0;
  351. if(g_bSendOK==0)return 0;
  352. date.Replace ("-", "");
  353. no.Format ("%s-%03d", date, g_ncount+1);
  354. SetDlgItemText(IDC_EDITno, no);
  355. return 1;
  356. }
  357. void AddHospitalClient::GetContactReg()
  358. {
  359. CString filter="id='"+no+"'";
  360. g_sendhead.bsql=0;
  361. g_sendhead.code[0]=204;
  362. g_sendhead.tabcount=1;
  363. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  364. DataToArray(&g_List1array);
  365. m_List1.DeleteAllItems2 ();
  366. int ii=0;
  367. m_List1.m_arLabels.SetSize( g_List1array.GetSize (), 1 );
  368. int count=0;
  369. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  370. {
  371. m_List1.m_arLabels.ElementAt (count++).Copy (g_List1array.ElementAt (ii));
  372. }
  373. m_List1.m_arLabels.SetSize(count, 1);
  374. ii=count;
  375. m_List1.m_LabelCount=ii;
  376. m_List1.SetItemCountEx (ii);
  377. }
  378. void AddHospitalClient::OnButton2()
  379. {
  380. // TODO: Add your control notification handler code here
  381. POSITION pos;
  382. pos=m_List1.GetFirstSelectedItemPosition();
  383. if(pos==NULL)
  384. {
  385. AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);return;
  386. return;
  387. }
  388. if(AfxMessageBox("提醒:删除后无法恢复, 继续吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
  389. int iItem=m_List1.GetNextSelectedItem(pos);
  390. CString autoid=m_List1.GetItemText (iItem, 0);
  391. CString sql;
  392. sql.Format ("delete from [hospitalclientcontactreg] where autoid=%d", atoi(autoid) );
  393. g_sendhead.bsql=1;
  394. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  395. GetContactReg();
  396. }
  397. void AddHospitalClient::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  398. {
  399. // TODO: Add your control notification handler code here
  400. POSITION pos;
  401. pos=m_List1.GetFirstSelectedItemPosition();
  402. if(pos==NULL)
  403. {
  404. businesstypeCombo.SetCurSel (-1);
  405. businessintentionCombo.SetCurSel (-1);
  406. desaddrCombo.SetCurSel (-1);
  407. bookingdate = GetTmFromStr(g_date);
  408. businessremark = _T("");
  409. alarmcheck = FALSE;
  410. alarmdate = GetTmFromStr(g_date);
  411. UpdateData(0);
  412. return;
  413. }
  414. int iItem=m_List1.GetNextSelectedItem(pos);
  415. CString autoid = m_List1.GetItemText (iItem, 0);
  416. businesstype = m_List1.GetItemText (iItem, 1);
  417. businessintention = m_List1.GetItemText (iItem, 2);
  418. bookingdate = GetTmFromStr(m_List1.GetItemText (iItem, 3));
  419. desaddr = m_List1.GetItemText (iItem, 4);
  420. businessremark = m_List1.GetItemText (iItem, 5);
  421. if(m_List1.GetItemText (iItem, 6)=="提醒")
  422. alarmcheck = 1;
  423. else
  424. alarmcheck = 0;
  425. alarmdate = GetTmFromStr(m_List1.GetItemText (iItem, 7));
  426. if(businesstypeCombo.FindString (0, businesstype)==-1)
  427. businesstypeCombo.AddString (businesstype);
  428. businesstypeCombo.SetCurSel (businesstypeCombo.FindString (0, businesstype));
  429. if(businessintentionCombo.FindString (0, businessintention)==-1)
  430. businessintentionCombo.AddString (businessintention);
  431. businessintentionCombo.SetCurSel (businessintentionCombo.FindString (0, businessintention));
  432. if(desaddrCombo.FindString (0, desaddr)==-1)
  433. desaddrCombo.AddString (desaddr);
  434. desaddrCombo.SetCurSel (desaddrCombo.FindString (0, desaddr));
  435. UpdateData(0);
  436. *pResult = 0;
  437. }
  438. void AddHospitalClient::OnButton1()
  439. {
  440. // TODO: Add your control notification handler code here
  441. UpdateData();
  442. if(bAdd)
  443. {
  444. AfxMessageBox("请先保存基本资料!", MB_ICONINFORMATION);return;
  445. return;
  446. }
  447. CString autoid;
  448. {
  449. POSITION pos;
  450. pos=m_List1.GetFirstSelectedItemPosition();
  451. if(pos!=NULL)
  452. {
  453. int iItem=m_List1.GetNextSelectedItem(pos);
  454. autoid = m_List1.GetItemText (iItem, 0);
  455. }
  456. }
  457. businesstype=businessintention=desaddr="";
  458. int pos=businesstypeCombo.GetCurSel ();
  459. if(pos!=-1)
  460. {
  461. businesstypeCombo.GetLBText (pos, businesstype);
  462. }
  463. else
  464. {
  465. AfxMessageBox("资料不全!", MB_ICONINFORMATION);return;
  466. return;
  467. }
  468. pos=businessintentionCombo.GetCurSel ();
  469. if(pos!=-1)
  470. {
  471. businessintentionCombo.GetLBText (pos, businessintention);
  472. }
  473. pos=desaddrCombo.GetCurSel ();
  474. if(pos!=-1)
  475. {
  476. desaddrCombo.GetLBText (pos, desaddr);
  477. }
  478. CString salarmcheck;
  479. if(alarmcheck)
  480. salarmcheck="提醒";
  481. else
  482. salarmcheck="不提醒";
  483. CString sql;
  484. if(autoid=="")
  485. sql.Format ("insert into [hospitalclientcontactreg]([id],[businesstype],[businessintention],[bookingdate],[desaddr],[businessremark],[alarmcheck],[alarmdate])values('%s','%s','%s','%s','%s','%s','%s','%s')",
  486. no,businesstype,businessintention,bookingdate.Format ("%Y-%m-%d"),desaddr,businessremark,salarmcheck,alarmdate.Format ("%Y-%m-%d"));
  487. else
  488. sql.Format ("update [hospitalclientcontactreg] set [businesstype]='%s',[businessintention]='%s',[bookingdate]='%s',[desaddr]='%s',[businessremark]='%s',[alarmcheck]='%s',[alarmdate]='%s' where [autoid]=%s",
  489. businesstype,businessintention,bookingdate.Format ("%Y-%m-%d"),desaddr,businessremark,salarmcheck,alarmdate.Format ("%Y-%m-%d"), autoid);
  490. g_sendhead.bsql=1;
  491. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  492. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  493. GetContactReg();
  494. }