Commit 3092da738a79bc37bb71b25db8a0abf572e7ab21

Authored by r-ujihara
1 parent d7b16766

製造中登録(4回目)

@@ -125,20 +125,16 @@ namespace MedicalCheckInputTool @@ -125,20 +125,16 @@ namespace MedicalCheckInputTool
125 SaveData sv = makeSaveData(); //保存用データ生成(パディング済み) 125 SaveData sv = makeSaveData(); //保存用データ生成(パディング済み)
126 126
127 //マッチングチェック 127 //マッチングチェック
128 - if("2回目".Equals(Global.times)) 128 + bool matchErr = matchInput(sv);
  129 + //一致しない場合、エラー表示はするが保存は実行してしまう
  130 + if(matchErr)
129 { 131 {
130 - //1回目と比較  
131 - bool matchErr = matchInput(sv);  
132 - //一致しない場合、エラー表示はするが保存は実行してしまう  
133 - if(matchErr)  
134 - {  
135 - //保存へ進む  
136 - }  
137 - else  
138 - {  
139 - //エラーなしは完了フラグを立てる  
140 - match = true;  
141 - } 132 + //保存へ進む
  133 + }
  134 + else
  135 + {
  136 + //エラーなしは完了フラグを立てる
  137 + match = true;
142 } 138 }
143 139
144 //保存処理 140 //保存処理
@@ -188,7 +184,7 @@ namespace MedicalCheckInputTool @@ -188,7 +184,7 @@ namespace MedicalCheckInputTool
188 sv.inputUser = null; //入力者 184 sv.inputUser = null; //入力者
189 sv.updateDate = null; //修正日 185 sv.updateDate = null; //修正日
190 sv.updateUser = null; //修正者 186 sv.updateUser = null; //修正者
191 - sv.done = null; //完了 187 + sv.done = ""; //完了
192 188
193 return sv; 189 return sv;
194 } 190 }
@@ -203,7 +199,6 @@ namespace MedicalCheckInputTool @@ -203,7 +199,6 @@ namespace MedicalCheckInputTool
203 conn.Open(); 199 conn.Open();
204 200
205 bool isExist = isExistData(sv, Global.times, conn); 201 bool isExist = isExistData(sv, Global.times, conn);
206 -// bool isExist = false;  
207 if (isExist) 202 if (isExist)
208 { 203 {
209 sv.updateUser = Global.inputUser; 204 sv.updateUser = Global.inputUser;
@@ -215,17 +210,12 @@ namespace MedicalCheckInputTool @@ -215,17 +210,12 @@ namespace MedicalCheckInputTool
215 err = insertData(sv, Global.times, conn); 210 err = insertData(sv, Global.times, conn);
216 } 211 }
217 212
218 - if ("2回目".Equals(Global.times))  
219 - {  
220 - if ("1".Equals(sv.done)) //保存したデータの完了フラグが立っていたら  
221 - {  
222 - SaveData sv1 = new SaveData();  
223 - sv1.lotNo = int.Parse(Global.lotNo);  
224 - sv1.serialNo = sv.serialNo;  
225 - sv1.done = "1";  
226 - updateDoneFlag(sv1, "1回目", conn);//1回目の完了フラグも立てる  
227 - }  
228 - } 213 + SaveData sv1 = new SaveData();
  214 + sv1.lotNo = int.Parse(Global.lotNo);
  215 + sv1.serialNo = sv.serialNo;
  216 + sv1.done = sv.done;
  217 + string tableName = "1回目".Equals(Global.times) ? "2回目" : "1回目";
  218 + updateDoneFlag(sv1, tableName, conn);//別の回の完了フラグも立てる
229 219
230 conn.Close(); 220 conn.Close();
231 return err; 221 return err;
@@ -344,7 +334,8 @@ namespace MedicalCheckInputTool @@ -344,7 +334,8 @@ namespace MedicalCheckInputTool
344 conn = new MySqlConnection(connstr); 334 conn = new MySqlConnection(connstr);
345 conn.Open(); 335 conn.Open();
346 336
347 - MySqlCommand cmd = new MySqlCommand("select * from `1回目` where `ロット番号` = @lotNo and `整理番号` = @serialNo", conn); 337 + string tableName = "1回目".Equals(Global.times) ? "2回目" : "1回目";
  338 + MySqlCommand cmd = new MySqlCommand("select * from `" + tableName + "` where `ロット番号` = @lotNo and `整理番号` = @serialNo", conn);
348 // パラメータ設定 339 // パラメータ設定
349 cmd.Parameters.Add(new MySqlParameter("lotNo", sv.lotNo)); 340 cmd.Parameters.Add(new MySqlParameter("lotNo", sv.lotNo));
350 cmd.Parameters.Add(new MySqlParameter("serialNo", sv.serialNo)); 341 cmd.Parameters.Add(new MySqlParameter("serialNo", sv.serialNo));
@@ -373,7 +364,10 @@ namespace MedicalCheckInputTool @@ -373,7 +364,10 @@ namespace MedicalCheckInputTool
373 if (!reader.HasRows) 364 if (!reader.HasRows)
374 { 365 {
375 //無かった 366 //無かった
376 - textBox1.BackColor = Color.Pink; 367 + if("2回目".Equals(Global.times))
  368 + {
  369 + textBox1.BackColor = Color.Pink;
  370 + }
377 err = true; 371 err = true;
378 reader.Close(); 372 reader.Close();
379 } 373 }
@@ -384,17 +378,26 @@ namespace MedicalCheckInputTool @@ -384,17 +378,26 @@ namespace MedicalCheckInputTool
384 { 378 {
385 if (!sv.houseNo.Equals(isDBNull(reader, "世帯番号"))) 379 if (!sv.houseNo.Equals(isDBNull(reader, "世帯番号")))
386 { 380 {
387 - textBox2.BackColor = Color.Pink; 381 + if("2回目".Equals(Global.times))
  382 + {
  383 + textBox2.BackColor = Color.Pink;
  384 + }
388 err = true; 385 err = true;
389 } 386 }
390 if (!sv.phone.Equals(isDBNull(reader, "電話番号"))) 387 if (!sv.phone.Equals(isDBNull(reader, "電話番号")))
391 { 388 {
392 - textBox4.BackColor = Color.Pink; 389 + if("2回目".Equals(Global.times))
  390 + {
  391 + textBox4.BackColor = Color.Pink;
  392 + }
393 err = true; 393 err = true;
394 } 394 }
395 if (!sv.mobilePhone.Equals(isDBNull(reader, "携帯番号"))) 395 if (!sv.mobilePhone.Equals(isDBNull(reader, "携帯番号")))
396 { 396 {
397 - textBox5.BackColor = Color.Pink; 397 + if("2回目".Equals(Global.times))
  398 + {
  399 + textBox5.BackColor = Color.Pink;
  400 + }
398 err = true; 401 err = true;
399 } 402 }
400 if (!sv.healthCheck.Equals(isDBNull(reader, "健康診査"))) 403 if (!sv.healthCheck.Equals(isDBNull(reader, "健康診査")))
@@ -404,52 +407,82 @@ namespace MedicalCheckInputTool @@ -404,52 +407,82 @@ namespace MedicalCheckInputTool
404 } 407 }
405 if (!sv.lungCancer.Equals(isDBNull(reader, "結核肺がん"))) 408 if (!sv.lungCancer.Equals(isDBNull(reader, "結核肺がん")))
406 { 409 {
407 - textBox7.BackColor = Color.Pink; 410 + if("2回目".Equals(Global.times))
  411 + {
  412 + textBox7.BackColor = Color.Pink;
  413 + }
408 err = true; 414 err = true;
409 } 415 }
410 if (!sv.stomachCancer.Equals(isDBNull(reader, "胃がん"))) 416 if (!sv.stomachCancer.Equals(isDBNull(reader, "胃がん")))
411 { 417 {
412 - textBox8.BackColor = Color.Pink; 418 + if("2回目".Equals(Global.times))
  419 + {
  420 + textBox8.BackColor = Color.Pink;
  421 + }
413 err = true; 422 err = true;
414 } 423 }
415 if (!sv.colorectalCancer.Equals(isDBNull(reader, "大腸がん"))) 424 if (!sv.colorectalCancer.Equals(isDBNull(reader, "大腸がん")))
416 { 425 {
417 - textBox9.BackColor = Color.Pink; 426 + if("2回目".Equals(Global.times))
  427 + {
  428 + textBox9.BackColor = Color.Pink;
  429 + }
418 err = true; 430 err = true;
419 } 431 }
420 if (!sv.prostateCancer.Equals(isDBNull(reader, "前立腺がん"))) 432 if (!sv.prostateCancer.Equals(isDBNull(reader, "前立腺がん")))
421 { 433 {
422 - textBox10.BackColor = Color.Pink; 434 + if("2回目".Equals(Global.times))
  435 + {
  436 + textBox10.BackColor = Color.Pink;
  437 + }
423 err = true; 438 err = true;
424 } 439 }
425 if (!sv.osteoporosis.Equals(isDBNull(reader, "骨粗鬆症"))) 440 if (!sv.osteoporosis.Equals(isDBNull(reader, "骨粗鬆症")))
426 { 441 {
427 - textBox11.BackColor = Color.Pink; 442 + if("2回目".Equals(Global.times))
  443 + {
  444 + textBox11.BackColor = Color.Pink;
  445 + }
428 err = true; 446 err = true;
429 } 447 }
430 if (!sv.dental.Equals(isDBNull(reader, "成人歯科"))) 448 if (!sv.dental.Equals(isDBNull(reader, "成人歯科")))
431 { 449 {
432 - textBox12.BackColor = Color.Pink; 450 + if("2回目".Equals(Global.times))
  451 + {
  452 + textBox12.BackColor = Color.Pink;
  453 + }
433 err = true; 454 err = true;
434 } 455 }
435 if (!sv.cervicalCancer.Equals(isDBNull(reader, "子宮頸がん"))) 456 if (!sv.cervicalCancer.Equals(isDBNull(reader, "子宮頸がん")))
436 { 457 {
437 - textBox13.BackColor = Color.Pink; 458 + if("2回目".Equals(Global.times))
  459 + {
  460 + textBox13.BackColor = Color.Pink;
  461 + }
438 err = true; 462 err = true;
439 } 463 }
440 if (!sv.breastCancer.Equals(isDBNull(reader, "乳がん"))) 464 if (!sv.breastCancer.Equals(isDBNull(reader, "乳がん")))
441 { 465 {
442 - textBox14.BackColor = Color.Pink; 466 + if("2回目".Equals(Global.times))
  467 + {
  468 + textBox14.BackColor = Color.Pink;
  469 + }
443 err = true; 470 err = true;
444 } 471 }
445 - if (sv.place.Equals(isDBNull(reader, "希望場所"))) 472 + if (!sv.place.Equals(isDBNull(reader, "希望場所")))
446 { 473 {
447 - textBox15.BackColor = Color.Pink; 474 + if("2回目".Equals(Global.times))
  475 + {
  476 + textBox15.BackColor = Color.Pink;
  477 + }
448 err = true; 478 err = true;
449 } 479 }
450 if (!sv.handicapped.Equals(isDBNull(reader, "身体不自由"))) 480 if (!sv.handicapped.Equals(isDBNull(reader, "身体不自由")))
451 { 481 {
452 - textBox16.BackColor = Color.Pink; 482 + if("2回目".Equals(Global.times))
  483 + {
  484 + textBox16.BackColor = Color.Pink;
  485 + }
453 err = true; 486 err = true;
454 } 487 }
455 } 488 }
@@ -867,12 +900,10 @@ namespace MedicalCheckInputTool @@ -867,12 +900,10 @@ namespace MedicalCheckInputTool
867 900
868 SaveData sv = makeSaveData(); //保存用データ作成(パディング済み) 901 SaveData sv = makeSaveData(); //保存用データ作成(パディング済み)
869 902
870 - //マッチングチェック  
871 - if ("2回目".Equals(Global.times)) 903 + bool matchErr = matchInput(sv);
  904 + if (matchErr)
872 { 905 {
873 - //1回目と比較  
874 - bool matchErr = matchInput(sv);  
875 - if (matchErr) 906 + if ("2回目".Equals(Global.times))
876 { 907 {
877 //一致しない場合、エラーダイアログ表示 908 //一致しない場合、エラーダイアログ表示
878 DialogResult result = MessageBox.Show("入力内容が1回目と異なりますが保存しますか?", 909 DialogResult result = MessageBox.Show("入力内容が1回目と異なりますが保存しますか?",
@@ -880,7 +911,6 @@ namespace MedicalCheckInputTool @@ -880,7 +911,6 @@ namespace MedicalCheckInputTool
880 MessageBoxButtons.OKCancel, 911 MessageBoxButtons.OKCancel,
881 MessageBoxIcon.Exclamation, 912 MessageBoxIcon.Exclamation,
882 MessageBoxDefaultButton.Button2); 913 MessageBoxDefaultButton.Button2);
883 -  
884 //何が選択されたか調べる 914 //何が選択されたか調べる
885 if (result == DialogResult.OK) 915 if (result == DialogResult.OK)
886 { 916 {
@@ -892,12 +922,11 @@ namespace MedicalCheckInputTool @@ -892,12 +922,11 @@ namespace MedicalCheckInputTool
892 return; 922 return;
893 } 923 }
894 } 924 }
895 - else  
896 - {  
897 - //エラーなしは完了フラグを立てる  
898 - match = true;  
899 - }  
900 - 925 + }
  926 + else
  927 + {
  928 + //エラーなしは完了フラグを立てる
  929 + match = true;
901 } 930 }
902 931
903 //保存処理 932 //保存処理
@@ -34,15 +34,6 @@ @@ -34,15 +34,6 @@
34 this.button2 = new System.Windows.Forms.Button(); 34 this.button2 = new System.Windows.Forms.Button();
35 this.checkBox1 = new System.Windows.Forms.CheckBox(); 35 this.checkBox1 = new System.Windows.Forms.CheckBox();
36 this.dataGridView1 = new System.Windows.Forms.DataGridView(); 36 this.dataGridView1 = new System.Windows.Forms.DataGridView();
37 - this.label2 = new System.Windows.Forms.Label();  
38 - this.label3 = new System.Windows.Forms.Label();  
39 - this.label4 = new System.Windows.Forms.Label();  
40 - this.checkBox2 = new System.Windows.Forms.CheckBox();  
41 - this.checkBox3 = new System.Windows.Forms.CheckBox();  
42 - this.comboBox1 = new System.Windows.Forms.ComboBox();  
43 - this.button3 = new System.Windows.Forms.Button();  
44 - this.label5 = new System.Windows.Forms.Label();  
45 - this.button4 = new System.Windows.Forms.Button();  
46 this.状況 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 37 this.状況 = new System.Windows.Forms.DataGridViewTextBoxColumn();
47 this.編集1 = new System.Windows.Forms.DataGridViewButtonColumn(); 38 this.編集1 = new System.Windows.Forms.DataGridViewButtonColumn();
48 this.f_行政区コード = new System.Windows.Forms.DataGridViewTextBoxColumn(); 39 this.f_行政区コード = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -78,6 +69,17 @@ @@ -78,6 +69,17 @@
78 this.s_乳がん = new System.Windows.Forms.DataGridViewTextBoxColumn(); 69 this.s_乳がん = new System.Windows.Forms.DataGridViewTextBoxColumn();
79 this.s_希望場所 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 70 this.s_希望場所 = new System.Windows.Forms.DataGridViewTextBoxColumn();
80 this.s_身体不自由 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 71 this.s_身体不自由 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  72 + this.label2 = new System.Windows.Forms.Label();
  73 + this.label3 = new System.Windows.Forms.Label();
  74 + this.label4 = new System.Windows.Forms.Label();
  75 + this.checkBox2 = new System.Windows.Forms.CheckBox();
  76 + this.checkBox3 = new System.Windows.Forms.CheckBox();
  77 + this.comboBox1 = new System.Windows.Forms.ComboBox();
  78 + this.button3 = new System.Windows.Forms.Button();
  79 + this.label5 = new System.Windows.Forms.Label();
  80 + this.button4 = new System.Windows.Forms.Button();
  81 + this.button5 = new System.Windows.Forms.Button();
  82 + this.button6 = new System.Windows.Forms.Button();
81 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); 83 ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
82 this.SuspendLayout(); 84 this.SuspendLayout();
83 // 85 //
@@ -181,97 +183,6 @@ @@ -181,97 +183,6 @@
181 this.dataGridView1.TabIndex = 5; 183 this.dataGridView1.TabIndex = 5;
182 this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); 184 this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
183 // 185 //
184 - // label2  
185 - //  
186 - this.label2.AutoSize = true;  
187 - this.label2.Location = new System.Drawing.Point(79, 14);  
188 - this.label2.Name = "label2";  
189 - this.label2.Size = new System.Drawing.Size(35, 12);  
190 - this.label2.TabIndex = 6;  
191 - this.label2.Text = "label2";  
192 - //  
193 - // label3  
194 - //  
195 - this.label3.AutoSize = true;  
196 - this.label3.Location = new System.Drawing.Point(313, 14);  
197 - this.label3.Name = "label3";  
198 - this.label3.Size = new System.Drawing.Size(59, 12);  
199 - this.label3.TabIndex = 7;  
200 - this.label3.Text = "整理番号:";  
201 - //  
202 - // label4  
203 - //  
204 - this.label4.AutoSize = true;  
205 - this.label4.Location = new System.Drawing.Point(26, 36);  
206 - this.label4.Name = "label4";  
207 - this.label4.Size = new System.Drawing.Size(47, 12);  
208 - this.label4.TabIndex = 8;  
209 - this.label4.Text = "表示軸:";  
210 - //  
211 - // checkBox2  
212 - //  
213 - this.checkBox2.AutoSize = true;  
214 - this.checkBox2.Checked = true;  
215 - this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;  
216 - this.checkBox2.Location = new System.Drawing.Point(81, 36);  
217 - this.checkBox2.Name = "checkBox2";  
218 - this.checkBox2.Size = new System.Drawing.Size(77, 16);  
219 - this.checkBox2.TabIndex = 9;  
220 - this.checkBox2.Text = "1回目を軸";  
221 - this.checkBox2.UseVisualStyleBackColor = true;  
222 - this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);  
223 - //  
224 - // checkBox3  
225 - //  
226 - this.checkBox3.AutoSize = true;  
227 - this.checkBox3.Checked = true;  
228 - this.checkBox3.CheckState = System.Windows.Forms.CheckState.Checked;  
229 - this.checkBox3.Location = new System.Drawing.Point(175, 36);  
230 - this.checkBox3.Name = "checkBox3";  
231 - this.checkBox3.Size = new System.Drawing.Size(77, 16);  
232 - this.checkBox3.TabIndex = 10;  
233 - this.checkBox3.Text = "2回目を軸";  
234 - this.checkBox3.UseVisualStyleBackColor = true;  
235 - this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);  
236 - //  
237 - // comboBox1  
238 - //  
239 - this.comboBox1.FormattingEnabled = true;  
240 - this.comboBox1.Location = new System.Drawing.Point(789, 69);  
241 - this.comboBox1.Name = "comboBox1";  
242 - this.comboBox1.Size = new System.Drawing.Size(68, 20);  
243 - this.comboBox1.TabIndex = 11;  
244 - this.comboBox1.SelectionChangeCommitted += new System.EventHandler(this.comboBox1_SelectionChangeCommitted);  
245 - //  
246 - // button3  
247 - //  
248 - this.button3.Location = new System.Drawing.Point(722, 67);  
249 - this.button3.Name = "button3";  
250 - this.button3.Size = new System.Drawing.Size(43, 23);  
251 - this.button3.TabIndex = 12;  
252 - this.button3.Text = "<";  
253 - this.button3.UseVisualStyleBackColor = true;  
254 - this.button3.Click += new System.EventHandler(this.button3_Click);  
255 - //  
256 - // label5  
257 - //  
258 - this.label5.AutoSize = true;  
259 - this.label5.Location = new System.Drawing.Point(863, 72);  
260 - this.label5.Name = "label5";  
261 - this.label5.Size = new System.Drawing.Size(35, 12);  
262 - this.label5.TabIndex = 13;  
263 - this.label5.Text = "ページ";  
264 - //  
265 - // button4  
266 - //  
267 - this.button4.Location = new System.Drawing.Point(904, 67);  
268 - this.button4.Name = "button4";  
269 - this.button4.Size = new System.Drawing.Size(43, 23);  
270 - this.button4.TabIndex = 14;  
271 - this.button4.Text = ">";  
272 - this.button4.UseVisualStyleBackColor = true;  
273 - this.button4.Click += new System.EventHandler(this.button4_Click);  
274 - //  
275 // 状況 186 // 状況
276 // 187 //
277 this.状況.HeaderText = "状況"; 188 this.状況.HeaderText = "状況";
@@ -547,11 +458,124 @@ @@ -547,11 +458,124 @@
547 this.s_身体不自由.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; 458 this.s_身体不自由.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
548 this.s_身体不自由.Width = 20; 459 this.s_身体不自由.Width = 20;
549 // 460 //
  461 + // label2
  462 + //
  463 + this.label2.AutoSize = true;
  464 + this.label2.Location = new System.Drawing.Point(79, 14);
  465 + this.label2.Name = "label2";
  466 + this.label2.Size = new System.Drawing.Size(35, 12);
  467 + this.label2.TabIndex = 6;
  468 + this.label2.Text = "label2";
  469 + //
  470 + // label3
  471 + //
  472 + this.label3.AutoSize = true;
  473 + this.label3.Location = new System.Drawing.Point(313, 14);
  474 + this.label3.Name = "label3";
  475 + this.label3.Size = new System.Drawing.Size(59, 12);
  476 + this.label3.TabIndex = 7;
  477 + this.label3.Text = "整理番号:";
  478 + //
  479 + // label4
  480 + //
  481 + this.label4.AutoSize = true;
  482 + this.label4.Location = new System.Drawing.Point(26, 36);
  483 + this.label4.Name = "label4";
  484 + this.label4.Size = new System.Drawing.Size(47, 12);
  485 + this.label4.TabIndex = 8;
  486 + this.label4.Text = "表示軸:";
  487 + //
  488 + // checkBox2
  489 + //
  490 + this.checkBox2.AutoSize = true;
  491 + this.checkBox2.Checked = true;
  492 + this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
  493 + this.checkBox2.Location = new System.Drawing.Point(81, 36);
  494 + this.checkBox2.Name = "checkBox2";
  495 + this.checkBox2.Size = new System.Drawing.Size(77, 16);
  496 + this.checkBox2.TabIndex = 9;
  497 + this.checkBox2.Text = "1回目を軸";
  498 + this.checkBox2.UseVisualStyleBackColor = true;
  499 + this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
  500 + //
  501 + // checkBox3
  502 + //
  503 + this.checkBox3.AutoSize = true;
  504 + this.checkBox3.Checked = true;
  505 + this.checkBox3.CheckState = System.Windows.Forms.CheckState.Checked;
  506 + this.checkBox3.Location = new System.Drawing.Point(175, 36);
  507 + this.checkBox3.Name = "checkBox3";
  508 + this.checkBox3.Size = new System.Drawing.Size(77, 16);
  509 + this.checkBox3.TabIndex = 10;
  510 + this.checkBox3.Text = "2回目を軸";
  511 + this.checkBox3.UseVisualStyleBackColor = true;
  512 + this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
  513 + //
  514 + // comboBox1
  515 + //
  516 + this.comboBox1.FormattingEnabled = true;
  517 + this.comboBox1.Location = new System.Drawing.Point(789, 69);
  518 + this.comboBox1.Name = "comboBox1";
  519 + this.comboBox1.Size = new System.Drawing.Size(68, 20);
  520 + this.comboBox1.TabIndex = 11;
  521 + this.comboBox1.SelectionChangeCommitted += new System.EventHandler(this.comboBox1_SelectionChangeCommitted);
  522 + //
  523 + // button3
  524 + //
  525 + this.button3.Location = new System.Drawing.Point(722, 67);
  526 + this.button3.Name = "button3";
  527 + this.button3.Size = new System.Drawing.Size(43, 23);
  528 + this.button3.TabIndex = 12;
  529 + this.button3.Text = "<";
  530 + this.button3.UseVisualStyleBackColor = true;
  531 + this.button3.Click += new System.EventHandler(this.button3_Click);
  532 + //
  533 + // label5
  534 + //
  535 + this.label5.AutoSize = true;
  536 + this.label5.Location = new System.Drawing.Point(863, 72);
  537 + this.label5.Name = "label5";
  538 + this.label5.Size = new System.Drawing.Size(35, 12);
  539 + this.label5.TabIndex = 13;
  540 + this.label5.Text = "ページ";
  541 + //
  542 + // button4
  543 + //
  544 + this.button4.Location = new System.Drawing.Point(904, 67);
  545 + this.button4.Name = "button4";
  546 + this.button4.Size = new System.Drawing.Size(43, 23);
  547 + this.button4.TabIndex = 14;
  548 + this.button4.Text = ">";
  549 + this.button4.UseVisualStyleBackColor = true;
  550 + this.button4.Click += new System.EventHandler(this.button4_Click);
  551 + //
  552 + // button5
  553 + //
  554 + this.button5.Location = new System.Drawing.Point(977, 67);
  555 + this.button5.Name = "button5";
  556 + this.button5.Size = new System.Drawing.Size(75, 23);
  557 + this.button5.TabIndex = 15;
  558 + this.button5.Text = "出力";
  559 + this.button5.UseVisualStyleBackColor = true;
  560 + this.button5.Click += new System.EventHandler(this.button5_Click);
  561 + //
  562 + // button6
  563 + //
  564 + this.button6.Location = new System.Drawing.Point(977, 8);
  565 + this.button6.Name = "button6";
  566 + this.button6.Size = new System.Drawing.Size(75, 23);
  567 + this.button6.TabIndex = 16;
  568 + this.button6.Text = "集計";
  569 + this.button6.UseVisualStyleBackColor = true;
  570 + this.button6.Click += new System.EventHandler(this.button6_Click);
  571 + //
550 // Form3 572 // Form3
551 // 573 //
552 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 574 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
553 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 575 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
554 this.ClientSize = new System.Drawing.Size(1064, 493); 576 this.ClientSize = new System.Drawing.Size(1064, 493);
  577 + this.Controls.Add(this.button6);
  578 + this.Controls.Add(this.button5);
555 this.Controls.Add(this.button4); 579 this.Controls.Add(this.button4);
556 this.Controls.Add(this.label5); 580 this.Controls.Add(this.label5);
557 this.Controls.Add(this.button3); 581 this.Controls.Add(this.button3);
@@ -627,5 +651,7 @@ @@ -627,5 +651,7 @@
627 private System.Windows.Forms.DataGridViewTextBoxColumn s_乳がん; 651 private System.Windows.Forms.DataGridViewTextBoxColumn s_乳がん;
628 private System.Windows.Forms.DataGridViewTextBoxColumn s_希望場所; 652 private System.Windows.Forms.DataGridViewTextBoxColumn s_希望場所;
629 private System.Windows.Forms.DataGridViewTextBoxColumn s_身体不自由; 653 private System.Windows.Forms.DataGridViewTextBoxColumn s_身体不自由;
  654 + private System.Windows.Forms.Button button5;
  655 + private System.Windows.Forms.Button button6;
630 } 656 }
631 } 657 }
@@ -9,6 +9,7 @@ using System.Threading.Tasks; @@ -9,6 +9,7 @@ using System.Threading.Tasks;
9 using System.Windows.Forms; 9 using System.Windows.Forms;
10 using MySql.Data.MySqlClient; 10 using MySql.Data.MySqlClient;
11 using System.Data.SqlClient; 11 using System.Data.SqlClient;
  12 +using System.IO;
12 13
13 namespace MedicalCheckInputTool 14 namespace MedicalCheckInputTool
14 { 15 {
@@ -113,8 +114,7 @@ namespace MedicalCheckInputTool @@ -113,8 +114,7 @@ namespace MedicalCheckInputTool
113 114
114 if (this.checkBox1.Checked) 115 if (this.checkBox1.Checked)
115 { 116 {
116 -// readQuery += " and (`f_完了` <> 1 or `s_完了` <> 1)";  
117 - readQuery += " and (`f_完了` is null or `s_完了` is null)"; 117 + readQuery += " and (`f_完了` <> 1 or `s_完了` <> 1)";
118 } 118 }
119 119
120 if (this.checkBox2.Checked && this.checkBox3.Checked) 120 if (this.checkBox2.Checked && this.checkBox3.Checked)
@@ -271,174 +271,16 @@ namespace MedicalCheckInputTool @@ -271,174 +271,16 @@ namespace MedicalCheckInputTool
271 } 271 }
272 } 272 }
273 273
274 - // 行マッチ判定  
275 - private void check()  
276 - {  
277 - // 行マッチングデータを取得  
278 - string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"];  
279 -  
280 - // 更新用Connection  
281 - MySqlConnection updateCon = new MySqlConnection(connstr);  
282 - updateCon.Open();  
283 -  
284 - /*  
285 - // 一度フラグを落とす  
286 - string resetFsql = "update `1回目` set `完了` = 0 where `ロット番号` = @lot";  
287 - if (!"".Equals(textBox1.Text))  
288 - {  
289 - resetFsql += " and `整理番号` like '%" + textBox1.Text + "%'";  
290 - }  
291 - MySqlCommand resetFirst = new MySqlCommand(resetFsql, updateCon);  
292 - resetFirst.Parameters.AddWithValue("lot", EditParam.lotNo);  
293 - resetFirst.ExecuteNonQuery();  
294 -  
295 - string resetSsql = "update `2回目` set `完了` = 0 where `ロット番号` = @lot";  
296 - if (!"".Equals(textBox1.Text))  
297 - {  
298 - resetSsql += " and `整理番号` like '%" + textBox1.Text + "%'";  
299 - }  
300 - MySqlCommand resetSecond = new MySqlCommand(resetSsql, updateCon);  
301 - resetSecond.Parameters.AddWithValue("lot", EditParam.lotNo);  
302 - resetSecond.ExecuteNonQuery();  
303 - */  
304 -  
305 - // フラグ更新用コマンド  
306 - MySqlCommand updateFirst = new MySqlCommand("update `1回目` set `完了` = 1 where " +  
307 - "`ロット番号` = @lot and " +  
308 - "`整理番号` = @serialCode", updateCon);  
309 - // フラグ更新用コマンド  
310 - MySqlCommand updateSecond = new MySqlCommand("update `2回目` set `完了` = 1 where " +  
311 - "`ロット番号` = @lot and " +  
312 - "`整理番号` = @serialCode", updateCon);  
313 -  
314 - // 行突合データを取得する  
315 - // 参照用Connection  
316 - MySqlConnection readerCon = new MySqlConnection(connstr);  
317 - readerCon.Open();  
318 - string readQuery = "select * from page_compare where (`f_ロット番号` = @f_lot or `s_ロット番号` = @s_lot) and (`f_完了` <> 1 or `s_完了` <> 1)";  
319 - string orderby = " order by `f_行政区コード`, `f_整理番号`, `s_行政区コード`, `s_整理番号`";  
320 - if (!"".Equals(textBox1.Text))  
321 - {  
322 - readQuery += " and (`f_整理番号` like '%" + textBox1.Text + "%' or `s_整理番号` like '%" + textBox1.Text + "%')";  
323 - }  
324 - readQuery += orderby;  
325 - MySqlCommand readCmd = new MySqlCommand(readQuery, readerCon);  
326 - readCmd.Parameters.AddWithValue("f_lot", EditParam.lotNo);  
327 - readCmd.Parameters.AddWithValue("s_lot", EditParam.lotNo);  
328 - MySqlDataReader reader = readCmd.ExecuteReader();  
329 -  
330 - while (reader.Read())  
331 - {  
332 - // 各種値のチェック  
333 - bool IsMatch = true;  
334 - // 各項目の一致をチェックする  
335 - // 整理番号  
336 - if (!this.isDBNull(reader, "f_整理番号").Equals(this.isDBNull(reader, "s_整理番号")))  
337 - {  
338 - IsMatch = false;  
339 - }  
340 - // 世帯番号  
341 - if (!this.isDBNull(reader, "f_世帯番号").Equals(this.isDBNull(reader, "s_世帯番号")))  
342 - {  
343 - IsMatch = false;  
344 - }  
345 - // 健康診査  
346 - if (!this.isDBNull(reader, "f_健康診査").Equals(this.isDBNull(reader, "s_健康診査")))  
347 - {  
348 - IsMatch = false;  
349 - }  
350 - // 結核肺がん  
351 - if (!this.isDBNull(reader, "f_結核肺がん").Equals(this.isDBNull(reader, "s_結核肺がん")))  
352 - {  
353 - IsMatch = false;  
354 - }  
355 - // 胃がん  
356 - if (!this.isDBNull(reader, "f_胃がん").Equals(this.isDBNull(reader, "s_胃がん")))  
357 - {  
358 - IsMatch = false;  
359 - }  
360 - // 大腸がん  
361 - if (!this.isDBNull(reader, "f_大腸がん").Equals(this.isDBNull(reader, "s_大腸がん")))  
362 - {  
363 - IsMatch = false;  
364 - }  
365 - // 前立腺がん  
366 - if (!this.isDBNull(reader, "f_前立腺がん").Equals(this.isDBNull(reader, "s_前立腺がん")))  
367 - {  
368 - IsMatch = false;  
369 - }  
370 - // 骨粗鬆症  
371 - if (!this.isDBNull(reader, "f_骨粗鬆症").Equals(this.isDBNull(reader, "s_骨粗鬆症")))  
372 - {  
373 - IsMatch = false;  
374 - }  
375 - // 成人歯科  
376 - if (!this.isDBNull(reader, "f_成人歯科").Equals(this.isDBNull(reader, "s_成人歯科")))  
377 - {  
378 - IsMatch = false;  
379 - }  
380 - // 子宮頸がん  
381 - if (!this.isDBNull(reader, "f_子宮頸がん").Equals(this.isDBNull(reader, "s_子宮頸がん")))  
382 - {  
383 - IsMatch = false;  
384 - }  
385 - // 乳がん  
386 - if (!this.isDBNull(reader, "f_乳がん").Equals(this.isDBNull(reader, "s_乳がん")))  
387 - {  
388 - IsMatch = false;  
389 - }  
390 - // 希望場所  
391 - if (!this.isDBNull(reader, "f_希望場所").Equals(this.isDBNull(reader, "s_希望場所")))  
392 - {  
393 - IsMatch = false;  
394 - }  
395 - // 身体不自由  
396 - if (!this.isDBNull(reader, "f_身体不自由").Equals(this.isDBNull(reader, "s_身体不自由")))  
397 - {  
398 - IsMatch = false;  
399 - }  
400 - // 電話番号  
401 - if (!this.isDBNull(reader, "f_電話番号").Equals(this.isDBNull(reader, "s_電話番号")))  
402 - {  
403 - IsMatch = false;  
404 - }  
405 - // 携帯番号  
406 - if (!this.isDBNull(reader, "f_携帯番号").Equals(this.isDBNull(reader, "s_携帯番号")))  
407 - {  
408 - IsMatch = false;  
409 - }  
410 -  
411 - // マッチはフラグを更新する  
412 - if (IsMatch)  
413 - {  
414 - updateFirst.Parameters.Clear();  
415 - updateFirst.Parameters.AddWithValue("lot", EditParam.lotNo);  
416 - updateFirst.Parameters.AddWithValue("serialCode", this.isDBNull(reader, "f_整理番号"));  
417 - updateFirst.ExecuteNonQuery();  
418 -  
419 - updateSecond.Parameters.Clear();  
420 - updateSecond.Parameters.AddWithValue("lot", EditParam.lotNo);  
421 - updateSecond.Parameters.AddWithValue("serialCode", this.isDBNull(reader, "f_整理番号"));  
422 - updateSecond.ExecuteNonQuery();  
423 - }  
424 - }  
425 -  
426 - updateCon.Close();  
427 - readerCon.Close();  
428 - }  
429 -  
430 //検索 274 //検索
431 private void button1_Click(object sender, EventArgs e) 275 private void button1_Click(object sender, EventArgs e)
432 { 276 {
433 this.setPage(); 277 this.setPage();
434 - this.check();  
435 this.search(); 278 this.search();
436 } 279 }
437 280
438 //チェック 281 //チェック
439 private void button2_Click(object sender, EventArgs e) 282 private void button2_Click(object sender, EventArgs e)
440 { 283 {
441 - this.check();  
442 this.search(); 284 this.search();
443 } 285 }
444 286
@@ -527,5 +369,128 @@ namespace MedicalCheckInputTool @@ -527,5 +369,128 @@ namespace MedicalCheckInputTool
527 369
528 } 370 }
529 371
  372 + //出力
  373 + private void button5_Click(object sender, EventArgs e)
  374 + {
  375 + //最初の画面で選択したロット番号と明細種別のデータをファイル出力する
  376 + string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"];
  377 + MySqlConnection readerCon = new MySqlConnection(connstr);
  378 + readerCon.Open();
  379 +
  380 + string readQuery = "select * from `1回目` where (`ロット番号` = @lotNo) order by `保健区`";
  381 + MySqlCommand readCmd = new MySqlCommand(readQuery, readerCon);
  382 + readCmd.Parameters.AddWithValue("lotNo", EditParam.lotNo);
  383 +
  384 + try
  385 + {
  386 + // 実行
  387 + MySqlDataReader reader = readCmd.ExecuteReader();
  388 + if (!reader.HasRows)
  389 + { //無かった
  390 + reader.Close();
  391 + }
  392 + else
  393 + {
  394 + StreamWriter writer = new StreamWriter(Define.OUTFILE, false, System.Text.Encoding.GetEncoding("shift_jis")); //ファイルストリーム
  395 + while (reader.Read())
  396 + {
  397 + string line = makeRecord(reader);
  398 + writer.WriteLine(line);
  399 + }
  400 +
  401 + writer.Close();
  402 + reader.Close();
  403 +
  404 + }
  405 + }
  406 + catch (SqlException ex)
  407 + {
  408 + // 例外処理
  409 + MessageBox.Show("例外発生:" + ex.Message);
  410 + }
  411 +
  412 + }
  413 +
  414 + private string makeRecord(MySqlDataReader reader)
  415 + {
  416 + string line = "";
  417 +
  418 + line += this.isDBNull(reader, "整理番号").PadLeft(10,'0'); //整理番号
  419 + line += this.isDBNull(reader, "世帯番号").PadLeft(10,'0'); //世帯番号
  420 + line += this.isDBNull(reader, "健康診査").PadRight(1); //健康診査
  421 + line += this.isDBNull(reader, "結核肺がん").PadRight(1); //結核肺がん
  422 + line += this.isDBNull(reader, "胃がん").PadRight(1); //胃がん
  423 + line += this.isDBNull(reader, "大腸がん").PadRight(1); //大腸がん
  424 + line += this.isDBNull(reader, "前立腺がん").PadRight(1); //前立腺がん
  425 + line += this.isDBNull(reader, "骨粗鬆症").PadRight(1); //骨粗鬆症
  426 + line += this.isDBNull(reader, "成人歯科").PadRight(1); //成人歯科
  427 + line += this.isDBNull(reader, "子宮頸がん").PadRight(1); //子宮頸がん
  428 + line += this.isDBNull(reader, "乳がん").PadRight(1); //乳がん
  429 + line += this.isDBNull(reader, "希望場所").PadRight(1); //希望場所
  430 + line += this.isDBNull(reader, "身体不自由").PadRight(1); //身体不自由
  431 + line += this.isDBNull(reader, "電話番号").PadRight(15); //電話番号
  432 + line += this.isDBNull(reader, "携帯番号").PadRight(15); //携帯番号
  433 +
  434 + return line;
  435 + }
  436 +
  437 + //集計
  438 + private void makeSummary()
  439 + {
  440 + //最初の画面で選択したロット番号と明細種別のデータをファイル出力する
  441 + string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"];
  442 + MySqlConnection readerCon = new MySqlConnection(connstr);
  443 + readerCon.Open();
  444 +
  445 + string readQuery = "select `行政区コード`,`行政区名称`,count(行政区コード) from `1回目` group by `行政区コード` order by `行政区コード`";
  446 + MySqlCommand readCmd = new MySqlCommand(readQuery, readerCon);
  447 +
  448 + string countQuery = "select count(`世帯番号`) from `1回目` where `行政区コード`= @adminCode group by `行政区コード`";
  449 + MySqlCommand countCmd = new MySqlCommand(countQuery, readerCon);
  450 +
  451 + try
  452 + {
  453 + // 実行
  454 + MySqlDataReader reader = readCmd.ExecuteReader();
  455 + if (!reader.HasRows)
  456 + { //無かった
  457 + reader.Close();
  458 + }
  459 + else
  460 + {
  461 + StreamWriter writer = new StreamWriter("Summary.csv", false, System.Text.Encoding.GetEncoding("shift_jis")); //ファイルストリーム
  462 + while (reader.Read())
  463 + {
  464 + string adminCode = this.isDBNull(reader, "行政区コード");
  465 + string adminName = this.isDBNull(reader, "行政区名称");
  466 + int count = reader.GetInt16(2);
  467 + countCmd.Parameters.Clear();
  468 + countCmd.Parameters.Add(new MySqlParameter("adminCode", adminCode));
  469 + MySqlDataReader reader2 = countCmd.ExecuteReader();
  470 + int count2 = reader2.GetInt16(0);
  471 +
  472 + string line = adminCode+","+adminName+","+count+","+count2;
  473 + writer.WriteLine(line);
  474 + reader2.Close();
  475 + }
  476 +
  477 + writer.Close();
  478 + reader.Close();
  479 +
  480 + }
  481 + }
  482 + catch (SqlException ex)
  483 + {
  484 + // 例外処理
  485 + MessageBox.Show("例外発生:" + ex.Message);
  486 + }
  487 +
  488 + }
  489 +
  490 + private void button6_Click(object sender, EventArgs e)
  491 + {
  492 + makeSummary();
  493 + }
  494 +
530 } 495 }
531 } 496 }
@@ -21,4 +21,9 @@ namespace MedicalCheckInputTool @@ -21,4 +21,9 @@ namespace MedicalCheckInputTool
21 public static string inputUser; 21 public static string inputUser;
22 public static string lotNo; 22 public static string lotNo;
23 } 23 }
  24 +
  25 + class Define
  26 + {
  27 + public const string OUTFILE = "MOSIKOM.TXT";
  28 + }
24 } 29 }
Please register or login to post a comment