📄 didlg.cpp
字号:
// DiDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Di.h"
#include "DiDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDiDlg dialog
CDiDlg::CDiDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDiDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDiDlg)
m_check_Edit = _T("");
m_cheng_Radio = -1;
m_result_Edit = _T("");
m_treat_Edit = _T("");
m_type_Radio = -1;
m_w3_Edit = _T("");
m_w4_Edit = _T("");
m_x1_Check = FALSE;
m_x2_Check = FALSE;
m_x3_Check = FALSE;
m_x4_Check = FALSE;
m_x5_Check = FALSE;
m_x6_Check = FALSE;
m_x7_Check = FALSE;
m_x8_Check = FALSE;
m_x9_Check = FALSE;
m_w1_Edit = _T("");
m_w2_Edit = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CDiDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDiDlg)
DDX_Control(pDX, IDC_REASON_EDIT, m_reason_Edit);
DDX_Control(pDX, IDC_TIME_EDIT, m_time_Edit);
DDX_Control(pDX, IDC_JJ_BUTTON, m_jj_Button);
DDX_Control(pDX, IDC_NAME_COMBO, m_name_Combo);
DDX_Control(pDX, IDC_ID_COMBO, m_id_Combo);
DDX_Control(pDX, IDC_ADD_EDIT, m_add_Edit);
DDX_Text(pDX, IDC_CHECK_EDIT, m_check_Edit);
DDX_Radio(pDX, IDC_CHENG_RADIO, m_cheng_Radio);
DDX_Text(pDX, IDC_RESULT_EDIT, m_result_Edit);
DDX_Text(pDX, IDC_TREAT_EDIT, m_treat_Edit);
DDX_Radio(pDX, IDC_TYPE_RADIO, m_type_Radio);
DDX_Text(pDX, IDC_W3_EDIT, m_w3_Edit);
DDX_Text(pDX, IDC_W4_EDIT, m_w4_Edit);
DDX_Check(pDX, IDC_X1_CHECK, m_x1_Check);
DDX_Check(pDX, IDC_X2_CHECK, m_x2_Check);
DDX_Check(pDX, IDC_X3_CHECK, m_x3_Check);
DDX_Check(pDX, IDC_X4_CHECK, m_x4_Check);
DDX_Check(pDX, IDC_X5_CHECK, m_x5_Check);
DDX_Check(pDX, IDC_X6_CHECK, m_x6_Check);
DDX_Check(pDX, IDC_X7_CHECK, m_x7_Check);
DDX_Check(pDX, IDC_X8_CHECK, m_x8_Check);
DDX_Check(pDX, IDC_X9_CHECK, m_x9_Check);
DDX_Text(pDX, IDC_W1_EDIT, m_w1_Edit);
DDX_Text(pDX, IDC_W2_EDIT, m_w2_Edit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDiDlg, CDialog)
//{{AFX_MSG_MAP(CDiDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_CONF_BUTTON, OnConfButton)
ON_BN_CLICKED(IDC_IN_BUTTON, OnInButton)
ON_BN_CLICKED(IDC_MODI_BUTTON, OnModiButton)
ON_BN_CLICKED(IDC_ROME_RADIO, OnRomeRadio)
ON_BN_CLICKED(IDC_TYPE_RADIO, OnTypeRadio)
ON_BN_CLICKED(IDC_JJ_BUTTON, OnJjButton)
ON_BN_CLICKED(IDC_EXIT_BUTTON, OnExitButton)
ON_CBN_EDITCHANGE(IDC_ID_COMBO, OnEditchangeIdCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDiDlg message handlers
BOOL CDiDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
int i,j;
number=4;
k=0;
//病人资料初始化
for(i=0;i<100;i++)
{
Patient[i].ID=2003000+i+1;
strcpy(Patient[i].name,"");
strcpy(Patient[i].info,"");
strcpy(Patient[i].time,"");
strcpy(Patient[i].reason,"");
Patient[i].type=0;
for(j=0;j<12;j++)
Patient[i].state[j]=0;
}
//四个住院病人
strcpy(Patient[19].name,"万无云");
strcpy(Patient[39].name,"笑西风");
strcpy(Patient[79].name,"风见愁");
strcpy(Patient[99].name,"傲剑峰");
strcpy(Patient[19].info,"有毒气吸入史,急性发作5次,春秋季症状加重");
strcpy(Patient[39].info,"起病急,多种抗生素抗药性");
strcpy(Patient[79].info,"有过敏史,春季易发病");
strcpy(Patient[99].info,"起病隐秘,病程长");
Patient[19].type=1;
Patient[39].type=1;
Patient[79].type=1;
Patient[99].type=1;
strcpy(Patient[19].time,"10天");
strcpy(Patient[39].time,"1天");
strcpy(Patient[79].time,"1天");
strcpy(Patient[99].time,"22天");
strcpy(Patient[19].reason,"慢性喉炎急性发病");
strcpy(Patient[39].reason,"急性会厌炎");
strcpy(Patient[79].reason,"急性喉炎");
strcpy(Patient[99].reason,"低热");
for(i=0;i<9;i++)
if(i%2==0)
Patient[19].state[i]=1;
Patient[19].state[11]=1;
for(i=0;i<9;i++)
if(i%2!=0)
Patient[39].state[i]=1;
Patient[39].state[9]=1;
for(i=0;i<9;i++)
if(i%2==0)
Patient[79].state[i]=1;
Patient[79].state[11]=1;
for(i=0;i<9;i++)
if(i%3==0)
Patient[99].state[i]=1;
Patient[99].state[11]=1;
//四种疾病
strcpy(w[0],"急性会厌炎");
strcpy(w[1],"急性喉炎");
strcpy(w[2],"慢性喉炎");
strcpy(w[3],"喉癌");
strcpy(w[4],"不能确诊");
//发病概率数据
for(i=0;i<4;i++)
score[i]=0;
pw[0]=20;pw[1]=40;pw[2]=30;pw[3]=10;
px[0][0]=100;px[0][1]=100;px[0][2]=0;px[0][3]=20;px[0][4]=0;
for(i=0;i<4;i++)
px[0][4]+=pw[i]*px[0][i]/100;
px[1][0]=0;px[1][1]=0;px[1][2]=80;px[1][3]=50;px[1][4]=0;
for(i=0;i<4;i++)
px[1][4]+=pw[i]*px[1][i]/100;
px[2][0]=50;px[2][1]=20;px[2][2]=10;px[2][3]=60;px[2][4]=0;
for(i=0;i<4;i++)
px[2][4]+=pw[i]*px[2][i]/100;
px[3][0]=20;px[3][1]=20;px[3][2]=70;px[3][3]=80;px[3][4]=0;
for(i=0;i<4;i++)
px[3][4]+=pw[i]*px[3][i]/100;
px[4][0]=20;px[4][1]=5;px[4][2]=0;px[4][3]=60;px[4][4]=0;
for(i=0;i<4;i++)
px[4][4]+=pw[i]*px[4][i]/100;
px[5][0]=100;px[5][1]=0;px[5][2]=0;px[5][3]=10;px[5][4]=0;
for(i=0;i<4;i++)
px[5][4]+=pw[i]*px[5][i]/100;
px[6][0]=0;px[6][1]=100;px[6][2]=20;px[6][3]=10;px[6][4]=0;
for(i=0;i<4;i++)
px[6][4]+=pw[i]*px[6][i]/100;
px[7][0]=0;px[7][1]=10;px[7][2]=80;px[7][3]=10;px[7][4]=0;
for(i=0;i<4;i++)
px[7][4]+=pw[i]*px[7][i]/100;
px[8][0]=0;px[8][1]=0;px[8][2]=10;px[8][3]=100;px[8][4]=0;
for(i=0;i<4;i++)
px[8][4]+=pw[i]*px[8][i]/100;
px[9][0]=90;px[9][1]=90;px[9][2]=0;px[9][3]=0;px[9][4]=0;
for(i=0;i<4;i++)
px[9][4]+=pw[i]*px[9][i]/100;
px[10][0]=20;px[10][1]=20;px[10][2]=40;px[10][3]=40;px[10][4]=0;
for(i=0;i<4;i++)
px[10][4]+=pw[i]*px[10][i]/100;
px[11][0]=0;px[11][1]=0;px[11][2]=60;px[11][3]=60;px[11][4]=0;
for(i=0;i<4;i++)
px[11][4]+=pw[i]*px[11][i]/100;
//症状标记
for(i=0;i<12;i++)
xs[i]=0;
CWnd::CheckRadioButton(IDC_TYPE_RADIO,IDC_ROME_RADIO,IDC_TYPE_RADIO);
CWnd::CheckRadioButton(IDC_CHENG_RADIO,IDC_RADIO5,IDC_CHENG_RADIO);
return TRUE; // return TRUE unless you set the focus to a control
}
void CDiDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CDiDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CDiDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CDiDlg::OnConfButton()
{
char detect[9][100],treat[9][100];
//建议进一步检查
strcpy(detect[0],"确诊,无需再检查请进行治疗");
strcpy(detect[1],"建议直接喉镜检查");
strcpy(detect[2],"确诊,无需再检查请进行治疗");
strcpy(detect[3],"建议直接喉镜检查");
strcpy(detect[4],"建议痰检,排除是否存在感染已确定治疗方案");
strcpy(detect[5],"建议肺片检查排除肺部疾病");
strcpy(detect[6],"建议检查确定浸润范围");
strcpy(detect[7],"建议病理活检");
strcpy(detect[8],"建议与其他科室专家会诊再决定诊断意见");
//建议治疗
strcpy(treat[0],"请进行抗炎治疗3天以上");
strcpy(treat[1],"请进行诊断性抗炎治疗1天,观察疗效");
strcpy(treat[2],"请进行抗炎治疗5天以上");
strcpy(treat[3],"请进行诊断性抗炎治疗2天,观察疗效");
strcpy(treat[4],"请进行抗炎治疗,并辅中药,建议病人进行适当的锻炼");
strcpy(treat[5],"建议治疗一中药为主,在急性发作期进行抗炎治疗");
strcpy(treat[6],"建议住院,进行综合治疗");
strcpy(treat[7],"请等病理活检后再治疗或进行诊断性抗炎治疗");
strcpy(treat[8],"建议与其他科室专家会诊后再决定治疗方案");
if(score[k]>80)
switch(k)
{
case 0:m_check_Edit=detect[0];
m_treat_Edit=treat[0];
break;
case 1:m_check_Edit=detect[2];
m_treat_Edit=treat[2];
break;
case 2:m_check_Edit=detect[4];
m_treat_Edit=treat[4];
break;
case 3:m_check_Edit=detect[6];
m_treat_Edit=treat[6];
break;
default:break;
}
else if(score[k]<=80&&score[k]>=60)
switch(k)
{
case 0:m_check_Edit=detect[1];
m_treat_Edit=treat[1];
break;
case 1:m_check_Edit=detect[3];
m_treat_Edit=treat[3];
break;
case 2:m_check_Edit=detect[5];
m_treat_Edit=treat[5];
break;
case 3:m_check_Edit=detect[7];
m_treat_Edit=treat[7];
break;
default:
break;
}
else
{
m_check_Edit=detect[8];
m_treat_Edit=treat[8];
}
UpdateData(FALSE);
}
void CDiDlg::OnInButton()
{
CString id,name;
long idnum;
int typeradio;
if(number>100)
m_add_Edit.SetWindowText("缓存已满,请先进行清理");
else
{
number++;
//读取屏幕控件值
CDialog::UpdateData(TRUE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -