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. int ii = 0;
  147. for( ii=0; ii<List1array.GetSize (); ii++)
  148. businesstypeCombo.AddString ( List1array.ElementAt (ii).ElementAt(0) );
  149. for( ii=0; ii<List2array.GetSize (); ii++)
  150. businessintentionCombo.AddString ( List2array.ElementAt (ii).ElementAt(0) );
  151. for( ii=0; ii<List3array.GetSize (); ii++)
  152. typeCombo.AddString ( List3array.ElementAt (ii).ElementAt(0) );
  153. for( ii=0; ii<List4array.GetSize (); ii++)
  154. hospitalCombo.AddString ( List4array.ElementAt (ii).ElementAt(0) );
  155. for( ii=0; ii<List5array.GetSize (); ii++)
  156. fromCombo.AddString ( List5array.ElementAt (ii).ElementAt(0) );
  157. if(bAdd)
  158. {
  159. if(NewID()==0)
  160. {
  161. CDialog::OnCancel();return 0;
  162. }
  163. }
  164. else
  165. {
  166. SetWindowText("客户资料-修改");
  167. CString filter="id='"+no+"';id='"+no+"'";
  168. g_sendhead.bsql=0;
  169. g_sendhead.code[0]=206;
  170. g_sendhead.code[1]=204;
  171. g_sendhead.tabcount=2;
  172. g_pMainWnd->ProcessChatMessageRequest2(filter);
  173. if(g_bSendOK==0)
  174. {
  175. CDialog::OnCancel();return 0;
  176. }
  177. CArray<CStringArray, CStringArray>List1array;
  178. DataToArray(&List1array, &g_List1array);
  179. if(List1array.GetSize ()==0)
  180. {
  181. AfxMessageBox("此客人记录已被删除!");
  182. CDialog::OnCancel();return 0;
  183. }
  184. checkmsg = atoi(List1array.ElementAt (0).ElementAt (0));
  185. name1 = List1array.ElementAt (0).ElementAt (1);
  186. name2 = List1array.ElementAt (0).ElementAt (2);
  187. food = List1array.ElementAt (0).ElementAt (3);
  188. sex = List1array.ElementAt (0).ElementAt (4);
  189. check1 = atoi(List1array.ElementAt (0).ElementAt (5));
  190. birthdaytype = atoi(List1array.ElementAt (0).ElementAt (6));
  191. birthday = List1array.ElementAt (0).ElementAt (7);
  192. pregnancydays = List1array.ElementAt (0).ElementAt (8);
  193. qq = List1array.ElementAt (0).ElementAt (9);
  194. date1 = GetTmFromStr(List1array.ElementAt (0).ElementAt (10));
  195. no = List1array.ElementAt (0).ElementAt (11);
  196. from = List1array.ElementAt (0).ElementAt (12);
  197. clerk = List1array.ElementAt (0).ElementAt (13);
  198. type = List1array.ElementAt (0).ElementAt (14);
  199. hospital = List1array.ElementAt (0).ElementAt (15);
  200. remark = List1array.ElementAt (0).ElementAt (16);
  201. phone1 = List1array.ElementAt (0).ElementAt (17);
  202. phone2 = List1array.ElementAt (0).ElementAt (18);
  203. phone3 = List1array.ElementAt (0).ElementAt (19);
  204. phone4 = List1array.ElementAt (0).ElementAt (20);
  205. phone5 = List1array.ElementAt (0).ElementAt (21);
  206. addr1 = List1array.ElementAt (0).ElementAt (22);
  207. addr2 = List1array.ElementAt (0).ElementAt (23);
  208. addr3 = List1array.ElementAt (0).ElementAt (24);
  209. post1 = List1array.ElementAt (0).ElementAt (25);
  210. post2 = List1array.ElementAt (0).ElementAt (26);
  211. post3 = List1array.ElementAt (0).ElementAt (27);
  212. if(foodCombo.FindString (0, food)==-1)
  213. foodCombo.AddString (food);
  214. foodCombo.SetCurSel (foodCombo.FindString (0, food));
  215. if(sexCombo.FindString (0, sex)==-1)
  216. sexCombo.AddString (sex);
  217. sexCombo.SetCurSel (sexCombo.FindString (0, sex));
  218. if(typeCombo.FindString (0, type)==-1)
  219. typeCombo.AddString (type);
  220. typeCombo.SetCurSel (typeCombo.FindString (0, type));
  221. if(hospitalCombo.FindString (0, hospital)==-1)
  222. hospitalCombo.AddString (hospital);
  223. hospitalCombo.SetCurSel (hospitalCombo.FindString (0, hospital));
  224. if(fromCombo.FindString (0, from)==-1)
  225. fromCombo.AddString (from);
  226. fromCombo.SetCurSel (fromCombo.FindString (0, from));
  227. if(clerkCombo.FindString (0, clerk)==-1)
  228. clerkCombo.AddString (clerk);
  229. clerkCombo.SetCurSel (clerkCombo.FindString (0, clerk));
  230. m_List1.DeleteAllItems2 ();
  231. int ii=0;
  232. m_List1.m_arLabels.SetSize( g_List1array.GetSize (), 1 );
  233. int count=0;
  234. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  235. {
  236. m_List1.m_arLabels.ElementAt (count++).Copy (g_List1array.ElementAt (ii));
  237. }
  238. m_List1.m_arLabels.SetSize(count, 1);
  239. ii=count;
  240. m_List1.m_LabelCount=ii;
  241. m_List1.SetItemCountEx (ii);
  242. UpdateData(0);
  243. }
  244. clerkCombo.RefDroppedWidth();
  245. return false; // return TRUE unless you set the focus to a control
  246. // EXCEPTION: OCX Property Pages should return FALSE
  247. }
  248. // 保存资料;
  249. void AddHospitalClient::OnOK()
  250. {
  251. if(bAdd)
  252. {
  253. if(NewID()==0)
  254. {
  255. return;
  256. }
  257. }
  258. // TODO: Add extra validation here
  259. UpdateData();
  260. name1.TrimLeft ();
  261. name1.TrimRight ();
  262. name2.TrimLeft ();
  263. name2.TrimRight ();
  264. if(name1.IsEmpty () && name2.IsEmpty ())
  265. {
  266. AfxMessageBox("姓名不能为空!", MB_ICONINFORMATION);return;
  267. }
  268. if(!CheckDateOK(birthday))return;
  269. phone1.TrimLeft ();
  270. phone1.TrimRight ();
  271. if(!phone1.IsEmpty ())
  272. {
  273. if(phone1.Left (1)=="1")
  274. {
  275. if(CheckPhoneType(phone1)==-1)
  276. {
  277. AfxMessageBox("手机号码:"+phone1+"错误!", MB_ICONINFORMATION);
  278. return;
  279. }
  280. }
  281. }
  282. phone2.TrimLeft ();
  283. phone2.TrimRight ();
  284. if(!phone2.IsEmpty ())
  285. {
  286. if(phone2.Left (1)=="1")
  287. {
  288. if(CheckPhoneType(phone2)==-1)
  289. {
  290. AfxMessageBox("手机号码:"+phone2+"错误!", MB_ICONINFORMATION);
  291. return;
  292. }
  293. }
  294. }
  295. food=sex=type=hospital=from=clerk="";
  296. int pos=foodCombo.GetCurSel ();
  297. if(pos!=-1)
  298. {
  299. foodCombo.GetLBText (pos, food);
  300. }
  301. pos=sexCombo.GetCurSel ();
  302. if(pos!=-1)
  303. {
  304. sexCombo.GetLBText (pos, sex);
  305. }
  306. pos=typeCombo.GetCurSel ();
  307. if(pos!=-1)
  308. {
  309. typeCombo.GetLBText (pos, type);
  310. }
  311. pos=hospitalCombo.GetCurSel ();
  312. if(pos!=-1)
  313. {
  314. hospitalCombo.GetLBText (pos, hospital);
  315. }
  316. pos=fromCombo.GetCurSel ();
  317. if(pos!=-1)
  318. {
  319. fromCombo.GetLBText (pos, from);
  320. }
  321. pos=clerkCombo.GetCurSel ();
  322. if(pos!=-1)
  323. {
  324. clerkCombo.GetLBText (pos, clerk);
  325. }
  326. CString strRes1,strRes2;
  327. ChinesePinYin::GetFirstLetter(name1, strRes1);
  328. ChinesePinYin::GetFirstLetter(name2, strRes2);
  329. CString sql,sql2;
  330. if(bAdd)
  331. 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')",
  332. 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);
  333. else
  334. 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'",
  335. 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);
  336. g_sendhead.bsql=1;
  337. g_pMainWnd->ProcessChatMessageRequest2(sql);
  338. if(g_bSendOK==0)
  339. return;
  340. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  341. bAdd=0;
  342. }
  343. BOOL AddHospitalClient::NewID()
  344. {
  345. g_bNoConnDlg=1;
  346. CString date=g_date;date.Replace("-", "");
  347. CString sql;
  348. sql="select max(id) as cot from [hospitalclient] where id like '"+date+"%' ";
  349. g_sendhead.bsql=1;
  350. g_pMainWnd->ProcessChatMessageRequest2(sql);
  351. g_bNoConnDlg=0;
  352. if(g_bSendOK==0)return 0;
  353. date.Replace ("-", "");
  354. no.Format ("%s-%03d", date, g_ncount+1);
  355. SetDlgItemText(IDC_EDITno, no);
  356. return 1;
  357. }
  358. void AddHospitalClient::GetContactReg()
  359. {
  360. CString filter="id='"+no+"'";
  361. g_sendhead.bsql=0;
  362. g_sendhead.code[0]=204;
  363. g_sendhead.tabcount=1;
  364. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  365. DataToArray(&g_List1array);
  366. m_List1.DeleteAllItems2 ();
  367. int ii=0;
  368. m_List1.m_arLabels.SetSize( g_List1array.GetSize (), 1 );
  369. int count=0;
  370. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  371. {
  372. m_List1.m_arLabels.ElementAt (count++).Copy (g_List1array.ElementAt (ii));
  373. }
  374. m_List1.m_arLabels.SetSize(count, 1);
  375. ii=count;
  376. m_List1.m_LabelCount=ii;
  377. m_List1.SetItemCountEx (ii);
  378. }
  379. void AddHospitalClient::OnButton2()
  380. {
  381. // TODO: Add your control notification handler code here
  382. POSITION pos;
  383. pos=m_List1.GetFirstSelectedItemPosition();
  384. if(pos==NULL)
  385. {
  386. AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);return;
  387. return;
  388. }
  389. if(AfxMessageBox("提醒:删除后无法恢复, 继续吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
  390. int iItem=m_List1.GetNextSelectedItem(pos);
  391. CString autoid=m_List1.GetItemText (iItem, 0);
  392. CString sql;
  393. sql.Format ("delete from [hospitalclientcontactreg] where autoid=%d", atoi(autoid) );
  394. g_sendhead.bsql=1;
  395. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  396. GetContactReg();
  397. }
  398. void AddHospitalClient::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  399. {
  400. // TODO: Add your control notification handler code here
  401. POSITION pos;
  402. pos=m_List1.GetFirstSelectedItemPosition();
  403. if(pos==NULL)
  404. {
  405. businesstypeCombo.SetCurSel (-1);
  406. businessintentionCombo.SetCurSel (-1);
  407. desaddrCombo.SetCurSel (-1);
  408. bookingdate = GetTmFromStr(g_date);
  409. businessremark = _T("");
  410. alarmcheck = FALSE;
  411. alarmdate = GetTmFromStr(g_date);
  412. UpdateData(0);
  413. return;
  414. }
  415. int iItem=m_List1.GetNextSelectedItem(pos);
  416. CString autoid = m_List1.GetItemText (iItem, 0);
  417. businesstype = m_List1.GetItemText (iItem, 1);
  418. businessintention = m_List1.GetItemText (iItem, 2);
  419. bookingdate = GetTmFromStr(m_List1.GetItemText (iItem, 3));
  420. desaddr = m_List1.GetItemText (iItem, 4);
  421. businessremark = m_List1.GetItemText (iItem, 5);
  422. if(m_List1.GetItemText (iItem, 6)=="提醒")
  423. alarmcheck = 1;
  424. else
  425. alarmcheck = 0;
  426. alarmdate = GetTmFromStr(m_List1.GetItemText (iItem, 7));
  427. if(businesstypeCombo.FindString (0, businesstype)==-1)
  428. businesstypeCombo.AddString (businesstype);
  429. businesstypeCombo.SetCurSel (businesstypeCombo.FindString (0, businesstype));
  430. if(businessintentionCombo.FindString (0, businessintention)==-1)
  431. businessintentionCombo.AddString (businessintention);
  432. businessintentionCombo.SetCurSel (businessintentionCombo.FindString (0, businessintention));
  433. if(desaddrCombo.FindString (0, desaddr)==-1)
  434. desaddrCombo.AddString (desaddr);
  435. desaddrCombo.SetCurSel (desaddrCombo.FindString (0, desaddr));
  436. UpdateData(0);
  437. *pResult = 0;
  438. }
  439. void AddHospitalClient::OnButton1()
  440. {
  441. // TODO: Add your control notification handler code here
  442. UpdateData();
  443. if(bAdd)
  444. {
  445. AfxMessageBox("请先保存基本资料!", MB_ICONINFORMATION);return;
  446. return;
  447. }
  448. CString autoid;
  449. {
  450. POSITION pos;
  451. pos=m_List1.GetFirstSelectedItemPosition();
  452. if(pos!=NULL)
  453. {
  454. int iItem=m_List1.GetNextSelectedItem(pos);
  455. autoid = m_List1.GetItemText (iItem, 0);
  456. }
  457. }
  458. businesstype=businessintention=desaddr="";
  459. int pos=businesstypeCombo.GetCurSel ();
  460. if(pos!=-1)
  461. {
  462. businesstypeCombo.GetLBText (pos, businesstype);
  463. }
  464. else
  465. {
  466. AfxMessageBox("资料不全!", MB_ICONINFORMATION);return;
  467. return;
  468. }
  469. pos=businessintentionCombo.GetCurSel ();
  470. if(pos!=-1)
  471. {
  472. businessintentionCombo.GetLBText (pos, businessintention);
  473. }
  474. pos=desaddrCombo.GetCurSel ();
  475. if(pos!=-1)
  476. {
  477. desaddrCombo.GetLBText (pos, desaddr);
  478. }
  479. CString salarmcheck;
  480. if(alarmcheck)
  481. salarmcheck="提醒";
  482. else
  483. salarmcheck="不提醒";
  484. CString sql;
  485. if(autoid=="")
  486. sql.Format ("insert into [hospitalclientcontactreg]([id],[businesstype],[businessintention],[bookingdate],[desaddr],[businessremark],[alarmcheck],[alarmdate])values('%s','%s','%s','%s','%s','%s','%s','%s')",
  487. no,businesstype,businessintention,bookingdate.Format ("%Y-%m-%d"),desaddr,businessremark,salarmcheck,alarmdate.Format ("%Y-%m-%d"));
  488. else
  489. sql.Format ("update [hospitalclientcontactreg] set [businesstype]='%s',[businessintention]='%s',[bookingdate]='%s',[desaddr]='%s',[businessremark]='%s',[alarmcheck]='%s',[alarmdate]='%s' where [autoid]=%s",
  490. businesstype,businessintention,bookingdate.Format ("%Y-%m-%d"),desaddr,businessremark,salarmcheck,alarmdate.Format ("%Y-%m-%d"), autoid);
  491. g_sendhead.bsql=1;
  492. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  493. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  494. GetContactReg();
  495. }