AddHospitalClient.cpp 17 KB

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