Commit 9b7ed142b3732ac7a20f40ebf530e4934cc6cc3e

Authored by r-ujihara
1 parent 2935c554

製造中登録

... ... @@ -36,6 +36,8 @@
36 36 this.label3 = new System.Windows.Forms.Label();
37 37 this.button1 = new System.Windows.Forms.Button();
38 38 this.button2 = new System.Windows.Forms.Button();
  39 + this.label4 = new System.Windows.Forms.Label();
  40 + this.comboBox4 = new System.Windows.Forms.ComboBox();
39 41 this.SuspendLayout();
40 42 //
41 43 // comboBox1
... ... @@ -49,7 +51,7 @@
49 51 // comboBox2
50 52 //
51 53 this.comboBox2.FormattingEnabled = true;
52   - this.comboBox2.Location = new System.Drawing.Point(96, 77);
  54 + this.comboBox2.Location = new System.Drawing.Point(96, 62);
53 55 this.comboBox2.Name = "comboBox2";
54 56 this.comboBox2.Size = new System.Drawing.Size(121, 20);
55 57 this.comboBox2.TabIndex = 1;
... ... @@ -57,7 +59,7 @@
57 59 // comboBox3
58 60 //
59 61 this.comboBox3.FormattingEnabled = true;
60   - this.comboBox3.Location = new System.Drawing.Point(96, 128);
  62 + this.comboBox3.Location = new System.Drawing.Point(96, 97);
61 63 this.comboBox3.Name = "comboBox3";
62 64 this.comboBox3.Size = new System.Drawing.Size(121, 20);
63 65 this.comboBox3.TabIndex = 2;
... ... @@ -65,7 +67,7 @@
65 67 // label1
66 68 //
67 69 this.label1.AutoSize = true;
68   - this.label1.Location = new System.Drawing.Point(13, 30);
  70 + this.label1.Location = new System.Drawing.Point(49, 30);
69 71 this.label1.Name = "label1";
70 72 this.label1.Size = new System.Drawing.Size(41, 12);
71 73 this.label1.TabIndex = 3;
... ... @@ -74,7 +76,7 @@
74 76 // label2
75 77 //
76 78 this.label2.AutoSize = true;
77   - this.label2.Location = new System.Drawing.Point(12, 80);
  79 + this.label2.Location = new System.Drawing.Point(37, 65);
78 80 this.label2.Name = "label2";
79 81 this.label2.Size = new System.Drawing.Size(53, 12);
80 82 this.label2.TabIndex = 4;
... ... @@ -83,7 +85,7 @@
83 85 // label3
84 86 //
85 87 this.label3.AutoSize = true;
86   - this.label3.Location = new System.Drawing.Point(9, 131);
  88 + this.label3.Location = new System.Drawing.Point(9, 100);
87 89 this.label3.Name = "label3";
88 90 this.label3.Size = new System.Drawing.Size(81, 12);
89 91 this.label3.TabIndex = 5;
... ... @@ -108,11 +110,30 @@
108 110 this.button2.Text = "修正";
109 111 this.button2.UseVisualStyleBackColor = true;
110 112 //
  113 + // label4
  114 + //
  115 + this.label4.AutoSize = true;
  116 + this.label4.Location = new System.Drawing.Point(25, 135);
  117 + this.label4.Name = "label4";
  118 + this.label4.Size = new System.Drawing.Size(65, 12);
  119 + this.label4.TabIndex = 8;
  120 + this.label4.Text = "行政区番号";
  121 + //
  122 + // comboBox4
  123 + //
  124 + this.comboBox4.FormattingEnabled = true;
  125 + this.comboBox4.Location = new System.Drawing.Point(96, 132);
  126 + this.comboBox4.Name = "comboBox4";
  127 + this.comboBox4.Size = new System.Drawing.Size(176, 20);
  128 + this.comboBox4.TabIndex = 9;
  129 + //
111 130 // Form1
112 131 //
113 132 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
114 133 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
115 134 this.ClientSize = new System.Drawing.Size(284, 261);
  135 + this.Controls.Add(this.comboBox4);
  136 + this.Controls.Add(this.label4);
116 137 this.Controls.Add(this.button2);
117 138 this.Controls.Add(this.button1);
118 139 this.Controls.Add(this.label3);
... ... @@ -138,6 +159,8 @@
138 159 private System.Windows.Forms.Label label3;
139 160 private System.Windows.Forms.Button button1;
140 161 private System.Windows.Forms.Button button2;
  162 + private System.Windows.Forms.Label label4;
  163 + private System.Windows.Forms.ComboBox comboBox4;
141 164 }
142 165 }
143 166
... ...
... ... @@ -7,11 +7,16 @@ using System.Linq;
7 7 using System.Text;
8 8 using System.Threading.Tasks;
9 9 using System.Windows.Forms;
  10 +using System.IO;
  11 +using System.Runtime.Serialization;
  12 +using System.Runtime.Serialization.Json;
10 13
11 14 namespace MedicalCheckInputTool
12 15 {
13 16 public partial class Form1 : Form
14 17 {
  18 + private healthAreaSet haSet = null;
  19 +
15 20 public Form1()
16 21 {
17 22 InitializeComponent();
... ... @@ -60,6 +65,8 @@ namespace MedicalCheckInputTool
60 65 comboBox3.DropDownStyle = ComboBoxStyle.DropDownList;
61 66 comboBox3.SelectedIndex = 0; // 先頭の項目を選択
62 67
  68 + readFile();
  69 +
63 70 }
64 71
65 72 private void button1_Click(object sender, EventArgs e)
... ... @@ -79,14 +86,72 @@ namespace MedicalCheckInputTool
79 86 MessageBox.Show("回数を選択してください");
80 87 return;
81 88 }
  89 + if ("".Equals(comboBox4.SelectedItem.ToString()))
  90 + {
  91 + MessageBox.Show("行政区番号を選択してください");
  92 + return;
  93 + }
82 94 Global.inputUser = comboBox1.SelectedItem.ToString();
83 95 Global.lotNo = comboBox2.SelectedItem.ToString();
84 96 Global.times = comboBox3.SelectedItem.ToString();
  97 +
  98 + string [] tmp = comboBox4.SelectedItem.ToString().Split(':');
  99 + Global.adminCode = tmp[0];
  100 + Global.adminName = tmp[1];
  101 + Global.healthArea = haSet.healthArea[tmp[0]];
85 102
86 103 Form2 frm = new Form2();
87 104 frm.ShowDialog();
88 105 frm.Dispose();
89 106
90 107 }
  108 +
  109 + [DataContract]
  110 + public class adminNameSet
  111 + {
  112 + [DataMember]
  113 + public Dictionary<string, string> adminName;
  114 +
  115 + }
  116 +
  117 + [DataContract]
  118 + public class healthAreaSet
  119 + {
  120 + [DataMember]
  121 + public Dictionary<string, string> healthArea;
  122 +
  123 + }
  124 +
  125 + private void readFile()
  126 + {
  127 + string text = File.ReadAllText(@"adminName.json", Encoding.GetEncoding("shift_jis"));
  128 +
  129 + var settings = new DataContractJsonSerializerSettings();
  130 + settings.UseSimpleDictionaryFormat = true;
  131 + var serializer = new DataContractJsonSerializer(typeof(adminNameSet), settings);
  132 + adminNameSet data = null;
  133 + using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(text)))
  134 + {
  135 + data = (adminNameSet)serializer.ReadObject(ms);
  136 + }
  137 +
  138 + comboBox4.Items.Add("");
  139 + foreach (var p in data.adminName)
  140 + {
  141 + comboBox4.Items.Add(p.Key + ":" + p.Value);
  142 + }
  143 +
  144 + comboBox4.DropDownStyle = ComboBoxStyle.DropDownList;
  145 +
  146 + //保健区読み込み
  147 + string text2 = File.ReadAllText(@"healthArea.json", Encoding.GetEncoding("shift_jis"));
  148 + var serializer2 = new DataContractJsonSerializer(typeof(healthAreaSet), settings);
  149 + using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(text2)))
  150 + {
  151 + haSet = (healthAreaSet)serializer2.ReadObject(ms);
  152 + }
  153 +
  154 +
  155 + }
91 156 }
92 157 }
... ...
... ... @@ -32,8 +32,6 @@
32 32 this.label1 = new System.Windows.Forms.Label();
33 33 this.label2 = new System.Windows.Forms.Label();
34 34 this.textBox2 = new System.Windows.Forms.TextBox();
35   - this.label3 = new System.Windows.Forms.Label();
36   - this.textBox3 = new System.Windows.Forms.TextBox();
37 35 this.label4 = new System.Windows.Forms.Label();
38 36 this.label5 = new System.Windows.Forms.Label();
39 37 this.textBox4 = new System.Windows.Forms.TextBox();
... ... @@ -66,21 +64,25 @@
66 64 this.button2 = new System.Windows.Forms.Button();
67 65 this.button3 = new System.Windows.Forms.Button();
68 66 this.button4 = new System.Windows.Forms.Button();
  67 + this.label3 = new System.Windows.Forms.Label();
  68 + this.label19 = new System.Windows.Forms.Label();
69 69 this.SuspendLayout();
70 70 //
71 71 // textBox1
72 72 //
73 73 this.textBox1.ImeMode = System.Windows.Forms.ImeMode.Off;
74   - this.textBox1.Location = new System.Drawing.Point(105, 12);
  74 + this.textBox1.Location = new System.Drawing.Point(105, 65);
75 75 this.textBox1.MaxLength = 10;
76 76 this.textBox1.Name = "textBox1";
77 77 this.textBox1.Size = new System.Drawing.Size(100, 19);
78 78 this.textBox1.TabIndex = 0;
  79 + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
  80 + this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
79 81 //
80 82 // label1
81 83 //
82 84 this.label1.AutoSize = true;
83   - this.label1.Location = new System.Drawing.Point(32, 15);
  85 + this.label1.Location = new System.Drawing.Point(32, 68);
84 86 this.label1.Name = "label1";
85 87 this.label1.Size = new System.Drawing.Size(53, 12);
86 88 this.label1.TabIndex = 1;
... ... @@ -89,7 +91,7 @@
89 91 // label2
90 92 //
91 93 this.label2.AutoSize = true;
92   - this.label2.Location = new System.Drawing.Point(32, 40);
  94 + this.label2.Location = new System.Drawing.Point(32, 93);
93 95 this.label2.Name = "label2";
94 96 this.label2.Size = new System.Drawing.Size(53, 12);
95 97 this.label2.TabIndex = 2;
... ... @@ -98,34 +100,17 @@
98 100 // textBox2
99 101 //
100 102 this.textBox2.ImeMode = System.Windows.Forms.ImeMode.Off;
101   - this.textBox2.Location = new System.Drawing.Point(105, 37);
  103 + this.textBox2.Location = new System.Drawing.Point(105, 90);
102 104 this.textBox2.MaxLength = 10;
103 105 this.textBox2.Name = "textBox2";
104 106 this.textBox2.Size = new System.Drawing.Size(100, 19);
105 107 this.textBox2.TabIndex = 3;
106   - //
107   - // label3
108   - //
109   - this.label3.AutoSize = true;
110   - this.label3.Location = new System.Drawing.Point(20, 65);
111   - this.label3.Name = "label3";
112   - this.label3.Size = new System.Drawing.Size(65, 12);
113   - this.label3.TabIndex = 4;
114   - this.label3.Text = "行政区番号";
115   - //
116   - // textBox3
117   - //
118   - this.textBox3.ImeMode = System.Windows.Forms.ImeMode.Off;
119   - this.textBox3.Location = new System.Drawing.Point(105, 62);
120   - this.textBox3.MaxLength = 6;
121   - this.textBox3.Name = "textBox3";
122   - this.textBox3.Size = new System.Drawing.Size(100, 19);
123   - this.textBox3.TabIndex = 5;
  108 + this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
124 109 //
125 110 // label4
126 111 //
127 112 this.label4.AutoSize = true;
128   - this.label4.Location = new System.Drawing.Point(56, 90);
  113 + this.label4.Location = new System.Drawing.Point(56, 118);
129 114 this.label4.Name = "label4";
130 115 this.label4.Size = new System.Drawing.Size(29, 12);
131 116 this.label4.TabIndex = 6;
... ... @@ -134,7 +119,7 @@
134 119 // label5
135 120 //
136 121 this.label5.AutoSize = true;
137   - this.label5.Location = new System.Drawing.Point(56, 115);
  122 + this.label5.Location = new System.Drawing.Point(56, 143);
138 123 this.label5.Name = "label5";
139 124 this.label5.Size = new System.Drawing.Size(29, 12);
140 125 this.label5.TabIndex = 7;
... ... @@ -143,26 +128,28 @@
143 128 // textBox4
144 129 //
145 130 this.textBox4.ImeMode = System.Windows.Forms.ImeMode.Off;
146   - this.textBox4.Location = new System.Drawing.Point(105, 87);
  131 + this.textBox4.Location = new System.Drawing.Point(105, 115);
147 132 this.textBox4.MaxLength = 15;
148 133 this.textBox4.Name = "textBox4";
149 134 this.textBox4.Size = new System.Drawing.Size(100, 19);
150 135 this.textBox4.TabIndex = 8;
  136 + this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged);
151 137 //
152 138 // textBox5
153 139 //
154 140 this.textBox5.ImeMode = System.Windows.Forms.ImeMode.Off;
155   - this.textBox5.Location = new System.Drawing.Point(105, 112);
  141 + this.textBox5.Location = new System.Drawing.Point(105, 140);
156 142 this.textBox5.MaxLength = 15;
157 143 this.textBox5.Name = "textBox5";
158 144 this.textBox5.Size = new System.Drawing.Size(100, 19);
159 145 this.textBox5.TabIndex = 9;
  146 + this.textBox5.TextChanged += new System.EventHandler(this.textBox5_TextChanged);
160 147 //
161 148 // label6
162 149 //
163 150 this.label6.AutoSize = true;
164 151 this.label6.ForeColor = System.Drawing.SystemColors.ActiveBorder;
165   - this.label6.Location = new System.Drawing.Point(12, 134);
  152 + this.label6.Location = new System.Drawing.Point(12, 162);
166 153 this.label6.Name = "label6";
167 154 this.label6.Size = new System.Drawing.Size(269, 12);
168 155 this.label6.TabIndex = 10;
... ... @@ -171,7 +158,7 @@
171 158 // label7
172 159 //
173 160 this.label7.AutoSize = true;
174   - this.label7.Location = new System.Drawing.Point(32, 152);
  161 + this.label7.Location = new System.Drawing.Point(32, 180);
175 162 this.label7.Name = "label7";
176 163 this.label7.Size = new System.Drawing.Size(53, 12);
177 164 this.label7.TabIndex = 11;
... ... @@ -180,16 +167,17 @@
180 167 // textBox6
181 168 //
182 169 this.textBox6.ImeMode = System.Windows.Forms.ImeMode.Off;
183   - this.textBox6.Location = new System.Drawing.Point(105, 149);
  170 + this.textBox6.Location = new System.Drawing.Point(105, 177);
184 171 this.textBox6.MaxLength = 1;
185 172 this.textBox6.Name = "textBox6";
186 173 this.textBox6.Size = new System.Drawing.Size(31, 19);
187 174 this.textBox6.TabIndex = 12;
  175 + this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged);
188 176 //
189 177 // label8
190 178 //
191 179 this.label8.AutoSize = true;
192   - this.label8.Location = new System.Drawing.Point(18, 177);
  180 + this.label8.Location = new System.Drawing.Point(18, 205);
193 181 this.label8.Name = "label8";
194 182 this.label8.Size = new System.Drawing.Size(67, 12);
195 183 this.label8.TabIndex = 13;
... ... @@ -198,16 +186,17 @@
198 186 // textBox7
199 187 //
200 188 this.textBox7.ImeMode = System.Windows.Forms.ImeMode.Off;
201   - this.textBox7.Location = new System.Drawing.Point(105, 174);
  189 + this.textBox7.Location = new System.Drawing.Point(105, 202);
202 190 this.textBox7.MaxLength = 1;
203 191 this.textBox7.Name = "textBox7";
204 192 this.textBox7.Size = new System.Drawing.Size(31, 19);
205 193 this.textBox7.TabIndex = 14;
  194 + this.textBox7.TextChanged += new System.EventHandler(this.textBox7_TextChanged);
206 195 //
207 196 // label9
208 197 //
209 198 this.label9.AutoSize = true;
210   - this.label9.Location = new System.Drawing.Point(44, 202);
  199 + this.label9.Location = new System.Drawing.Point(48, 230);
211 200 this.label9.Name = "label9";
212 201 this.label9.Size = new System.Drawing.Size(37, 12);
213 202 this.label9.TabIndex = 15;
... ... @@ -216,7 +205,7 @@
216 205 // label10
217 206 //
218 207 this.label10.AutoSize = true;
219   - this.label10.Location = new System.Drawing.Point(36, 227);
  208 + this.label10.Location = new System.Drawing.Point(36, 255);
220 209 this.label10.Name = "label10";
221 210 this.label10.Size = new System.Drawing.Size(49, 12);
222 211 this.label10.TabIndex = 16;
... ... @@ -225,7 +214,7 @@
225 214 // label11
226 215 //
227 216 this.label11.AutoSize = true;
228   - this.label11.Location = new System.Drawing.Point(24, 252);
  217 + this.label11.Location = new System.Drawing.Point(24, 280);
229 218 this.label11.Name = "label11";
230 219 this.label11.Size = new System.Drawing.Size(61, 12);
231 220 this.label11.TabIndex = 17;
... ... @@ -234,7 +223,7 @@
234 223 // label12
235 224 //
236 225 this.label12.AutoSize = true;
237   - this.label12.Location = new System.Drawing.Point(32, 277);
  226 + this.label12.Location = new System.Drawing.Point(32, 305);
238 227 this.label12.Name = "label12";
239 228 this.label12.Size = new System.Drawing.Size(53, 12);
240 229 this.label12.TabIndex = 18;
... ... @@ -243,7 +232,7 @@
243 232 // label13
244 233 //
245 234 this.label13.AutoSize = true;
246   - this.label13.Location = new System.Drawing.Point(32, 302);
  235 + this.label13.Location = new System.Drawing.Point(32, 330);
247 236 this.label13.Name = "label13";
248 237 this.label13.Size = new System.Drawing.Size(53, 12);
249 238 this.label13.TabIndex = 19;
... ... @@ -252,7 +241,7 @@
252 241 // label14
253 242 //
254 243 this.label14.AutoSize = true;
255   - this.label14.Location = new System.Drawing.Point(24, 327);
  244 + this.label14.Location = new System.Drawing.Point(24, 355);
256 245 this.label14.Name = "label14";
257 246 this.label14.Size = new System.Drawing.Size(61, 12);
258 247 this.label14.TabIndex = 20;
... ... @@ -261,7 +250,7 @@
261 250 // label15
262 251 //
263 252 this.label15.AutoSize = true;
264   - this.label15.Location = new System.Drawing.Point(48, 352);
  253 + this.label15.Location = new System.Drawing.Point(48, 380);
265 254 this.label15.Name = "label15";
266 255 this.label15.Size = new System.Drawing.Size(37, 12);
267 256 this.label15.TabIndex = 21;
... ... @@ -270,71 +259,78 @@
270 259 // textBox8
271 260 //
272 261 this.textBox8.ImeMode = System.Windows.Forms.ImeMode.Off;
273   - this.textBox8.Location = new System.Drawing.Point(105, 199);
  262 + this.textBox8.Location = new System.Drawing.Point(105, 227);
274 263 this.textBox8.MaxLength = 1;
275 264 this.textBox8.Name = "textBox8";
276 265 this.textBox8.Size = new System.Drawing.Size(31, 19);
277 266 this.textBox8.TabIndex = 22;
  267 + this.textBox8.TextChanged += new System.EventHandler(this.textBox8_TextChanged);
278 268 //
279 269 // textBox9
280 270 //
281 271 this.textBox9.ImeMode = System.Windows.Forms.ImeMode.Off;
282   - this.textBox9.Location = new System.Drawing.Point(105, 224);
  272 + this.textBox9.Location = new System.Drawing.Point(105, 252);
283 273 this.textBox9.MaxLength = 1;
284 274 this.textBox9.Name = "textBox9";
285 275 this.textBox9.Size = new System.Drawing.Size(31, 19);
286 276 this.textBox9.TabIndex = 23;
  277 + this.textBox9.TextChanged += new System.EventHandler(this.textBox9_TextChanged);
287 278 //
288 279 // textBox10
289 280 //
290 281 this.textBox10.ImeMode = System.Windows.Forms.ImeMode.Off;
291   - this.textBox10.Location = new System.Drawing.Point(105, 249);
  282 + this.textBox10.Location = new System.Drawing.Point(105, 277);
292 283 this.textBox10.MaxLength = 1;
293 284 this.textBox10.Name = "textBox10";
294 285 this.textBox10.Size = new System.Drawing.Size(31, 19);
295 286 this.textBox10.TabIndex = 24;
  287 + this.textBox10.TextChanged += new System.EventHandler(this.textBox10_TextChanged);
296 288 //
297 289 // textBox11
298 290 //
299 291 this.textBox11.ImeMode = System.Windows.Forms.ImeMode.Off;
300   - this.textBox11.Location = new System.Drawing.Point(105, 274);
  292 + this.textBox11.Location = new System.Drawing.Point(105, 302);
301 293 this.textBox11.MaxLength = 1;
302 294 this.textBox11.Name = "textBox11";
303 295 this.textBox11.Size = new System.Drawing.Size(31, 19);
304 296 this.textBox11.TabIndex = 25;
  297 + this.textBox11.TextChanged += new System.EventHandler(this.textBox11_TextChanged);
305 298 //
306 299 // textBox12
307 300 //
308 301 this.textBox12.ImeMode = System.Windows.Forms.ImeMode.Off;
309   - this.textBox12.Location = new System.Drawing.Point(105, 299);
  302 + this.textBox12.Location = new System.Drawing.Point(105, 327);
310 303 this.textBox12.MaxLength = 1;
311 304 this.textBox12.Name = "textBox12";
312 305 this.textBox12.Size = new System.Drawing.Size(31, 19);
313 306 this.textBox12.TabIndex = 26;
  307 + this.textBox12.TextChanged += new System.EventHandler(this.textBox12_TextChanged);
314 308 //
315 309 // textBox13
316 310 //
317 311 this.textBox13.ImeMode = System.Windows.Forms.ImeMode.Off;
318   - this.textBox13.Location = new System.Drawing.Point(105, 324);
  312 + this.textBox13.Location = new System.Drawing.Point(105, 352);
319 313 this.textBox13.MaxLength = 1;
320 314 this.textBox13.Name = "textBox13";
321 315 this.textBox13.Size = new System.Drawing.Size(31, 19);
322 316 this.textBox13.TabIndex = 27;
  317 + this.textBox13.TextChanged += new System.EventHandler(this.textBox13_TextChanged);
323 318 //
324 319 // textBox14
325 320 //
326 321 this.textBox14.ImeMode = System.Windows.Forms.ImeMode.Off;
327   - this.textBox14.Location = new System.Drawing.Point(105, 349);
  322 + this.textBox14.Location = new System.Drawing.Point(105, 377);
328 323 this.textBox14.MaxLength = 1;
329 324 this.textBox14.Name = "textBox14";
330 325 this.textBox14.Size = new System.Drawing.Size(31, 19);
331 326 this.textBox14.TabIndex = 28;
  327 + this.textBox14.TextChanged += new System.EventHandler(this.textBox14_TextChanged);
332 328 //
333 329 // label16
334 330 //
335 331 this.label16.AutoSize = true;
336 332 this.label16.ForeColor = System.Drawing.SystemColors.ActiveBorder;
337   - this.label16.Location = new System.Drawing.Point(12, 371);
  333 + this.label16.Location = new System.Drawing.Point(12, 399);
338 334 this.label16.Name = "label16";
339 335 this.label16.Size = new System.Drawing.Size(269, 12);
340 336 this.label16.TabIndex = 29;
... ... @@ -343,7 +339,7 @@
343 339 // label17
344 340 //
345 341 this.label17.AutoSize = true;
346   - this.label17.Location = new System.Drawing.Point(32, 389);
  342 + this.label17.Location = new System.Drawing.Point(32, 417);
347 343 this.label17.Name = "label17";
348 344 this.label17.Size = new System.Drawing.Size(53, 12);
349 345 this.label17.TabIndex = 30;
... ... @@ -352,7 +348,7 @@
352 348 // label18
353 349 //
354 350 this.label18.AutoSize = true;
355   - this.label18.Location = new System.Drawing.Point(20, 414);
  351 + this.label18.Location = new System.Drawing.Point(20, 444);
356 352 this.label18.Name = "label18";
357 353 this.label18.Size = new System.Drawing.Size(65, 12);
358 354 this.label18.TabIndex = 31;
... ... @@ -361,24 +357,26 @@
361 357 // textBox15
362 358 //
363 359 this.textBox15.ImeMode = System.Windows.Forms.ImeMode.Off;
364   - this.textBox15.Location = new System.Drawing.Point(105, 386);
  360 + this.textBox15.Location = new System.Drawing.Point(105, 414);
365 361 this.textBox15.MaxLength = 1;
366 362 this.textBox15.Name = "textBox15";
367 363 this.textBox15.Size = new System.Drawing.Size(31, 19);
368 364 this.textBox15.TabIndex = 32;
  365 + this.textBox15.TextChanged += new System.EventHandler(this.textBox15_TextChanged);
369 366 //
370 367 // textBox16
371 368 //
372 369 this.textBox16.ImeMode = System.Windows.Forms.ImeMode.Off;
373   - this.textBox16.Location = new System.Drawing.Point(105, 411);
  370 + this.textBox16.Location = new System.Drawing.Point(105, 441);
374 371 this.textBox16.MaxLength = 1;
375 372 this.textBox16.Name = "textBox16";
376 373 this.textBox16.Size = new System.Drawing.Size(31, 19);
377 374 this.textBox16.TabIndex = 33;
  375 + this.textBox16.TextChanged += new System.EventHandler(this.textBox16_TextChanged);
378 376 //
379 377 // button1
380 378 //
381   - this.button1.Location = new System.Drawing.Point(186, 458);
  379 + this.button1.Location = new System.Drawing.Point(183, 482);
382 380 this.button1.Name = "button1";
383 381 this.button1.Size = new System.Drawing.Size(75, 23);
384 382 this.button1.TabIndex = 34;
... ... @@ -388,36 +386,58 @@
388 386 //
389 387 // button2
390 388 //
391   - this.button2.Location = new System.Drawing.Point(276, 458);
  389 + this.button2.Location = new System.Drawing.Point(269, 482);
392 390 this.button2.Name = "button2";
393 391 this.button2.Size = new System.Drawing.Size(86, 23);
394 392 this.button2.TabIndex = 35;
395 393 this.button2.Text = "保存して次へ";
396 394 this.button2.UseVisualStyleBackColor = true;
  395 + this.button2.Click += new System.EventHandler(this.button2_Click);
397 396 //
398 397 // button3
399 398 //
400   - this.button3.Location = new System.Drawing.Point(211, 10);
  399 + this.button3.Location = new System.Drawing.Point(211, 63);
401 400 this.button3.Name = "button3";
402 401 this.button3.Size = new System.Drawing.Size(75, 23);
403 402 this.button3.TabIndex = 36;
404 403 this.button3.Text = "復元";
405 404 this.button3.UseVisualStyleBackColor = true;
  405 + this.button3.Click += new System.EventHandler(this.button3_Click);
406 406 //
407 407 // button4
408 408 //
409   - this.button4.Location = new System.Drawing.Point(10, 458);
  409 + this.button4.Location = new System.Drawing.Point(10, 482);
410 410 this.button4.Name = "button4";
411 411 this.button4.Size = new System.Drawing.Size(75, 23);
412 412 this.button4.TabIndex = 37;
413 413 this.button4.Text = "前の入力へ";
414 414 this.button4.UseVisualStyleBackColor = true;
415 415 //
  416 + // label3
  417 + //
  418 + this.label3.AutoSize = true;
  419 + this.label3.Location = new System.Drawing.Point(12, 18);
  420 + this.label3.Name = "label3";
  421 + this.label3.Size = new System.Drawing.Size(65, 12);
  422 + this.label3.TabIndex = 38;
  423 + this.label3.Text = "行政区番号";
  424 + //
  425 + // label19
  426 + //
  427 + this.label19.AutoSize = true;
  428 + this.label19.Location = new System.Drawing.Point(332, 18);
  429 + this.label19.Name = "label19";
  430 + this.label19.Size = new System.Drawing.Size(23, 12);
  431 + this.label19.TabIndex = 39;
  432 + this.label19.Text = "0件";
  433 + //
416 434 // Form2
417 435 //
418 436 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
419 437 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
420   - this.ClientSize = new System.Drawing.Size(367, 493);
  438 + this.ClientSize = new System.Drawing.Size(367, 517);
  439 + this.Controls.Add(this.label19);
  440 + this.Controls.Add(this.label3);
421 441 this.Controls.Add(this.button4);
422 442 this.Controls.Add(this.button3);
423 443 this.Controls.Add(this.button2);
... ... @@ -450,8 +470,6 @@
450 470 this.Controls.Add(this.textBox4);
451 471 this.Controls.Add(this.label5);
452 472 this.Controls.Add(this.label4);
453   - this.Controls.Add(this.textBox3);
454   - this.Controls.Add(this.label3);
455 473 this.Controls.Add(this.textBox2);
456 474 this.Controls.Add(this.label2);
457 475 this.Controls.Add(this.label1);
... ... @@ -469,8 +487,6 @@
469 487 private System.Windows.Forms.Label label1;
470 488 private System.Windows.Forms.Label label2;
471 489 private System.Windows.Forms.TextBox textBox2;
472   - private System.Windows.Forms.Label label3;
473   - private System.Windows.Forms.TextBox textBox3;
474 490 private System.Windows.Forms.Label label4;
475 491 private System.Windows.Forms.Label label5;
476 492 private System.Windows.Forms.TextBox textBox4;
... ... @@ -503,5 +519,7 @@
503 519 private System.Windows.Forms.Button button2;
504 520 private System.Windows.Forms.Button button3;
505 521 private System.Windows.Forms.Button button4;
  522 + private System.Windows.Forms.Label label3;
  523 + private System.Windows.Forms.Label label19;
506 524 }
507 525 }
\ No newline at end of file
... ...
... ... @@ -19,6 +19,25 @@ namespace MedicalCheckInputTool
19 19 InitializeComponent();
20 20
21 21 this.Text = "ロット:" + Global.lotNo + " " + Global.times + " " + "ユーザ:" + Global.inputUser;
  22 +
  23 + label3.Text = "ロット" + " " + Global.lotNo + " 行政区番号 " + Global.adminCode;
  24 +
  25 + dspCount();
  26 + }
  27 +
  28 + private void dspCount()
  29 + {
  30 + MySqlConnection conn;
  31 + string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"];
  32 + conn = new MySqlConnection(connstr);
  33 + conn.Open();
  34 +
  35 + int cnt = getCount(Global.times, Global.lotNo, Global.adminCode, conn);
  36 +
  37 + conn.Close();
  38 +
  39 + cnt++;
  40 + label19.Text = "入力済み " + cnt + "件";
22 41 }
23 42
24 43 //保存
... ... @@ -46,6 +65,8 @@ namespace MedicalCheckInputTool
46 65 sv.done = "1"; //マッチングOKの場合、完了フラグを立てる
47 66 }
48 67 bool res = doSave(sv);
  68 +
  69 + dspCount();
49 70
50 71 }
51 72
... ... @@ -54,11 +75,18 @@ namespace MedicalCheckInputTool
54 75 SaveData sv = new SaveData();
55 76
56 77 sv.lotNo = int.Parse(Global.lotNo); //ロット番号
57   - sv.adminCode = textBox3.Text.PadLeft(6,'0'); //行政区コード
58   - sv.adminName = ""; //行政区名称
59   - sv.healthArea = ""; //保健区
  78 + sv.adminCode = Global.adminCode; //行政区コード
  79 + sv.adminName = Global.adminName; //行政区名称
  80 + sv.healthArea = Global.healthArea; //保健区
60 81 sv.serialNo = textBox1.Text.PadLeft(10,'0'); //整理番号
61   - sv.houseNo = textBox2.Text.PadLeft(10,'0'); //世帯番号
  82 + if ("".Equals(textBox2.Text))
  83 + {
  84 + sv.houseNo = "";
  85 + }
  86 + else
  87 + {
  88 + sv.houseNo = textBox2.Text.PadLeft(10, '0'); //世帯番号
  89 + }
62 90 sv.healthCheck = textBox6.Text; //健康診査
63 91 sv.lungCancer = textBox7.Text; //結核肺がん
64 92 sv.stomachCancer = textBox8.Text; //胃がん
... ... @@ -106,29 +134,104 @@ namespace MedicalCheckInputTool
106 134 return err;
107 135 }
108 136
109   - private bool isExistData(SaveData sv, string tableName, MySqlConnection conn)
  137 + private int getCount(string tableName, string lotNo, string adminCode, MySqlConnection conn)
110 138 {
111   - bool isExist = false;
112   -// new MySqlCommand("select exists (select 1 from @tableName where `整理番号` = @serialNo)", conn);
  139 + int cnt = 0;
  140 + MySqlCommand cmd = new MySqlCommand("select count(*) from `" + tableName + "` where `ロット番号` = @lotNo and `行政区コード` = @adminCode", conn);
113 141 // パラメータ設定
114   -// cmd.Parameters.Add(new MySqlParameter("tableName", tableName));
115   - MySqlCommand cmd = new MySqlCommand("select * from `" + tableName + "` where `整理番号` = @serialNo ", conn);
  142 + cmd.Parameters.Add(new MySqlParameter("lotNo", lotNo));
  143 + cmd.Parameters.Add(new MySqlParameter("adminCode", adminCode));
  144 +
  145 + try
  146 + {
  147 + // 実行
  148 + MySqlDataReader reader = cmd.ExecuteReader();
  149 + reader.Read();
  150 + cnt = reader.GetInt32(0);
  151 + reader.Close();
  152 + }
  153 + catch (SqlException ex)
  154 + {
  155 + }
  156 +
  157 + return cnt;
  158 + }
  159 +
  160 + private bool selectData(string tableName, string lotNo, string serialNo, MySqlConnection conn)
  161 + {
  162 + bool err = false;
  163 + MySqlCommand cmd = new MySqlCommand("select * from `" + tableName + "` where `ロット番号` = @lotNo and `整理番号` = @serialNo", conn);
116 164 // パラメータ設定
  165 + cmd.Parameters.Add(new MySqlParameter("lotNo", lotNo));
  166 + cmd.Parameters.Add(new MySqlParameter("serialNo", serialNo));
117 167
  168 + try
  169 + {
  170 + MySqlDataReader reader = cmd.ExecuteReader();
  171 + if (!reader.HasRows)
  172 + {
  173 + //無かった
  174 + reader.Close();
  175 + }
  176 + else
  177 + {
  178 + string[] row = new string[reader.FieldCount];
  179 + while (reader.Read())
  180 + {
  181 + textBox1.Text = isDBNull(reader,"整理番号");
  182 + textBox2.Text = isDBNull(reader, "世帯番号");
  183 + textBox4.Text = isDBNull(reader, "電話番号");
  184 + textBox5.Text = isDBNull(reader, "携帯番号");
  185 + textBox6.Text = isDBNull(reader, "健康診査");
  186 + textBox7.Text = isDBNull(reader, "結核肺がん");
  187 + textBox8.Text = isDBNull(reader, "胃がん");
  188 + textBox9.Text = isDBNull(reader, "大腸がん");
  189 + textBox10.Text = isDBNull(reader, "前立腺がん");
  190 + textBox11.Text = isDBNull(reader, "骨粗鬆症");
  191 + textBox12.Text = isDBNull(reader, "成人歯科");
  192 + textBox13.Text = isDBNull(reader, "子宮頸がん");
  193 + textBox14.Text = isDBNull(reader, "乳がん");
  194 + textBox15.Text = isDBNull(reader, "希望場所");
  195 + textBox16.Text = isDBNull(reader, "身体不自由");
  196 + }
  197 + reader.Close();
  198 + }
  199 + }
  200 + catch (SqlException ex)
  201 + {
  202 + }
  203 +
  204 + return err;
  205 + }
  206 +
  207 + private string isDBNull(MySqlDataReader reader, string column)
  208 + {
  209 + int index = reader.GetOrdinal(column);
  210 + if (reader.IsDBNull(index))
  211 + {
  212 + return "";
  213 + }
  214 + else
  215 + {
  216 + return reader.GetString(column);
  217 + }
  218 + }
  219 +
  220 +
  221 + private bool isExistData(SaveData sv, string tableName, MySqlConnection conn)
  222 + {
  223 + bool isExist = false;
  224 + MySqlCommand cmd = new MySqlCommand("select exists (select 1 from `" + tableName + "` where `整理番号` = @serialNo)", conn);
  225 + // パラメータ設定
118 226 cmd.Parameters.Add(new MySqlParameter("serialNo", sv.serialNo));
119 227
120 228 try
121 229 {
122 230 // 実行
123 231 MySqlDataReader reader = cmd.ExecuteReader();
124   - if (reader.HasRows)
125   - {
126   - isExist = true;
127   - }
  232 + reader.Read();
  233 + isExist = reader.GetBoolean(0);
128 234 reader.Close();
129   -// reader.Read();
130   -// isExist = reader.GetBoolean(0);
131   -// reader.Close();
132 235 }
133 236 catch (SqlException ex)
134 237 {
... ... @@ -300,5 +403,269 @@ namespace MedicalCheckInputTool
300 403 return err;
301 404
302 405 }
  406 +
  407 + private void sendTabKey(TextBox textbox, int length)
  408 + {
  409 + if (textbox.Text.Length == length)
  410 + {
  411 + SendKeys.Send("{Tab}");
  412 + }
  413 + }
  414 +
  415 + private void clearForm()
  416 + {
  417 + textBox1.Text = "";
  418 + textBox2.Text = "";
  419 + textBox4.Text = "";
  420 + textBox5.Text = "";
  421 + textBox6.Text = "";
  422 + textBox7.Text = "";
  423 + textBox8.Text = "";
  424 + textBox9.Text = "";
  425 + textBox10.Text = "";
  426 + textBox11.Text = "";
  427 + textBox12.Text = "";
  428 + textBox13.Text = "";
  429 + textBox14.Text = "";
  430 + textBox15.Text = "";
  431 + textBox16.Text = "";
  432 +
  433 + textBox1.Focus();
  434 + }
  435 +
  436 + private void textBox1_TextChanged(object sender, EventArgs e) //整理番号
  437 + {
  438 + sendTabKey(textBox1, 10);
  439 + }
  440 +
  441 + private void textBox2_TextChanged(object sender, EventArgs e) //世帯番号
  442 + {
  443 + sendTabKey(textBox2, 10);
  444 + }
  445 +
  446 + private void textBox4_TextChanged(object sender, EventArgs e) //電話番号
  447 + {
  448 + sendTabKey(textBox4, 15);
  449 + }
  450 +
  451 + private void textBox5_TextChanged(object sender, EventArgs e) //携帯番号
  452 + {
  453 + sendTabKey(textBox5, 15);
  454 + }
  455 +
  456 + private void textBox6_TextChanged(object sender, EventArgs e) //健康診査
  457 + {
  458 + if("".Equals(textBox6.Text))
  459 + {
  460 + label7.ForeColor = Color.Black;
  461 + }
  462 + else
  463 + {
  464 + label7.ForeColor = Color.Blue;
  465 + }
  466 + sendTabKey(textBox6, 1);
  467 + }
  468 +
  469 + private void textBox7_TextChanged(object sender, EventArgs e) //結核肺がん
  470 + {
  471 + if ("".Equals(textBox7.Text))
  472 + {
  473 + label8.ForeColor = Color.Black;
  474 + }
  475 + else
  476 + {
  477 + label8.ForeColor = Color.Blue;
  478 + }
  479 + sendTabKey(textBox7, 1);
  480 + }
  481 +
  482 + private void textBox8_TextChanged(object sender, EventArgs e) //胃がん
  483 + {
  484 + if ("".Equals(textBox8.Text))
  485 + {
  486 + label9.ForeColor = Color.Black;
  487 + }
  488 + else
  489 + {
  490 + label9.ForeColor = Color.Blue;
  491 + }
  492 + sendTabKey(textBox8, 1);
  493 + }
  494 +
  495 + private void textBox9_TextChanged(object sender, EventArgs e) //大腸がん
  496 + {
  497 + if ("".Equals(textBox9.Text))
  498 + {
  499 + label10.ForeColor = Color.Black;
  500 + }
  501 + else
  502 + {
  503 + label10.ForeColor = Color.Blue;
  504 + }
  505 + sendTabKey(textBox9, 1);
  506 + }
  507 +
  508 + private void textBox10_TextChanged(object sender, EventArgs e) //前立腺がん
  509 + {
  510 + if ("".Equals(textBox10.Text))
  511 + {
  512 + label11.ForeColor = Color.Black;
  513 + }
  514 + else
  515 + {
  516 + label11.ForeColor = Color.Blue;
  517 + }
  518 + sendTabKey(textBox10, 1);
  519 + }
  520 +
  521 + private void textBox11_TextChanged(object sender, EventArgs e) //骨粗鬆症
  522 + {
  523 + if ("".Equals(textBox11.Text))
  524 + {
  525 + label12.ForeColor = Color.Black;
  526 + }
  527 + else
  528 + {
  529 + label12.ForeColor = Color.Blue;
  530 + }
  531 + sendTabKey(textBox11, 1);
  532 + }
  533 +
  534 + private void textBox12_TextChanged(object sender, EventArgs e) //成人歯科
  535 + {
  536 + if ("".Equals(textBox12.Text))
  537 + {
  538 + label13.ForeColor = Color.Black;
  539 + }
  540 + else
  541 + {
  542 + label13.ForeColor = Color.Blue;
  543 + }
  544 + sendTabKey(textBox12, 1);
  545 + }
  546 +
  547 + private void textBox13_TextChanged(object sender, EventArgs e) //子宮頸がん
  548 + {
  549 + if ("".Equals(textBox13.Text))
  550 + {
  551 + label14.ForeColor = Color.Black;
  552 + }
  553 + else
  554 + {
  555 + label14.ForeColor = Color.Blue;
  556 + }
  557 + sendTabKey(textBox13, 1);
  558 + }
  559 +
  560 + private void textBox14_TextChanged(object sender, EventArgs e) //乳がん
  561 + {
  562 + if ("".Equals(textBox14.Text))
  563 + {
  564 + label15.ForeColor = Color.Black;
  565 + }
  566 + else
  567 + {
  568 + label15.ForeColor = Color.Blue;
  569 + }
  570 + sendTabKey(textBox14, 1);
  571 + }
  572 +
  573 + private void textBox15_TextChanged(object sender, EventArgs e) //希望場所
  574 + {
  575 + sendTabKey(textBox15, 1);
  576 + }
  577 +
  578 + private void textBox16_TextChanged(object sender, EventArgs e) //身体不自由
  579 + {
  580 + sendTabKey(textBox16, 1);
  581 + }
  582 +
  583 + //保存して次へ
  584 + private void button2_Click(object sender, EventArgs e)
  585 + {
  586 + bool match = false;
  587 + //入力チェック
  588 + if ("".Equals(textBox1.Text)) //必須は整理番号のみ
  589 + {
  590 + MessageBox.Show("整理番号が入力されていません");
  591 + return;
  592 + }
  593 +
  594 + //マッチングチェック
  595 + if ("2回目".Equals(Global.times))
  596 + {
  597 + //1回目と比較
  598 + //一致しない場合、エラーダイアログ表示
  599 + DialogResult result = MessageBox.Show("入力内容が1回目と異なりますが保存しますか?",
  600 + "確認",
  601 + MessageBoxButtons.OKCancel,
  602 + MessageBoxIcon.Exclamation,
  603 + MessageBoxDefaultButton.Button2);
  604 +
  605 + //何が選択されたか調べる
  606 + if (result == DialogResult.OK)
  607 + {
  608 + //「OK」が選択された時
  609 + }
  610 + else if (result == DialogResult.Cancel)
  611 + {
  612 + //「キャンセル」が選択された時
  613 + return;
  614 + }
  615 + }
  616 +
  617 + //保存処理
  618 + SaveData sv = makeSaveData();
  619 + if (match)
  620 + {
  621 + sv.done = "1"; //マッチングOKの場合、完了フラグを立てる
  622 + }
  623 + bool res = doSave(sv);
  624 +
  625 + clearForm();
  626 + dspCount();
  627 + }
  628 +
  629 + private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  630 + {
  631 +// if (e.KeyChar == Keys.NumLock) // 「NumLock」タブ
  632 +// {
  633 +// SendKeys.Send("{Tab}");
  634 +// e.Handled = true;
  635 +// }
  636 + if (e.KeyChar == '/') // 「/」BackSpace
  637 + {
  638 + SendKeys.Send("{BS}");
  639 + e.Handled = true;
  640 + }
  641 + if (e.KeyChar == '+') // 「+」次へ
  642 + {
  643 + button2.Focus();
  644 + button2.PerformClick();
  645 + e.Handled = true;
  646 + }
  647 + if (e.KeyChar == '*') // 「*」無効
  648 + {
  649 + e.Handled = true;
  650 + }
  651 + }
  652 +
  653 + //復元
  654 + private void button3_Click(object sender, EventArgs e)
  655 + {
  656 + if("".Equals(textBox1.Text))
  657 + {
  658 + return;
  659 + }
  660 +
  661 + MySqlConnection conn;
  662 + string connstr = System.Configuration.ConfigurationManager.AppSettings["Conn"];
  663 + conn = new MySqlConnection(connstr);
  664 + conn.Open();
  665 + string code = textBox1.Text.PadLeft(10, '0');
  666 +
  667 + selectData(Global.times, Global.lotNo, code, conn);
  668 + }
  669 +
303 670 }
304 671 }
... ...
... ... @@ -11,5 +11,8 @@ namespace MedicalCheckInputTool
11 11 public static string inputUser;
12 12 public static string lotNo;
13 13 public static string times;
  14 + public static string adminCode;
  15 + public static string adminName;
  16 + public static string healthArea;
14 17 }
15 18 }
... ...
... ... @@ -39,6 +39,8 @@
39 39 <Reference Include="System" />
40 40 <Reference Include="System.Configuration" />
41 41 <Reference Include="System.Core" />
  42 + <Reference Include="System.Runtime.Serialization" />
  43 + <Reference Include="System.ServiceModel.Web" />
42 44 <Reference Include="System.Xml.Linq" />
43 45 <Reference Include="System.Data.DataSetExtensions" />
44 46 <Reference Include="Microsoft.CSharp" />
... ...
Please register or login to post a comment