test_user 1 year ago
parent
commit
0348392798

+ 2 - 2
conf/app.conf View File

@@ -55,7 +55,7 @@ front_end_domain = "https://xt.kuyicloud.com/#"
55 55
 #url = "http://192.168.1.88:6666/szsi-portal/transData"
56 56
 #gdyb_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"
57 57
 
58
-gdyb_url = "http://test.inner.getway.ylbzj.hebei.gov.cn/ebus/rio_fsi/"
58
+gdyb_url = "http://test.inner.getway.ylbzj.hebei.gov.cn/ebus/mbs_fsi_auth"
59 59
 #test
60 60
 # gdyb_url = http://10.97.240.206/ebus/gdyb_inf/poc/hsa/hgs/
61 61
 #gdyb_url="http://igb.hsa.gdgov.cn/ebus/sz_prd/hsa/hgs/"
@@ -80,7 +80,7 @@ gdyb_url = "http://test.inner.getway.ylbzj.hebei.gov.cn/ebus/rio_fsi/"
80 80
 #gdyb_paasid = "gdyb_inf"
81 81
 #江西
82 82
 #gdyb_url = "http://10.77.211.236/CSB/hsa-fsi-"
83
-gdyb_paasid = "mbs_fsi_auth
83
+gdyb_paasid = "mbs_fsi_auth"
84 84
 
85 85
 readmysqlhost = shengws1.mysql.rds.aliyuncs.com
86 86
 readmysqlport = 3306

+ 208 - 151
controllers/coordinate/coordinate_controller.go View File

@@ -16,6 +16,16 @@ import (
16 16
 	"time"
17 17
 )
18 18
 
19
+type ZBDrug struct {
20
+	Code   string `json:"code"`
21
+	Msg    string `json:"msg"`
22
+	Result []struct {
23
+		Bbx01 int64  `json:"bbx01"`
24
+		Bby01 int64  `json:"bby01"`
25
+		Kf    string `json:"库房id"`
26
+	} `json:"result"`
27
+}
28
+
19 29
 type ResultUpload struct {
20 30
 	Code   string `json:"code"`
21 31
 	Msg    string `json:"msg"`
@@ -57,6 +67,11 @@ type ResultReg struct {
57 67
 	InfoSeq    string `json:"infoSeq"`
58 68
 }
59 69
 
70
+type GroupPrescription struct {
71
+	GroupNo int64
72
+	PId     int64
73
+}
74
+
60 75
 func CoordinateRegistRouters() {
61 76
 	beego.Router("/coordinate/settleAccount", &CoordinateController{}, "get:SettleAccount")
62 77
 
@@ -212,6 +227,20 @@ func (c *CoordinateController) SettleAccount() {
212 227
 		info.Bck01c = departmwnt.Number
213 228
 		info.Bce02a = doctor_info.DoctorNumber
214 229
 
230
+		var info2 models.UploadInfo
231
+		info2.Vaa01 = res.Result[0].Vaa01
232
+		info2.Fasong = "1"
233
+		info2.Vaa07 = res.Result[0].Vaa07
234
+		info2.Bck01c = departmwnt.Number
235
+		info2.Bce02a = doctor_info.DoctorNumber
236
+
237
+		var info3 models.UploadInfo
238
+		info3.Vaa01 = res.Result[0].Vaa01
239
+		info3.Fasong = "1"
240
+		info3.Vaa07 = res.Result[0].Vaa07
241
+		info3.Bck01c = departmwnt.Number
242
+		info3.Bce02a = doctor_info.DoctorNumber
243
+
215 244
 		diagnosis_ids := strings.Split(patientPrescription.Diagnosis, ",")
216 245
 		var config []*models.HisXtDiagnoseConfig
217 246
 		for _, item := range diagnosis_ids {
@@ -226,18 +255,30 @@ func (c *CoordinateController) SettleAccount() {
226 255
 			info.Diag = append(info.Diag, &diag)
227 256
 		}
228 257
 		var presInfos []*models.PresInfo
229
-		var presDetails []*models.PresDetail
258
+		var presInfos2 []*models.PresInfo
259
+		var presInfos3 []*models.PresInfo
230 260
 
231 261
 		var doctoradvices []*models.HisDoctorAdviceInfo
232
-		var groups []int64
262
+		var projects []*models.HisPrescriptionProject
263
+
264
+		var groups []*GroupPrescription
233 265
 		for _, item := range prescriptions {
234 266
 			for _, subItem := range item.HisDoctorAdviceInfo {
235 267
 				doctoradvices = append(doctoradvices, subItem)
236 268
 			}
237 269
 		}
238 270
 
271
+		for _, item := range prescriptions {
272
+			for _, subItem := range item.HisPrescriptionProject {
273
+				projects = append(projects, subItem)
274
+			}
275
+		}
276
+
239 277
 		for _, item := range doctoradvices {
240
-			groups = append(groups, item.Groupno)
278
+			var gp GroupPrescription
279
+			gp.GroupNo = item.Groupno
280
+			gp.PId = item.PrescriptionId
281
+			groups = append(groups, &gp)
241 282
 		}
242 283
 		groups = RemoveRepeatedGroupElement(groups)
243 284
 
@@ -247,206 +288,222 @@ func (c *CoordinateController) SettleAccount() {
247 288
 		}
248 289
 		var doctoradvice []*DoctorAdvices
249 290
 
250
-		for _, group := range groups {
291
+		for index, group := range groups {
251 292
 			var da DoctorAdvices
252
-			da.GroupNo = group
293
+			da.GroupNo = group.GroupNo + int64(index)
253 294
 			for _, item := range doctoradvices {
254
-				if group == item.Groupno {
295
+				if group.GroupNo == item.Groupno && group.PId == item.PrescriptionId {
255 296
 					da.item = append(da.item, item)
256 297
 				}
257 298
 			}
299
+
258 300
 			doctoradvice = append(doctoradvice, &da)
259 301
 		}
260 302
 
303
+		fmt.Println("doctoradvice")
304
+		fmt.Println(doctoradvice)
305
+
306
+		var presInfo models.PresInfo
307
+		presInfo.Cbmid = "0"
308
+		presInfo.Cbm06 = "0"
309
+		presInfo.Cbm07 = "0"
310
+		var presDetails []*models.PresDetail
311
+
312
+		var presInfo2 models.PresInfo
313
+		presInfo2.Cbmid = "0"
314
+		presInfo2.Cbm06 = "9"
315
+		presInfo2.Cbm07 = "0"
316
+		var presDetails2 []*models.PresDetail
317
+
318
+		var presInfo3 models.PresInfo
319
+		presInfo3.Cbmid = "0"
320
+		presInfo3.Cbm06 = "5"
321
+		presInfo3.Cbm07 = "0"
322
+		var presDetails3 []*models.PresDetail
323
+
261 324
 		for _, item := range doctoradvice {
262 325
 			var presDetail models.PresDetail
263
-			var presInfo models.PresInfo
264
-			presInfo.Cbmid = strconv.FormatInt(item.GroupNo, 10)
265
-
266
-			presInfo.Cbm06 = "0"
267
-			presInfo.Cbm07 = ""
268 326
 			presDetail.Vaf59 = strconv.FormatInt(item.GroupNo, 10)
269 327
 			var infoItems []*models.Item
270 328
 			for index, subItem := range item.item {
271 329
 				ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
330
+				result3, request3 := service.GetDrugInfo(subItem.BaseDrugLib.MedicalInsuranceNumber)
331
+				saveLog(result3, request3, "查询药品", "查询药品", org.OrgName)
332
+
333
+				var res ZBDrug
334
+				if err := json.Unmarshal([]byte(result3), &res); err != nil {
335
+					utils.ErrorLog("解析失败:%v", err)
336
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
337
+					return
338
+				}
272 339
 
273 340
 				var infoItem models.Item
274
-				infoItem.Rownr = strconv.FormatInt(int64(index), 10)
341
+				infoItem.Rownr = strconv.FormatInt(int64(index+1), 10)
275 342
 				infoItem.Vaf11 = "2"
276 343
 				infoItem.Vaf36 = time.Unix(subItem.CreatedTime, 0).Format("2006-01-02 15:04:05")
277 344
 				infoItem.Bbx01 = subItem.BaseDrugLib.MedicalInsuranceNumber
278 345
 				infoItem.Bda01 = "1"
279
-				infoItem.Bby01 = ""
346
+				infoItem.Bby01 = strconv.FormatInt(res.Result[0].Bby01, 10)
280 347
 				if subItem.BaseDrugLib.MinUnit != subItem.BaseDrugLib.DoseUnit {
281
-					infoItem.Vaf22 = subItem.BaseDrugLib.DrugName + " " + subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit + "*" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit + "/" + subItem.BaseDrugLib.MaxUnit
348
+					infoItem.Vaf22 = subItem.BaseDrugLib.DrugName + " " + subItem.BaseDrugLib.DoseUnit + "*" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit + "/" + subItem.BaseDrugLib.MaxUnit
282 349
 				}
283 350
 				infoItem.Vaf14 = subItem.BaseDrugLib.DrugName
284 351
 				infoItem.Bdi01 = ef.Code
285 352
 				infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
286 353
 				infoItem.Vaf18 = fmt.Sprintf("%.2f", subItem.SingleDose)
354
+				infoItem.Vaf15 = subItem.DeliveryWay
287 355
 
288 356
 				infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
289 357
 				infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
290 358
 				infoItem.Vaf35 = "0"
291 359
 				infoItem.Vaf32 = "0"
292
-				infoItem.Bck01b = departmwnt.Number
360
+				fmt.Println(res.Result[0].Kf)
361
+				infoItem.Bck01b = res.Result[0].Kf
293 362
 				infoItem.Bck01d = departmwnt.Number
294 363
 				infoItem.Vaf58 = "0"
295 364
 				infoItem.Vaf61 = "1"
296 365
 				infoItems = append(infoItems, &infoItem)
297
-			}
298 366
 
367
+				var infoItem2 models.Item //用药途径
368
+				project, _ := service.GetWayInfoByName(subItem.DeliveryWay, 10340)
369
+				infoItem2.Rownr = "0"
370
+				infoItem2.Vaf11 = "2"
371
+				infoItem2.Vaf36 = time.Unix(subItem.CreatedTime, 0).Format("2006-01-02 15:04:05")
372
+				infoItem2.Bbx01 = project.MedicalCode
373
+				infoItem2.Bda01 = "Z"
374
+				infoItem2.Bby01 = project.MedicalCode
375
+				infoItem2.Vaf14 = project.ProjectName
376
+				infoItem2.Vaf15 = project.ProjectName
377
+				infoItem2.Bdi01 = "160"
378
+				infoItem2.Vaf17 = strconv.FormatInt(subItem.Day, 10)
379
+				infoItem2.Vaf20 = "1"
380
+				infoItem2.Vaf21 = "1"
381
+				infoItem2.Vaf35 = "0"
382
+				infoItem2.Vaf18 = "0"
383
+				infoItem2.Vaf32 = "1"
384
+				infoItem2.Bck01b = departmwnt.Number
385
+				infoItem2.Bck01d = res.Result[0].Kf
386
+				infoItem2.Vaf58 = "0"
387
+				infoItem2.Vaf61 = "1"
388
+				infoItems = append(infoItems, &infoItem2)
389
+
390
+				fmt.Println(infoItems)
391
+			}
299 392
 			presDetail.Item = infoItems
300 393
 			presDetails = append(presDetails, &presDetail)
301
-			presInfo.PresDetail = presDetails
302
-			presInfos = append(presInfos, &presInfo)
303
-
304 394
 		}
305 395
 
306
-		for index, item := range prescriptions {
307
-			var presDetail models.PresDetail
308
-			var presInfo models.PresInfo
309
-			presInfo.Cbmid = strconv.FormatInt(item.ID, 10)
310
-			if item.Type == 1 {
311
-				presInfo.Cbm06 = "0"
312
-			} else {
313
-				presInfo.Cbm06 = "5"
314
-			}
396
+		for index, subItem := range projects {
315 397
 
316
-			if item.Type == 1 {
317
-				presInfo.Cbm07 = item.MedType
318
-			} else {
319
-				presInfo.Cbm07 = item.MedType
320
-			}
398
+			if subItem.Type == 2 {
399
+				var presDetail2 models.PresDetail
400
+				presDetail2.Vaf59 = strconv.FormatInt(int64(index+1), 10)
401
+				var infoItems2 []*models.Item
402
+				var infoItem models.Item
403
+				infoItem.Rownr = "1"
404
+				infoItem.Vaf11 = "0"
405
+				infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
406
+				infoItem.Bbx01 = subItem.HisProject.MedicalCode
407
+
408
+				if subItem.HisProject.CostClassify == 2 {
409
+					infoItem.Bda01 = "T"
410
+				} else if subItem.HisProject.CostClassify == 3 {
411
+					infoItem.Bda01 = "L"
412
+				} else {
413
+					infoItem.Bda01 = "T"
414
+				}
415
+				infoItem.Bby01 = "0"
416
+				infoItem.Vaf14 = subItem.HisProject.ProjectName
417
+				infoItem.Vaf22 = subItem.HisProject.ProjectName
418
+				infoItem.Bdi01 = "160"
419
+				infoItem.Vaf17 = "1"
420
+				infoItem.Vaf20 = "1"
421
+				infoItem.Vaf21 = subItem.Count
422
+				infoItem.Vaf35 = "0"
423
+				infoItem.Vaf18 = "0"
424
+				infoItem.Vaf32 = "0"
425
+				infoItem.Bck01b = departmwnt.Number
426
+				infoItem.Bck01d = departmwnt.Number
427
+				infoItem.Vaf58 = "0"
428
+				infoItem.Vaf61 = "1"
429
+				infoItems2 = append(infoItems2, &infoItem)
430
+				presDetail2.Item = infoItems2
431
+				presDetails2 = append(presDetails2, &presDetail2)
321 432
 
322
-			presDetail.Vaf59 = strconv.FormatInt(int64(index+1), 10)
323
-			var infoItems []*models.Item
324
-			//for index, subItem := range item.HisDoctorAdviceInfo {
325
-			//	ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
326
-			//
327
-			//	var infoItem models.Item
328
-			//	infoItem.Rownr = strconv.FormatInt(int64(index+1), 10)
329
-			//	infoItem.Vaf11 = "2"
330
-			//	infoItem.Vaf36 = time.Unix(subItem.ExecutionTime, 0).Format("2006-01-02 15:04:05")
331
-			//	infoItem.Bbx01 = subItem.BaseDrugLib.MedicalInsuranceNumber
332
-			//	infoItem.Bda01 = "1"
333
-			//	infoItem.Bby01 = ""
334
-			//	if subItem.BaseDrugLib.MinUnit != subItem.BaseDrugLib.DoseUnit {
335
-			//		infoItem.Vaf22 = subItem.BaseDrugLib.DrugName + " " + subItem.BaseDrugLib.Dose + subItem.BaseDrugLib.DoseUnit + "*" + strconv.FormatInt(subItem.BaseDrugLib.MinNumber, 10) + subItem.BaseDrugLib.MinUnit + "/" + subItem.BaseDrugLib.MaxUnit
336
-			//	}
337
-			//	infoItem.Vaf14 = subItem.BaseDrugLib.DrugName
338
-			//	infoItem.Bdi01 = ef.Code
339
-			//	infoItem.Vaf17 = strconv.FormatInt(subItem.Day, 10)
340
-			//	infoItem.Vaf20 = fmt.Sprintf("%.2f", subItem.SingleDose)
341
-			//	infoItem.Vaf21 = fmt.Sprintf("%.2f", subItem.PrescribingNumber)
342
-			//	infoItem.Vaf35 = "0"
343
-			//	infoItem.Vaf32 = "0"
344
-			//	infoItem.Bck01b = departmwnt.Number
345
-			//	infoItem.Bck01d = departmwnt.Number
346
-			//	infoItem.Vaf58 = "0"
347
-			//	infoItem.Vaf61 = "1"
348
-			//	infoItems = append(infoItems, &infoItem)
349
-			//}
350
-			for _, subItem := range item.HisPrescriptionProject {
351
-				//ef, _ := service.GetExecutionFrequencyByName(subItem.ExecutionFrequency, subItem.UserOrgId)
352
-
353
-				if subItem.Type == 2 {
354
-					if subItem.HisProject.CostClassify == 10 {
355
-						var infoItem models.Item
356
-						infoItem.Rownr = "0"
357
-						infoItem.Vaf11 = "2"
358
-						infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
359
-						infoItem.Bbx01 = subItem.HisProject.MedicalCode
360
-						infoItem.Bda01 = "Z"
361
-						infoItem.Bby01 = ""
362
-						infoItem.Vaf14 = subItem.HisProject.ProjectName
363
-						infoItem.Vaf15 = subItem.HisProject.ProjectName
364
-						infoItem.Bdi01 = "160"
365
-						infoItem.Vaf17 = subItem.Day
366
-						infoItem.Vaf20 = subItem.SingleDose
367
-						infoItem.Vaf21 = subItem.Count
368
-						infoItem.Vaf35 = "0"
369
-						infoItem.Vaf18 = ""
370
-						infoItem.Vaf32 = "1"
371
-						infoItem.Bck01b = departmwnt.Number
372
-						infoItem.Bck01d = departmwnt.Number
373
-						infoItem.Vaf58 = "0"
374
-						infoItem.Vaf61 = "1"
375
-						infoItems = append(infoItems, &infoItem)
433
+			} else {
434
+				var presDetail3 models.PresDetail
435
+				presDetail3.Vaf59 = strconv.FormatInt(int64(index+1), 10)
436
+				var infoItems2 []*models.Item
437
+				var infoItem models.Item
438
+				result3, request3 := service.GetGoodInfo(subItem.GoodInfo.MedicalInsuranceNumber)
439
+				saveLog(result3, request3, "查询耗材", "查询耗材", org.OrgName)
440
+				var res ZBDrug
441
+				if err := json.Unmarshal([]byte(result3), &res); err != nil {
442
+					utils.ErrorLog("解析失败:%v", err)
443
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
444
+					return
445
+				}
376 446
 
377
-					} else {
447
+				infoItem.Rownr = "1"
448
+				infoItem.Vaf11 = "0"
449
+				infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
450
+				infoItem.Bbx01 = subItem.GoodInfo.MedicalInsuranceNumber
451
+				infoItem.Bda01 = "M"
452
+				infoItem.Bby01 = strconv.FormatInt(res.Result[0].Bby01, 10)
453
+				infoItem.Vaf14 = subItem.GoodInfo.GoodName + " " + subItem.GoodInfo.SpecificationName
454
+				infoItem.Vaf22 = subItem.GoodInfo.GoodName + " " + subItem.GoodInfo.SpecificationName
455
+				infoItem.Bdi01 = "160"
456
+				infoItem.Vaf17 = "1"
457
+				infoItem.Vaf18 = "0"
458
+				infoItem.Vaf20 = subItem.SingleDose
459
+				infoItem.Vaf21 = subItem.Count
460
+				infoItem.Vaf35 = "0"
461
+				infoItem.Vaf32 = "0"
462
+				infoItem.Bck01b = res.Result[0].Kf
463
+				infoItem.Bck01d = departmwnt.Number
464
+				infoItem.Vaf58 = "0"
465
+				infoItem.Vaf61 = "1"
466
+				infoItems2 = append(infoItems2, &infoItem)
467
+				presDetail3.Item = infoItems2
468
+				presDetails3 = append(presDetails3, &presDetail3)
378 469
 
379
-						var infoItem models.Item
380
-						infoItem.Rownr = "0"
381
-						infoItem.Vaf11 = "1"
382
-						infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
383
-						infoItem.Bbx01 = subItem.HisProject.MedicalCode
384
-
385
-						if subItem.HisProject.CostClassify == 2 {
386
-							infoItem.Bda01 = "T"
387
-						} else if subItem.HisProject.CostClassify == 3 {
388
-							infoItem.Bda01 = "L"
389
-						} else {
390
-							infoItem.Bda01 = "T"
391
-						}
392
-						infoItem.Bby01 = ""
393
-						infoItem.Vaf14 = subItem.HisProject.ProjectName
394
-
395
-						infoItem.Bdi01 = "160"
396
-						infoItem.Vaf17 = subItem.Day
397
-						infoItem.Vaf20 = subItem.SingleDose
398
-						infoItem.Vaf21 = subItem.Count
399
-						infoItem.Vaf35 = "0"
400
-						infoItem.Vaf18 = fmt.Sprintf("%.2f", subItem.SingleDose)
401
-						infoItem.Vaf32 = "0"
402
-						infoItem.Bck01b = departmwnt.Number
403
-						infoItem.Bck01d = departmwnt.Number
404
-						infoItem.Vaf58 = "0"
405
-						infoItem.Vaf61 = "1"
406
-						infoItems = append(infoItems, &infoItem)
470
+			}
471
+		}
407 472
 
408
-					}
473
+		presInfo.PresDetail = presDetails
474
+		presInfo2.PresDetail = presDetails2
475
+		presInfo3.PresDetail = presDetails3
409 476
 
410
-				} else {
411
-					var infoItem models.Item
412
-					infoItem.Rownr = "0"
413
-					infoItem.Vaf11 = "1"
414
-					infoItem.Vaf36 = time.Unix(subItem.Ctime, 0).Format("2006-01-02 15:04:05")
415
-					infoItem.Bbx01 = subItem.GoodInfo.MedicalInsuranceNumber
416
-					infoItem.Bda01 = "M"
417
-					infoItem.Bby01 = ""
418
-					infoItem.Vaf14 = subItem.GoodInfo.GoodName + " " + subItem.GoodInfo.SpecificationName
419
-					infoItem.Bdi01 = "160"
420
-					infoItem.Vaf17 = subItem.Day
421
-					infoItem.Vaf20 = subItem.SingleDose
422
-					infoItem.Vaf21 = subItem.Count
423
-					infoItem.Vaf35 = "0"
424
-					infoItem.Vaf32 = "0"
425
-					infoItem.Bck01b = departmwnt.Number
426
-					infoItem.Bck01d = departmwnt.Number
427
-					infoItem.Vaf58 = "0"
428
-					infoItem.Vaf61 = "1"
429
-					infoItems = append(infoItems, &infoItem)
477
+		presInfos = append(presInfos, &presInfo)
478
+		presInfos2 = append(presInfos2, &presInfo2)
479
+		presInfos3 = append(presInfos3, &presInfo3)
430 480
 
431
-				}
481
+		info.PresInfo = presInfos
482
+		info2.PresInfo = presInfos2
483
+		info3.PresInfo = presInfos3
432 484
 
433
-			}
485
+		var infos []models.UploadInfo
434 486
 
435
-			presDetail.Item = infoItems
436
-			presDetails = append(presDetails, &presDetail)
437
-			presInfo.PresDetail = presDetails
438
-			presInfos = append(presInfos, &presInfo)
439
-		}
487
+		infos = append(infos, info)
488
+		infos = append(infos, info2)
489
+		infos = append(infos, info3)
440 490
 
441
-		info.PresInfo = presInfos
442 491
 		var result2 string
443 492
 		var request2 string
444 493
 		if res.Result[0].Type == "1" {
445
-			result2, request2 = service.UploadPrescriptionForCoordinate(info)
494
+			for _, item := range infos {
495
+				result2, request2 = service.UploadPrescriptionForCoordinate(item)
496
+				saveLog(result2, request2, "上传明细", "上传明细", org.OrgName)
497
+
498
+			}
499
+
446 500
 		} else {
447
-			result2, request2 = service.UploadPrescriptionForCoordinateHospital(info)
501
+			for _, item := range infos {
502
+				result2, request2 = service.UploadPrescriptionForCoordinateHospital(item)
503
+				saveLog(result2, request2, "上传明细", "上传明细", org.OrgName)
504
+
505
+			}
448 506
 		}
449
-		saveLog(result2, request2, "上传明细", "上传明细", org.OrgName)
450 507
 
451 508
 		var res2 ResultUpload
452 509
 		if err := json.Unmarshal([]byte(result2), &res2); err != nil {
@@ -653,12 +710,12 @@ func saveLog(result string, request string, infno string, desc string, org_name
653 710
 
654 711
 }
655 712
 
656
-func RemoveRepeatedGroupElement(arr []int64) (newArr []int64) {
657
-	newArr = make([]int64, 0)
713
+func RemoveRepeatedGroupElement(arr []*GroupPrescription) (newArr []*GroupPrescription) {
714
+	newArr = make([]*GroupPrescription, 0)
658 715
 	for i := 0; i < len(arr); i++ {
659 716
 		repeat := false
660 717
 		for j := i + 1; j < len(arr); j++ {
661
-			if arr[i] == arr[j] {
718
+			if arr[i].GroupNo == arr[j].GroupNo && arr[i].PId == arr[j].PId {
662 719
 				repeat = true
663 720
 				break
664 721
 			}

+ 15 - 14
controllers/js/jsyb_controller.go View File

@@ -67,7 +67,7 @@ func (c *JSybController) Get3501() {
67 67
 		return
68 68
 	}
69 69
 
70
-	userJSONBytes, _ := json.Marshal(respJSON["config"])
70
+	userJSONBytes, _ := json.Marshal(respJSON["struct_3501s"])
71 71
 	var struct3501 []models.Struct3501
72 72
 	if err := json.Unmarshal(userJSONBytes, &struct3501); err != nil {
73 73
 		utils.ErrorLog("解析失败:%v", err)
@@ -99,7 +99,7 @@ func (c *JSybController) Get3502() {
99 99
 		return
100 100
 	}
101 101
 
102
-	userJSONBytes, _ := json.Marshal(respJSON["config"])
102
+	userJSONBytes, _ := json.Marshal(respJSON["struct_3502s"])
103 103
 	var struct3502s []models.Struct3502
104 104
 	if err := json.Unmarshal(userJSONBytes, &struct3502s); err != nil {
105 105
 		utils.ErrorLog("解析失败:%v", err)
@@ -107,7 +107,7 @@ func (c *JSybController) Get3502() {
107 107
 	}
108 108
 
109 109
 	result, request_log := service.Jsyb3502(struct3502s[0])
110
-	saveJsLog(result, request_log, "3501", "库存盘点", struct3502s[0].OrgName)
110
+	saveJsLog(result, request_log, "3502", "库存盘点", struct3502s[0].OrgName)
111 111
 	var dat2 map[string]interface{}
112 112
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
113 113
 	} else {
@@ -131,12 +131,13 @@ func (c *JSybController) Get3503() {
131 131
 		return
132 132
 	}
133 133
 
134
-	userJSONBytes, _ := json.Marshal(respJSON["config"])
134
+	userJSONBytes, _ := json.Marshal(respJSON["struct_3503s"])
135 135
 	var struct3503 models.Struct3503
136 136
 	if err := json.Unmarshal(userJSONBytes, &struct3503); err != nil {
137 137
 		utils.ErrorLog("解析失败:%v", err)
138 138
 		return
139 139
 	}
140
+	fmt.Println(struct3503)
140 141
 
141 142
 	result, request_log := service.Jsyb3503(struct3503)
142 143
 	saveJsLog(result, request_log, "3503", "库存采购", struct3503.OrgName)
@@ -163,7 +164,7 @@ func (c *JSybController) Get3504() {
163 164
 		return
164 165
 	}
165 166
 
166
-	userJSONBytes, _ := json.Marshal(respJSON["config"])
167
+	userJSONBytes, _ := json.Marshal(respJSON["struct_3504s"])
167 168
 	var struct3504 []models.Struct3504
168 169
 	if err := json.Unmarshal(userJSONBytes, &struct3504); err != nil {
169 170
 		utils.ErrorLog("解析失败:%v", err)
@@ -195,15 +196,15 @@ func (c *JSybController) Get3505() {
195 196
 		return
196 197
 	}
197 198
 
198
-	userJSONBytes, _ := json.Marshal(respJSON["config"])
199
-	var struct3505 []models.Struct3505
199
+	userJSONBytes, _ := json.Marshal(respJSON["struct_3505s"])
200
+	var struct3505 models.Struct3505
200 201
 	if err := json.Unmarshal(userJSONBytes, &struct3505); err != nil {
201 202
 		utils.ErrorLog("解析失败:%v", err)
202 203
 		return
203 204
 	}
204 205
 
205
-	result, request_log := service.Jsyb3505(struct3505[0])
206
-	saveJsLog(result, request_log, "3505", "库存盘点", struct3505[0].OrgName)
206
+	result, request_log := service.Jsyb3505(struct3505)
207
+	saveJsLog(result, request_log, "3505", "销售", struct3505.OrgName)
207 208
 	var dat2 map[string]interface{}
208 209
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
209 210
 	} else {
@@ -227,15 +228,15 @@ func (c *JSybController) Get3506() {
227 228
 		return
228 229
 	}
229 230
 
230
-	userJSONBytes, _ := json.Marshal(respJSON["config"])
231
-	var struct3506 []models.Struct3506
231
+	userJSONBytes, _ := json.Marshal(respJSON["struct_3506s"])
232
+	var struct3506 models.Struct3506
232 233
 	if err := json.Unmarshal(userJSONBytes, &struct3506); err != nil {
233 234
 		utils.ErrorLog("解析失败:%v", err)
234 235
 		return
235 236
 	}
236 237
 
237
-	result, request_log := service.Jsyb3506(struct3506[0])
238
-	saveJsLog(result, request_log, "3506", "库存盘点", struct3506[0].OrgName)
238
+	result, request_log := service.Jsyb3506(struct3506)
239
+	saveJsLog(result, request_log, "3506", "销售退库", struct3506.OrgName)
239 240
 	var dat2 map[string]interface{}
240 241
 	if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
241 242
 	} else {
@@ -259,7 +260,7 @@ func (c *JSybController) Get3507() {
259 260
 		return
260 261
 	}
261 262
 
262
-	userJSONBytes, _ := json.Marshal(respJSON["config"])
263
+	userJSONBytes, _ := json.Marshal(respJSON["struct_3507s"])
263 264
 	var struct3507 []models.Struct3507
264 265
 	if err := json.Unmarshal(userJSONBytes, &struct3507); err != nil {
265 266
 		utils.ErrorLog("解析失败:%v", err)

+ 134 - 11
controllers/sg/his_api_controller.go View File

@@ -431,6 +431,24 @@ func (c *HisApiController) Get9001() {
431 431
 
432 432
 	if miConfig.MdtrtareaAdmvs == "350500" {
433 433
 		service.GetFjAuthorizationInfo(miConfig.Code)
434
+	} else if miConfig.MdtrtareaAdmvs == "131023" {
435
+
436
+		result, _ := service.HeBeiyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
437
+
438
+		var dat map[string]interface{}
439
+		if err := json.Unmarshal([]byte(result), &dat); err == nil {
440
+			fmt.Println(dat)
441
+		} else {
442
+			fmt.Println(err)
443
+		}
444
+		userJSONBytes, _ := json.Marshal(dat)
445
+		var res models.Result9001
446
+		if err := json.Unmarshal(userJSONBytes, &res); err != nil {
447
+			utils.ErrorLog("解析失败:%v", err)
448
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
449
+			return
450
+		}
451
+
434 452
 	} else {
435 453
 		result, _ := service.Gdyb9001(miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, 1669)
436 454
 
@@ -2526,10 +2544,12 @@ func (c *HisApiController) ReadCard() {
2526 2544
 			id_card_str := strings.Split(SFZStr, "^")
2527 2545
 
2528 2546
 			card_no := id_card_str[0]
2529
-			name := id_card_str[1]
2547
+			patient, _ := service.GetPatientByNumber(card_no, c.GetAdminUserInfo().CurrentOrgId)
2530 2548
 
2531
-			name = ConvertToString(name, "gbk", "utf-8")
2532
-			result, _ := service.Hnyb1101(card_no, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", "1", miConfig.Url, miConfig.AccessKey, "", name, card_no)
2549
+			//name := id_card_str[1]
2550
+
2551
+			//name = ConvertToString(name, "gbk", "utf-8")
2552
+			result, _ := service.Hnyb1101(card_no, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", "1", miConfig.Url, miConfig.AccessKey, "", patient.Name, card_no)
2533 2553
 			var dat map[string]interface{}
2534 2554
 			if err := json.Unmarshal([]byte(result), &dat); err == nil {
2535 2555
 				fmt.Println(dat)
@@ -3690,12 +3710,12 @@ func (c *HisApiController) GetSFZBaseInfo() string {
3690 3710
 		readCard = DllDef.MustFindProc("ReadSFZ")
3691 3711
 	}
3692 3712
 
3693
-	str := make([]byte, 1024)
3694
-	str1 := make([]byte, 1024)
3695
-	r, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(4096), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(4096))
3713
+	str := make([]byte, 8096)
3714
+	str1 := make([]byte, 8096)
3715
+	r, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(8096), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(8096))
3696 3716
 
3697 3717
 	fmt.Println(r)
3698
-	return string(str)
3718
+	return Remove0000(string(str))
3699 3719
 }
3700 3720
 
3701 3721
 func (c *HisApiController) GetEleBaseInfo() string {
@@ -5096,14 +5116,14 @@ func (c *HisApiController) GetSettleListHospital() {
5096 5116
 }
5097 5117
 
5098 5118
 func (c *HisApiController) GetBatchSettleList() {
5099
-	orders, _ := service.GetAllHisOrder(10138)
5119
+	orders, _ := service.GetAllHisOrder(10106)
5100 5120
 	for _, item := range orders {
5101 5121
 		order_id := item.ID
5102 5122
 		order, _ := service.GetHisOrderByIDTwo(order_id)
5103 5123
 		roles, _ := service.GetDoctorListTwo(c.GetAdminUserInfo().CurrentOrgId)
5104 5124
 		his, _ := service.GetHisPatientByNumber(order.MdtrtId)
5105 5125
 		admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
5106
-		curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, 2185)
5126
+		curRoles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, 2495)
5107 5127
 		depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
5108 5128
 		miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
5109 5129
 
@@ -7241,6 +7261,66 @@ func (c *HisApiController) GetRegisterInfo() {
7241 7261
 
7242 7262
 			}
7243 7263
 
7264
+		} else if miConfig.MdtrtareaAdmvs == "131023" {
7265
+
7266
+			var result string
7267
+			var requestLog string
7268
+			result, requestLog = service.HeBeiyb1101(patient.IdCardNo, miConfig.OrgName, roles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, "", strconv.FormatInt(certificates, 10), "")
7269
+			if id_card_type == 4 {
7270
+				psn_info, _ := service.GetPsnByPatientId(id)
7271
+				PsnNo = psn_info.PsnNo
7272
+				PsnCertType = psn_info.PsnCertType
7273
+				Certno = psn_info.Certno
7274
+				PsnName = psn_info.PsnName
7275
+				Gend = psn_info.Gend
7276
+				Naty = psn_info.Naty
7277
+				Brdy = psn_info.Brdy
7278
+				Age = psn_info.Age
7279
+				infoStr = psn_info.Insuinfo
7280
+				idetinfoStr = psn_info.Idetinfo
7281
+				infocode = 0
7282
+				verify_number = psn_info.VerifyNumber
7283
+
7284
+			} else {
7285
+				saveLog(result, requestLog, "1101", "人员基本信息获取")
7286
+				if miConfig.Code == "H15049901371" {
7287
+
7288
+					if err := json.Unmarshal([]byte(result), &res10265); err != nil {
7289
+						utils.ErrorLog("解析失败:%v", err)
7290
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7291
+						return
7292
+					}
7293
+					res.ErrMsg = res10265.ErrMsg
7294
+					res.Output = res10265.Output
7295
+					res.InfRefmsgid = res10265.InfRefmsgid
7296
+
7297
+				} else {
7298
+					if err := json.Unmarshal([]byte(result), &res); err != nil {
7299
+						utils.ErrorLog("解析失败:%v", err)
7300
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7301
+						return
7302
+					}
7303
+				}
7304
+				PsnNo = res.Output.Baseinfo.PsnNo
7305
+				PsnCertType = res.Output.Baseinfo.PsnCertType
7306
+				Certno = res.Output.Baseinfo.Certno
7307
+				PsnName = res.Output.Baseinfo.PsnName
7308
+				Gend = res.Output.Baseinfo.Gend
7309
+				Naty = res.Output.Baseinfo.Naty
7310
+				Brdy = res.Output.Baseinfo.Brdy
7311
+				Age = res.Output.Baseinfo.Age
7312
+				Iinfos, _ := json.Marshal(res.Output.Iinfo)
7313
+				Idetinfos, _ := json.Marshal(res.Output.Idetinfo)
7314
+				infoStr = string(Iinfos)
7315
+				idetinfoStr = string(Idetinfos)
7316
+				if miConfig.Code == "H15049901371" {
7317
+					infocode, _ = strconv.ParseInt(res10265.Infcode, 10, 64)
7318
+				} else {
7319
+					infocode = res.Infcode
7320
+				}
7321
+
7322
+			}
7323
+
7244 7324
 		} else {
7245 7325
 
7246 7326
 			var result string
@@ -7666,6 +7746,35 @@ func (c *HisApiController) GetRegisterInfo() {
7666 7746
 					return
7667 7747
 				}
7668 7748
 				infocode = resThree.Infcode
7749
+			} else if miConfig.MdtrtareaAdmvs == "131023" {
7750
+				psn_info, _ := service.GetPsnByPatientId(id)
7751
+				result, requestLog := service.HeBeiyb2201A(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time, psn_info.VerifyNumber)
7752
+				saveLog(result, requestLog, "2201A", "挂号")
7753
+				if miConfig.Code == "H15049901371" {
7754
+
7755
+					if err := json.Unmarshal([]byte(result), &resThree10265); err != nil {
7756
+						utils.ErrorLog("解析失败:%v", err)
7757
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7758
+						return
7759
+					}
7760
+					resThree.ErrMsg = resThree10265.ErrMsg
7761
+					resThree.Output = resThree10265.Output
7762
+					resThree.InfRefmsgid = resThree10265.InfRefmsgid
7763
+				} else {
7764
+					if err := json.Unmarshal([]byte(result), &resThree); err != nil {
7765
+						utils.ErrorLog("解析失败:%v", err)
7766
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
7767
+						return
7768
+					}
7769
+				}
7770
+
7771
+				if miConfig.Code == "H15049901371" {
7772
+					infocode, _ = strconv.ParseInt(resThree10265.Infcode, 10, 64)
7773
+				} else {
7774
+					infocode = resThree.Infcode
7775
+
7776
+				}
7777
+
7669 7778
 			} else {
7670 7779
 				psn_info, _ := service.GetPsnByPatientId(id)
7671 7780
 				result, requestLog := service.Gdyb2201A(PsnNo, insutype, IdCardNo, miConfig.OrgName, roles.UserName, ipt_otp_no, department.Name, miConfig.Code, department.Number, doctor_info.DoctorNumber, insuplc_admdvs_temp, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, id_card_type, doctor_info.UserName, record_time, psn_info.VerifyNumber)
@@ -8238,6 +8347,12 @@ func (c *HisApiController) GetUploadInfo() {
8238 8347
 							return
8239 8348
 						}
8240 8349
 					}
8350
+					if miConfig.MdtrtareaAdmvs == "320921" {
8351
+						data["doctor_id"] = "D320923012139"
8352
+
8353
+					} else {
8354
+						data["doctor_id"] = "D371621008686"
8355
+					}
8241 8356
 					bytesData, _ := json.Marshal(data)
8242 8357
 					var req *http.Request
8243 8358
 					if miConfig.MdtrtareaAdmvs == "320921" {
@@ -8281,7 +8396,7 @@ func (c *HisApiController) GetUploadInfo() {
8281 8396
 
8282 8397
 				} else if miConfig.MdtrtareaAdmvs == "350500" {
8283 8398
 
8284
-					result, request_log, _ := service.FJyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, sickConfig.CountryCode)
8399
+					result, request_log, _ := service.FJyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, doctor_info.DoctorNumber, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, sickConfig.CountryCode, doctor_info.DoctorNumber)
8285 8400
 					var dat map[string]interface{}
8286 8401
 					if err := json.Unmarshal([]byte(result), &dat); err == nil {
8287 8402
 						fmt.Println(dat)
@@ -8415,6 +8530,9 @@ func (c *HisApiController) GetUploadInfo() {
8415 8530
 							advice_id = 0
8416 8531
 							project_id = id
8417 8532
 						}
8533
+						if item.MedChrgitmType == "9" {
8534
+							item.MedChrgitmType = "09"
8535
+						}
8418 8536
 
8419 8537
 						info := &models.HisOrderInfo{
8420 8538
 							OrderNumber:      order.Number,
@@ -10385,7 +10503,12 @@ func (c *HisApiController) GetPreUploadInfo() {
10385 10503
 						})
10386 10504
 						return
10387 10505
 					} else {
10506
+						if miConfig.MdtrtareaAdmvs == "320921" {
10507
+							data["doctor_id"] = "D320923012139"
10388 10508
 
10509
+						} else {
10510
+							data["doctor_id"] = "D371621008686"
10511
+						}
10389 10512
 						bytesData, _ := json.Marshal(data)
10390 10513
 						var req *http.Request
10391 10514
 						if miConfig.MdtrtareaAdmvs == "320921" {
@@ -10433,7 +10556,7 @@ func (c *HisApiController) GetPreUploadInfo() {
10433 10556
 
10434 10557
 			} else if miConfig.MdtrtareaAdmvs == "350500" {
10435 10558
 
10436
-				result, request_log, _ := service.FJyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, sickConfig.CountryCode)
10559
+				result, request_log, _ := service.FJyb2204(his.PsnNo, his.Number, prescriptions, chrg_bchno, miConfig.OrgName, roles.UserName, strconv.FormatInt(patientPrescription.Departments, 10), miConfig.Code, department.Number, strconv.FormatInt(roles.AdminUserId, 10), his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(his.BalanceAccountsType, 10), roles.UserName, miConfig.Url, miConfig.Code, miConfig.AppSecret, miConfig.SignKey, miConfig.EncKey, sickConfig.CountryCode, doctor_info.DoctorNumber)
10437 10560
 				var dat map[string]interface{}
10438 10561
 				if err := json.Unmarshal([]byte(result), &dat); err == nil {
10439 10562
 					fmt.Println(dat)

+ 7 - 2
controllers/zh/zh_his_api_controller.go View File

@@ -1518,10 +1518,15 @@ func (c *ZHHisApiController) GetZHInHospitalCheck() {
1518 1518
 
1519 1519
 				}
1520 1520
 			} else if med_type == 11 {
1521
-				struct2401.MedType = "11"
1521
+				struct2401.MedType = "21"
1522 1522
 			}
1523 1523
 		} else {
1524
-			struct2401.MedType = strconv.FormatInt(int64(med_type), 10)
1524
+			if med_type == 11 {
1525
+				struct2401.MedType = "21"
1526
+			} else {
1527
+				struct2401.MedType = strconv.FormatInt(int64(med_type), 10)
1528
+
1529
+			}
1525 1530
 		}
1526 1531
 		struct2401.IptNo = ipt_otp_no
1527 1532
 		struct2401.AtddrNo = doctorInfo.DoctorNumber

+ 2 - 7
main.go View File

@@ -1,19 +1,14 @@
1 1
 package main
2 2
 
3 3
 import (
4
-	//"github.com/qiniu/api.v7/auth/qbox"
5
-	//"github.com/qiniu/api.v7/storage"
6
-
7 4
 	_ "gdyb/routers"
8 5
 	"gdyb/service"
9 6
 
7
+	"github.com/astaxie/beego"
10 8
 	//"github.com/qiniu/api.v7/auth/qbox"
11 9
 	//"github.com/qiniu/api.v7/storage"
12
-
13 10
 	//"github.com/qiniu/roapi.v7/auth/qbox"
14 11
 	//"github.com/qiniu/api.v7/storage"
15
-
16
-	"github.com/astaxie/beego"
17 12
 	//"strconv"
18 13
 	//"time"
19 14
 )
@@ -30,7 +25,7 @@ func init() {
30 25
 
31 26
 }
32 27
 func main() {
33
-	service.BeginAutoCreateWeekSchedulesJob()
28
+	service.AutoCreateStock()
34 29
 	beego.Run()
35 30
 }
36 31
 

+ 6 - 6
models/drug.go View File

@@ -63,12 +63,12 @@ type BaseDrugLib struct {
63 63
 	HospApprFlag                int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
64 64
 	LmtUsedFlag                 int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
65 65
 
66
-	MinNumber int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
67
-	Dose      string  `gorm:"column:dose" json:"dose" form:"dose"`
68
-	DoseUnit  string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
69
-	DrugDay   string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
70
-	MinPrice  float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
71
-	IsUser    int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
66
+	MinNumber int64 `gorm:"column:min_number" json:"min_number" form:"min_number"`
67
+	//Dose      string  `gorm:"column:dose" json:"dose" form:"dose"`
68
+	DoseUnit string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
69
+	DrugDay  string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
70
+	MinPrice float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
71
+	IsUser   int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
72 72
 
73 73
 	//MedicineInsurancePercentage []*MedicineInsurancePercentage `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"monitoring_record"`
74 74
 }

+ 3 - 3
models/drug_stock.go View File

@@ -65,7 +65,7 @@ type DrugWarehouseOut struct {
65 65
 	Type                    int64         `gorm:"column:type" json:"type" form:"type"`
66 66
 	IsSys                   int64         `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
67 67
 	Manufacturers           *Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
68
-	Dealers                 *Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
68
+	Dealers                 *Dealers      `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
69 69
 }
70 70
 
71 71
 func (DrugWarehouseOut) TableName() string {
@@ -117,7 +117,7 @@ type DrugSalesReturn struct {
117 117
 	Dealer        int64         `gorm:"column:dealer" json:"dealer" form:"dealer"`
118 118
 	Type          int64         `gorm:"column:type" json:"type" form:"type"`
119 119
 	Manufacturers *Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
120
-	Dealers       *Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
120
+	Dealers       *Dealers      `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
121 121
 }
122 122
 
123 123
 func (DrugSalesReturn) TableName() string {
@@ -165,7 +165,7 @@ type DrugCancelStock struct {
165 165
 	Manufacturer  int64         `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
166 166
 	Type          int64         `gorm:"column:type" json:"type" form:"type"`
167 167
 	Manufacturers *Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
168
-	Dealers       *Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
168
+	Dealers       *Dealers      `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
169 169
 }
170 170
 
171 171
 func (DrugCancelStock) TableName() string {

+ 1 - 0
models/good_models.go View File

@@ -72,6 +72,7 @@ type GoodInfo struct {
72 72
 	GoodsType          GoodsType `gorm:"ForeignKey:ID;AssociationForeignKey:GoodTypeId" json:"type"`
73 73
 	IsUser             int64     `gorm:"column:is_user" json:"is_user" form:"is_user"`
74 74
 	PackingUnit        string    `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
75
+	Number             string    `gorm:"column:number" json:"number" form:"number"`
75 76
 }
76 77
 
77 78
 func (GoodInfo) TableName() string {

+ 3 - 3
models/his_models.go View File

@@ -1646,8 +1646,8 @@ type UploadInfo struct {
1646 1646
 	Diag     []*Diag
1647 1647
 	Fasong   string `json:"fasong"`
1648 1648
 	PresInfo []*PresInfo
1649
-	Vaa01    int `json:"vaa01"`
1650
-	Vaa07    int `json:"vaa07"`
1649
+	Vaa01    int64 `json:"vaa01"`
1650
+	Vaa07    int64 `json:"vaa07"`
1651 1651
 }
1652 1652
 
1653 1653
 type Diag struct {
@@ -1679,7 +1679,7 @@ type Item struct {
1679 1679
 	Vaf14  string `json:"vaf14"`
1680 1680
 	Vaf15  string `json:"vaf15"`
1681 1681
 	Vaf17  string `json:"vaf17"`
1682
-	Vaf18  int    `json:"vaf18"`
1682
+	Vaf18  string `json:"vaf18"`
1683 1683
 	Vaf19  string `json:"vaf19"`
1684 1684
 	Vaf20  string `json:"vaf20"`
1685 1685
 	Vaf21  string `json:"vaf21"`

+ 38 - 36
models/new_stock_models.go View File

@@ -14,7 +14,7 @@ type NewWarehousing struct {
14 14
 	Dealer            int64        `gorm:"column:dealer" json:"dealer"`
15 15
 	Manufacturer      int64        `gorm:"column:manufacturer" json:"manufacturer"`
16 16
 	Manufacturers     Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
17
-	Dealers           Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
17
+	Dealers           Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
18 18
 	Type              int64        `gorm:"column:type" json:"type"`
19 19
 	SupplyWarehouseId int64        `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
20 20
 	StorehouseId      int64        `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
@@ -59,7 +59,7 @@ type NewWarehousingInfo struct {
59 59
 	SecondWarehouseInfoId int64        `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
60 60
 	GoodInfo              GoodInfo     `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" json:"infos"`
61 61
 	Manufacturers         Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
62
-	Dealers               Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
62
+	Dealers               Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
63 63
 }
64 64
 
65 65
 func (NewWarehousingInfo) TableName() string {
@@ -81,7 +81,7 @@ type NewWarehouseOut struct {
81 81
 	Dealer                  int64        `gorm:"column:dealer" json:"dealer"`
82 82
 	Manufacturer            int64        `gorm:"column:manufacturer" json:"manufacturer"`
83 83
 	Manufacturers           Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
84
-	Dealers                 Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
84
+	Dealers                 Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
85 85
 	Type                    int64        `gorm:"column:type" json:"type"`
86 86
 	IsSys                   int64        `gorm:"column:is_sys" json:"is_sys"`
87 87
 	SupplyCancelOutId       int64        `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
@@ -139,7 +139,7 @@ type NewWarehouseOutInfo struct {
139 139
 	VmStockFlow             VmStockFlow     `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseOutDetailId" json:"stock_flow"`
140 140
 	OverCount               int64           `gorm:"column:over_count" json:"over_count" form:"over_count"`
141 141
 	Manufacturers           Manufacturer    `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
142
-	Dealers                 Dealer          `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
142
+	Dealers                 Dealers         `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
143 143
 }
144 144
 
145 145
 func (NewWarehouseOutInfo) TableName() string {
@@ -196,7 +196,7 @@ type NewCancelStockInfo struct {
196 196
 	IsCheck         int64        `gorm:"column:is_check" json:"is_check" form:"is_check"`
197 197
 	GoodInfo        GoodInfo     `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" json:"info"`
198 198
 	Manufacturers   Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
199
-	Dealers         Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
199
+	Dealers         Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
200 200
 }
201 201
 
202 202
 func (NewCancelStockInfo) TableName() string {
@@ -247,7 +247,7 @@ type NewDrugWarehouseInfo struct {
247 247
 	RetailTotalPrice float64      `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
248 248
 	BaseDrugLib      BaseDrugLib  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
249 249
 	Manufacturers    Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
250
-	Dealers          Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
250
+	Dealers          Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
251 251
 
252 252
 	BatchNumber               string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
253 253
 	MaxUnit                   string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
@@ -283,7 +283,7 @@ type NewDrugWarehouseOut struct {
283 283
 	Type                    int64         `gorm:"column:type" json:"type" form:"type"`
284 284
 	IsSys                   int64         `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
285 285
 	Manufacturers           *Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
286
-	Dealers                 *Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
286
+	Dealers                 *Dealers      `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
287 287
 }
288 288
 
289 289
 func (NewDrugWarehouseOut) TableName() string {
@@ -291,33 +291,35 @@ func (NewDrugWarehouseOut) TableName() string {
291 291
 }
292 292
 
293 293
 type NewDrugWarehouseOutInfo struct {
294
-	ID                      int64        `gorm:"column:id" json:"id" form:"id"`
295
-	WarehouseOutId          int64        `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
296
-	DrugId                  int64        `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
297
-	WarehousingOutTarget    int64        `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
298
-	Count                   int64        `gorm:"column:count" json:"count" form:"count"`
299
-	Price                   float64      `gorm:"column:price" json:"price" form:"price"`
300
-	TotalPrice              float64      `gorm:"column:total_price" json:"total_price" form:"total_price"`
301
-	ProductDate             int64        `gorm:"column:product_date" json:"product_date" form:"product_date"`
302
-	ExpiryDate              int64        `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
303
-	Mtime                   int64        `gorm:"column:mtime" json:"mtime" form:"mtime"`
304
-	Ctime                   int64        `gorm:"column:ctime" json:"ctime" form:"ctime"`
305
-	Status                  int64        `gorm:"column:status" json:"status" form:"status"`
306
-	OrgId                   int64        `gorm:"column:org_id" json:"org_id" form:"org_id"`
307
-	Remark                  string       `gorm:"column:remark" json:"remark" form:"remark"`
308
-	IsCancel                int64        `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
309
-	WarehouseOutOrderNumber string       `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
310
-	Type                    int64        `gorm:"column:type" json:"type" form:"type"`
311
-	Dealer                  int64        `gorm:"column:dealer" json:"dealer" form:"dealer"`
312
-	Manufacturer            int64        `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
313
-	IsSys                   int64        `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
314
-	SysRecordTime           int64        `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
315
-	RetailPrice             float64      `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
316
-	RetailTotalPrice        float64      `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
317
-	BaseDrugLib             BaseDrugLib  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
318
-	Manufacturers           Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
319
-	Dealers                 Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
320
-	BatchNumber             string       `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
294
+	ID                      int64                `gorm:"column:id" json:"id" form:"id"`
295
+	WarehouseOutId          int64                `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
296
+	DrugId                  int64                `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
297
+	WarehousingOutTarget    int64                `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
298
+	Count                   int64                `gorm:"column:count" json:"count" form:"count"`
299
+	Price                   float64              `gorm:"column:price" json:"price" form:"price"`
300
+	TotalPrice              float64              `gorm:"column:total_price" json:"total_price" form:"total_price"`
301
+	ProductDate             int64                `gorm:"column:product_date" json:"product_date" form:"product_date"`
302
+	ExpiryDate              int64                `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
303
+	Mtime                   int64                `gorm:"column:mtime" json:"mtime" form:"mtime"`
304
+	Ctime                   int64                `gorm:"column:ctime" json:"ctime" form:"ctime"`
305
+	Status                  int64                `gorm:"column:status" json:"status" form:"status"`
306
+	OrgId                   int64                `gorm:"column:org_id" json:"org_id" form:"org_id"`
307
+	Remark                  string               `gorm:"column:remark" json:"remark" form:"remark"`
308
+	IsCancel                int64                `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
309
+	WarehouseOutOrderNumber string               `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
310
+	Type                    int64                `gorm:"column:type" json:"type" form:"type"`
311
+	Dealer                  int64                `gorm:"column:dealer" json:"dealer" form:"dealer"`
312
+	Manufacturer            int64                `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
313
+	IsSys                   int64                `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
314
+	SysRecordTime           int64                `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
315
+	RetailPrice             float64              `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
316
+	RetailTotalPrice        float64              `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
317
+	BaseDrugLib             BaseDrugLib          `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
318
+	Manufacturers           Manufacturer         `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
319
+	Dealers                 Dealers              `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
320
+	BatchNumber             string               `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
321
+	WarehouseInfoId         int64                `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
322
+	NewDrugWarehouseInfo    NewDrugWarehouseInfo `gorm:"ForeignKey:ID;AssociationForeignKey:WarehouseInfoId" json:"in_info"`
321 323
 }
322 324
 
323 325
 func (NewDrugWarehouseOutInfo) TableName() string {
@@ -339,7 +341,7 @@ type NewDrugCancelStock struct {
339 341
 	Manufacturer  int64         `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
340 342
 	Type          int64         `gorm:"column:type" json:"type" form:"type"`
341 343
 	Manufacturers *Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
342
-	Dealers       *Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
344
+	Dealers       *Dealers      `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
343 345
 }
344 346
 
345 347
 func (NewDrugCancelStock) TableName() string {
@@ -368,7 +370,7 @@ type NewDrugCancelStockInfo struct {
368 370
 	Number           string       `gorm:"column:number" json:"number" form:"number"`
369 371
 	BaseDrugLib      BaseDrugLib  `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
370 372
 	Manufacturers    Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
371
-	Dealers          Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
373
+	Dealers          Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
372 374
 	BatchNumber      string       `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
373 375
 }
374 376
 

+ 5 - 5
models/stock_models.go View File

@@ -24,7 +24,7 @@ func (Manufacturer) TableName() string {
24 24
 	return "xt_manufacturer"
25 25
 }
26 26
 
27
-type Dealer struct {
27
+type Dealers struct {
28 28
 	ID             int64  `gorm:"column:id" json:"id"`
29 29
 	DealerName     string `gorm:"column:dealer_name" json:"dealer_name"`
30 30
 	Contact        string `gorm:"column:contact" json:"contact"`
@@ -44,7 +44,7 @@ type Dealer struct {
44 44
 	WuBi           string `gorm:"column:wubi" json:"wubi"`
45 45
 }
46 46
 
47
-func (Dealer) TableName() string {
47
+func (Dealers) TableName() string {
48 48
 	return "xt_dealer"
49 49
 }
50 50
 
@@ -62,7 +62,7 @@ type Warehousing struct {
62 62
 	Dealer            int64        `gorm:"column:dealer" json:"dealer"`
63 63
 	Manufacturer      int64        `gorm:"column:manufacturer" json:"manufacturer"`
64 64
 	Manufacturers     Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
65
-	Dealers           Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
65
+	Dealers           Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
66 66
 	Type              int64        `gorm:"column:type" json:"type"`
67 67
 	SupplyWarehouseId int64        `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
68 68
 	StorehouseId      int64        `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
@@ -211,7 +211,7 @@ type WarehouseOut struct {
211 211
 	Dealer                  int64        `gorm:"column:dealer" json:"dealer"`
212 212
 	Manufacturer            int64        `gorm:"column:manufacturer" json:"manufacturer"`
213 213
 	Manufacturers           Manufacturer `gorm:"ForeignKey:ID;AssociationForeignKey:Manufacturer" json:"Manufacturer"`
214
-	Dealers                 Dealer       `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
214
+	Dealers                 Dealers      `gorm:"ForeignKey:ID;AssociationForeignKey:Dealer" json:"Dealer"`
215 215
 	Type                    int64        `gorm:"column:type" json:"type"`
216 216
 	IsSys                   int64        `gorm:"column:is_sys" json:"is_sys"`
217 217
 	SupplyCancelOutId       int64        `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
@@ -399,7 +399,7 @@ type WarehousingGoodInfo struct {
399 399
 	Status            int64        `gorm:"column:status" json:"status"`
400 400
 	GoodsType         GoodsType    `gorm:"ForeignKey:ID;AssociationForeignKey:GoodTypeId" json:"type"`
401 401
 	Manufacturers     Manufacturer `gorm:"ForeignKey:Manufacturer;AssociationForeignKey:ID" json:"manufacturers"`
402
-	Dealers           Dealer       `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
402
+	Dealers           Dealers      `gorm:"ForeignKey:Dealer;AssociationForeignKey:ID" json:"dealers"`
403 403
 	BuyPrice          float64      `gorm:"column:buy_price" json:"buy_price"`
404 404
 	Total             float64      `gorm:"column:total" json:"total" form:"total"`
405 405
 	RegisterNumber    string       `gorm:"column:register_number" json:"register_number" form:"register_number"`

+ 169 - 113
service/auto_create_week_schedules_service.go View File

@@ -3,6 +3,7 @@ package service
3 3
 import (
4 4
 	"bytes"
5 5
 	"encoding/json"
6
+	"fmt"
6 7
 	"gdyb/models"
7 8
 	"gdyb/utils"
8 9
 	"github.com/astaxie/beego"
@@ -68,13 +69,17 @@ func AutoCreateStock() {
68 69
 	var NewDrugWarehouseOut []*models.NewDrugWarehouseOutInfo
69 70
 	var NewDrugCancelStock []*models.NewDrugCancelStockInfo
70 71
 
71
-	readDb.Model(&models.NewWarehousingInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehousing)
72
-	readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
73
-	readDb.Model(&models.NewCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
72
+	//readDb.Model(&models.NewWarehousingInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).First(&NewWarehousing)
73
+	//readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut)
74
+	//readDb.Model(&models.NewCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock)
74 75
 
75
-	readDb.Model(&models.NewDrugWarehouseInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
76
-	readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
77
-	readDb.Model(&models.NewDrugCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
76
+	//readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 4778", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
77
+	//readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 360136", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
78
+	//readDb.Model(&models.NewDrugCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1 AND id >= 4778", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
79
+
80
+	//readDb.Model(&models.NewDrugWarehouseInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 5720", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse)
81
+	//readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 AND id >= 366003", org_id).Preload("NewDrugWarehouseInfo","status = 1").Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut)
82
+	//readDb.Model(&models.NewDrugCancelStockInfo{}).Where("org_id = ? and status = 1 and is_upload <> 1 ", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock)
78 83
 
79 84
 	for _, item := range NewWarehousing {
80 85
 		res := Post3503ForGoodInfo(org_id, item)
@@ -149,7 +154,7 @@ func AutoCreateStock() {
149 154
 
150 155
 //采购
151 156
 func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultSix {
152
-
157
+	fmt.Println(&infos)
153 158
 	var res ResultSix
154 159
 	miConfig, _ := FindMedicalInsuranceInfo(org_id)
155 160
 	data := make(map[string]interface{})
@@ -157,32 +162,48 @@ func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultS
157 162
 	var struct3503 models.Struct3503
158 163
 	struct3503.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
159 164
 	struct3503.FixmedinsHilistId = miConfig.Code
165
+	struct3503.FixmedinsCode = miConfig.Code
160 166
 	struct3503.FixmedinsHilistName = miConfig.OrgName
161 167
 	struct3503.FixmedinsBchno = infos.Number
162
-	struct3503.SplerName = infos.Dealers.DealerName
168
+	var d models.Dealers
169
+	readDb.Model(&models.Dealers{}).Where("id = ?", infos.Dealer).First(&d)
170
+	if d.ID == 0 {
171
+		struct3503.SplerName = infos.Manufacturers.ManufacturerName
172
+	} else {
173
+		struct3503.SplerName = d.DealerName
174
+	}
163 175
 	struct3503.ManuLotnum = infos.Number
164 176
 	struct3503.ProdentpName = infos.Manufacturers.ManufacturerName
165
-	struct3503.Aprvno = infos.LicenseNumber
166
-	struct3503.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
167
-	struct3503.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
177
+	struct3503.Aprvno = infos.GoodInfo.Number
178
+	struct3503.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02")
179
+	struct3503.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02")
168 180
 	struct3503.PurcRetnCnt = strconv.FormatInt(infos.TotalCount, 10)
169 181
 	struct3503.RxFlag = "0"
170
-	struct3503.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
171
-	struct3503.PurcRetnOpterName = "仓管员"
182
+	struct3503.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02")
183
+	if org_id == 10217 {
184
+		struct3503.PurcRetnOpterName = "施实芹"
185
+	} else {
186
+		struct3503.PurcRetnOpterName = ""
187
+	}
172 188
 	struct3503.OrgName = miConfig.OrgName
173 189
 	struct3503.AccessKey = miConfig.AccessKey
174 190
 	struct3503.RequestUrl = miConfig.Url
175 191
 	struct3503.SecretKey = miConfig.SecretKey
192
+	struct3503.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
193
+	struct3503.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
176 194
 	struct3503.Memo = ""
177 195
 	struct3503s = append(struct3503s, struct3503)
178
-	data["struct_3501s"] = struct3503s
196
+	data["struct_3503s"] = struct3503s[0]
197
+
179 198
 	client := &http.Client{}
180 199
 	bytesData, _ := json.Marshal(data)
200
+	fmt.Println(string(bytesData))
181 201
 	var req *http.Request
182 202
 
183 203
 	if miConfig.MdtrtareaAdmvs == "320921" {
184 204
 		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
185 205
 	} else {
206
+		fmt.Println("111111")
186 207
 		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3503", bytes.NewReader(bytesData))
187 208
 	}
188 209
 
@@ -223,29 +244,37 @@ func Post3503ForDrug(org_id int64, infos *models.NewDrugWarehouseInfo) ResultSix
223 244
 	var res ResultSix
224 245
 	miConfig, _ := FindMedicalInsuranceInfo(org_id)
225 246
 	data := make(map[string]interface{})
226
-	var struct3501s []models.Struct3503
227
-	var struct3501 models.Struct3503
228
-	struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
229
-	struct3501.FixmedinsHilistId = miConfig.Code
230
-	struct3501.FixmedinsHilistName = miConfig.OrgName
231
-	struct3501.FixmedinsBchno = infos.BatchNumber
232
-	struct3501.SplerName = infos.Dealers.DealerName
233
-	struct3501.ManuLotnum = infos.BatchNumber
234
-	struct3501.ProdentpName = infos.Manufacturers.ManufacturerName
235
-	struct3501.Aprvno = infos.BaseDrugLib.Number
236
-	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
237
-	struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
238
-	struct3501.PurcRetnCnt = strconv.FormatInt(infos.WarehousingCount, 10)
239
-	struct3501.RxFlag = "0"
240
-	struct3501.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
241
-	struct3501.PurcRetnOpterName = "仓管员"
242
-	struct3501.OrgName = miConfig.OrgName
243
-	struct3501.AccessKey = miConfig.AccessKey
244
-	struct3501.RequestUrl = miConfig.Url
245
-	struct3501.SecretKey = miConfig.SecretKey
246
-	struct3501.Memo = ""
247
-	struct3501s = append(struct3501s, struct3501)
248
-	data["struct_3501s"] = struct3501s
247
+	var struct3503s []models.Struct3503
248
+	var struct3503 models.Struct3503
249
+	struct3503.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
250
+	struct3503.FixmedinsHilistId = miConfig.Code
251
+	struct3503.FixmedinsHilistName = miConfig.OrgName
252
+	struct3503.FixmedinsBchno = infos.BatchNumber
253
+	var d models.Dealers
254
+	readDb.Model(&models.Dealers{}).Where("id = ?", infos.Dealer).First(&d)
255
+	struct3503.SplerName = d.DealerName
256
+	struct3503.ManuLotnum = infos.BatchNumber
257
+	struct3503.ProdentpName = infos.Manufacturers.ManufacturerName
258
+	struct3503.Aprvno = infos.BaseDrugLib.Number
259
+	struct3503.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
260
+	struct3503.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
261
+	struct3503.PurcRetnCnt = strconv.FormatInt(infos.WarehousingCount, 10)
262
+	struct3503.RxFlag = "0"
263
+	struct3503.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
264
+	if org_id == 10217 {
265
+		struct3503.PurcRetnOpterName = "施实芹"
266
+	} else {
267
+		struct3503.PurcRetnOpterName = "顾林玲"
268
+	}
269
+	struct3503.OrgName = miConfig.OrgName
270
+	struct3503.AccessKey = miConfig.AccessKey
271
+	struct3503.RequestUrl = miConfig.Url
272
+	struct3503.SecretKey = miConfig.SecretKey
273
+	struct3503.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
274
+	struct3503.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
275
+	struct3503.Memo = ""
276
+	struct3503s = append(struct3503s, struct3503)
277
+	data["struct_3503s"] = struct3503s[0]
249 278
 	client := &http.Client{}
250 279
 	bytesData, _ := json.Marshal(data)
251 280
 	var req *http.Request
@@ -384,46 +413,57 @@ func Post3505ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) Result
384 413
 
385 414
 	miConfig, _ := FindMedicalInsuranceInfo(org_id)
386 415
 	data := make(map[string]interface{})
387
-	var struct3501s []models.Struct3505
388
-	var struct3501 models.Struct3505
389
-
390
-	struct3501.OrgName = miConfig.OrgName
391
-	struct3501.AccessKey = miConfig.AccessKey
392
-	struct3501.RequestUrl = miConfig.Url
393
-	struct3501.SecretKey = miConfig.SecretKey
394
-
395
-	struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
396
-	struct3501.FixmedinsHilistId = miConfig.Code
397
-	struct3501.FixmedinsHilistName = miConfig.OrgName
398
-	struct3501.FixmedinsBchno = infos.BatchNumber
416
+	var struct3505s []models.Struct3505
417
+	var struct3505 models.Struct3505
418
+	struct3505.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
419
+	struct3505.FixmedinsHilistId = miConfig.Code
420
+	struct3505.FixmedinsHilistName = miConfig.OrgName
421
+	struct3505.FixmedinsBchno = infos.NewDrugWarehouseInfo.BatchNumber
422
+	struct3505.FixmedinsCode = miConfig.Code
423
+
424
+	struct3505.OrgName = miConfig.OrgName
425
+	struct3505.AccessKey = miConfig.AccessKey
426
+	struct3505.RequestUrl = miConfig.Url
427
+	struct3505.SecretKey = miConfig.SecretKey
428
+	struct3505.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
429
+	struct3505.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
430
+
431
+	struct3505.FixmedinsBchno = infos.NewDrugWarehouseInfo.BatchNumber
399 432
 	if org_id == 10188 {
400
-		struct3501.PrscDrName = "王曙光"
401
-		struct3501.PharName = "王曙光"
402
-		struct3501.PharPracCertNo = ""
433
+		struct3505.PrscDrName = "王曙光"
434
+		struct3505.PharName = "顾林玲"
435
+		struct3505.PharPracCertNo = "K0404020449"
403 436
 
404 437
 	} else if org_id == 10217 {
405
-		struct3501.PrscDrName = "王云刚"
406
-		struct3501.PharName = "王云刚"
407
-		struct3501.PharPracCertNo = ""
438
+		struct3505.PrscDrName = "王云刚"
439
+		struct3505.PharName = "施实芹"
440
+		struct3505.PharPracCertNo = "1532050832051512010002"
408 441
 	}
409 442
 	timestamp := time.Now().Unix()
410 443
 	tempTime := time.Unix(timestamp, 0)
411 444
 	timeFormat := tempTime.Format("20060102150405")
412 445
 	chrgBchno := rand.Intn(100000) + 10000
413 446
 	ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
414
-	struct3501.MdtrtSn = ipt_otp_no
415
-	struct3501.ManuLotnum = infos.BatchNumber
416
-	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
417
-	struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
418
-	struct3501.RxFlag = "0"
419
-	struct3501.TrdnFlag = "1"
420
-	struct3501.RtalDocno = strconv.FormatInt(int64(infos.ID), 10)
421
-	struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
422
-	struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
423
-	struct3501.SelRetnOpterName = "仓管员"
447
+	struct3505.MdtrtSn = ipt_otp_no
448
+	struct3505.ManuLotnum = infos.NewDrugWarehouseInfo.BatchNumber
449
+	struct3505.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
450
+	//struct3505.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
451
+	struct3505.RxFlag = "0"
452
+	struct3505.TrdnFlag = "1"
453
+	struct3505.RtalDocno = strconv.FormatInt(int64(infos.ID), 10)
454
+	struct3505.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
455
+	struct3505.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
424 456
 
425
-	struct3501s = append(struct3501s, struct3501)
426
-	data["struct_3501s"] = struct3501s
457
+	if org_id == 10188 {
458
+		struct3505.SelRetnOpterName = "孙欣欣"
459
+
460
+	} else if org_id == 10217 {
461
+		struct3505.SelRetnOpterName = "晁海燕"
462
+
463
+	}
464
+
465
+	struct3505s = append(struct3505s, struct3505)
466
+	data["struct_3505s"] = struct3505s[0]
427 467
 	client := &http.Client{}
428 468
 	bytesData, _ := json.Marshal(data)
429 469
 	var req *http.Request
@@ -473,37 +513,44 @@ func Post3506ForGoodInfo(org_id int64, infos *models.NewCancelStockInfo) ResultS
473 513
 	var res ResultSix
474 514
 	miConfig, _ := FindMedicalInsuranceInfo(org_id)
475 515
 	data := make(map[string]interface{})
476
-	var struct3501s []models.Struct3506
477
-	var struct3501 models.Struct3506
478
-
479
-	struct3501.OrgName = miConfig.OrgName
480
-	struct3501.AccessKey = miConfig.AccessKey
481
-	struct3501.RequestUrl = miConfig.Url
482
-	struct3501.SecretKey = miConfig.SecretKey
483
-	struct3501.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
484
-	struct3501.FixmedinsHilistId = miConfig.Code
485
-	struct3501.FixmedinsHilistName = miConfig.OrgName
486
-	struct3501.FixmedinsBchno = infos.Number
487
-	struct3501.ManuLotnum = infos.Number
488
-	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
516
+	var struct3506s []models.Struct3506
517
+	var struct3506 models.Struct3506
518
+
519
+	struct3506.OrgName = miConfig.OrgName
520
+	struct3506.AccessKey = miConfig.AccessKey
521
+	struct3506.RequestUrl = miConfig.Url
522
+	struct3506.SecretKey = miConfig.SecretKey
523
+	struct3506.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
524
+	struct3506.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
525
+	struct3506.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber
526
+	struct3506.FixmedinsHilistId = miConfig.Code
527
+	struct3506.FixmedinsHilistName = miConfig.OrgName
528
+	struct3506.FixmedinsBchno = infos.Number
529
+	struct3506.ManuLotnum = infos.Number
530
+	struct3506.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
489 531
 	//struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
490
-	struct3501.RxFlag = "0"
491
-	struct3501.TrdnFlag = "1"
492
-	struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
493
-	struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
494
-	struct3501.SelRetnOpterName = "仓管员"
495
-	struct3501.Memo = ""
532
+	struct3506.RxFlag = "0"
533
+	struct3506.TrdnFlag = "1"
534
+	struct3506.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
535
+	struct3506.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
536
+	//struct3506.SelRetnOpterName = "仓管员"
537
+	if org_id == 10188 {
538
+		struct3506.SelRetnOpterName = "孙欣欣"
539
+	} else if org_id == 10217 {
540
+		struct3506.SelRetnOpterName = "晁海燕"
541
+	}
542
+	struct3506.Memo = ""
496 543
 
497
-	struct3501s = append(struct3501s, struct3501)
498
-	data["struct_3501s"] = struct3501s
544
+	struct3506s = append(struct3506s, struct3506)
545
+	data["struct_3506s"] = struct3506s
499 546
 	client := &http.Client{}
500 547
 	bytesData, _ := json.Marshal(data)
501 548
 	var req *http.Request
502 549
 
503 550
 	if miConfig.MdtrtareaAdmvs == "320921" {
504
-		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
551
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
505 552
 	} else {
506
-		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
553
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
507 554
 	}
508 555
 
509 556
 	resp, _ := client.Do(req)
@@ -541,37 +588,46 @@ func Post3506ForGoodInfo(org_id int64, infos *models.NewCancelStockInfo) ResultS
541 588
 }
542 589
 func Post3506ForDrug(org_id int64, infos *models.NewDrugCancelStockInfo) ResultSix {
543 590
 	var res ResultSix
544
-
545 591
 	miConfig, _ := FindMedicalInsuranceInfo(org_id)
546 592
 	data := make(map[string]interface{})
547
-	var struct3501s []models.Struct3506
548
-	var struct3501 models.Struct3506
549
-	struct3501.OrgName = miConfig.OrgName
550
-	struct3501.AccessKey = miConfig.AccessKey
551
-	struct3501.RequestUrl = miConfig.Url
552
-	struct3501.SecretKey = miConfig.SecretKey
553
-	struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
554
-	struct3501.FixmedinsHilistId = miConfig.Code
555
-	struct3501.FixmedinsHilistName = miConfig.OrgName
556
-	struct3501.FixmedinsBchno = infos.BatchNumber
557
-	struct3501.ManuLotnum = infos.BatchNumber
558
-	struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
559
-	struct3501.RxFlag = "0"
560
-	struct3501.TrdnFlag = "1"
561
-	struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
562
-	struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
563
-	struct3501.SelRetnOpterName = "仓管员"
564
-	struct3501.Memo = ""
565
-	struct3501s = append(struct3501s, struct3501)
566
-	data["struct_3501s"] = struct3501s
593
+	var struct3506s []models.Struct3506
594
+	var struct3506 models.Struct3506
595
+	struct3506.FixmedinsCode = miConfig.Code
596
+	struct3506.OrgName = miConfig.OrgName
597
+	struct3506.AccessKey = miConfig.AccessKey
598
+	struct3506.RequestUrl = miConfig.Url
599
+	struct3506.SecretKey = miConfig.SecretKey
600
+	struct3506.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
601
+	struct3506.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
602
+	struct3506.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber
603
+	struct3506.FixmedinsHilistId = miConfig.Code
604
+	struct3506.FixmedinsHilistName = miConfig.OrgName
605
+	struct3506.FixmedinsBchno = infos.BatchNumber
606
+	struct3506.ManuLotnum = infos.BatchNumber
607
+	struct3506.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05")
608
+	//struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05")
609
+	struct3506.RxFlag = "0"
610
+	struct3506.TrdnFlag = "1"
611
+	struct3506.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10)
612
+	struct3506.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05")
613
+	//struct3506.SelRetnOpterName = "仓管员"
614
+	if org_id == 10188 {
615
+		struct3506.SelRetnOpterName = "孙欣欣"
616
+	} else if org_id == 10217 {
617
+		struct3506.SelRetnOpterName = "晁海燕"
618
+	}
619
+	struct3506.Memo = ""
620
+
621
+	struct3506s = append(struct3506s, struct3506)
622
+	data["struct_3506s"] = struct3506s[0]
567 623
 	client := &http.Client{}
568 624
 	bytesData, _ := json.Marshal(data)
569 625
 	var req *http.Request
570 626
 
571 627
 	if miConfig.MdtrtareaAdmvs == "320921" {
572
-		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
628
+		req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
573 629
 	} else {
574
-		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData))
630
+		req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3506", bytes.NewReader(bytesData))
575 631
 	}
576 632
 
577 633
 	resp, _ := client.Do(req)

+ 101 - 2
service/coordinate_service.go View File

@@ -121,7 +121,7 @@ func UploadPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
121 121
 	for _, item := range info.PresInfo {
122 122
 		inputDataPresInfo := make(map[string]interface{})
123 123
 		inputDataPresInfo["cbm06"] = item.Cbm06
124
-		inputDataPresInfo["cbm07"] = item.Cbm06
124
+		inputDataPresInfo["cbm07"] = item.Cbm07
125 125
 		inputDataPresInfo["cbmid"] = item.Cbmid
126 126
 		presDetails := make([]map[string]interface{}, 0)
127 127
 
@@ -291,7 +291,7 @@ func UploadPrescriptionForCoordinateHospital(info models.UploadInfo) (string, st
291 291
 	}
292 292
 	reader := bytes.NewReader(bytesData)
293 293
 	var url string
294
-	gdyb_url := "http://218.104.146.179:9091/esb/listener/saveOrdInfoIp"
294
+	gdyb_url := "http://218.104.146.179:90911/esb/listener/saveOrdInfoIp"
295 295
 	url = gdyb_url
296 296
 
297 297
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
@@ -326,6 +326,100 @@ func UpDatePrescriptionNumberForCoordinate(user_org_id int64, ids []int64, numbe
326 326
 	return
327 327
 }
328 328
 
329
+func GetDrugInfo(bbx01 string) (string, string) {
330
+
331
+	//input := make(map[string]interface{})
332
+	inputData := make(map[string]interface{})
333
+	inputData["bbx01"] = bbx01 // 就诊凭证编号
334
+	inputData["name"] = ""     // 就诊凭证编号
335
+
336
+	var inputLog string
337
+	bytesData, err := json.Marshal(inputData)
338
+	inputLog = string(bytesData)
339
+	fmt.Println(string(bytesData))
340
+	if err != nil {
341
+		fmt.Println(err.Error())
342
+		return err.Error(), ""
343
+	}
344
+	reader := bytes.NewReader(bytesData)
345
+	var url string
346
+	gdyb_url := "http://218.104.146.179:9091/esb/listener/getGrug"
347
+	url = gdyb_url
348
+
349
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
350
+	request, err := http.NewRequest("GET", url, reader)
351
+	if err != nil {
352
+		fmt.Println(err.Error())
353
+		return err.Error(), ""
354
+	}
355
+
356
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
357
+	request.Header.Set("code", "Xmrjyy")
358
+
359
+	client := http.Client{}
360
+	resp, err := client.Do(request)
361
+	if err != nil {
362
+		fmt.Println(err.Error())
363
+		return err.Error(), ""
364
+	}
365
+	respBytes, err := ioutil.ReadAll(resp.Body)
366
+	if err != nil {
367
+		fmt.Println(err.Error())
368
+		return err.Error(), ""
369
+	}
370
+	fmt.Println(string(respBytes))
371
+	str := string(respBytes)
372
+	return str, inputLog
373
+
374
+}
375
+
376
+func GetGoodInfo(bbx01 string) (string, string) {
377
+
378
+	//input := make(map[string]interface{})
379
+	inputData := make(map[string]interface{})
380
+	inputData["bbx01"] = bbx01 // 就诊凭证编号
381
+	inputData["name"] = ""     // 就诊凭证编号
382
+
383
+	var inputLog string
384
+	bytesData, err := json.Marshal(inputData)
385
+	inputLog = string(bytesData)
386
+	fmt.Println(string(bytesData))
387
+	if err != nil {
388
+		fmt.Println(err.Error())
389
+		return err.Error(), ""
390
+	}
391
+	reader := bytes.NewReader(bytesData)
392
+	var url string
393
+	gdyb_url := "http://218.104.146.179:9091/esb/listener/getMaterial"
394
+	url = gdyb_url
395
+
396
+	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
397
+	request, err := http.NewRequest("GET", url, reader)
398
+	if err != nil {
399
+		fmt.Println(err.Error())
400
+		return err.Error(), ""
401
+	}
402
+
403
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
404
+	request.Header.Set("code", "Xmrjyy")
405
+
406
+	client := http.Client{}
407
+	resp, err := client.Do(request)
408
+	if err != nil {
409
+		fmt.Println(err.Error())
410
+		return err.Error(), ""
411
+	}
412
+	respBytes, err := ioutil.ReadAll(resp.Body)
413
+	if err != nil {
414
+		fmt.Println(err.Error())
415
+		return err.Error(), ""
416
+	}
417
+	fmt.Println(string(respBytes))
418
+	str := string(respBytes)
419
+	return str, inputLog
420
+
421
+}
422
+
329 423
 func FindPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
330 424
 	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND p_type = ? ", org_id, record_date, patient_id, p_type).First(&info).Error
331 425
 	return
@@ -375,3 +469,8 @@ func GetExecutionFrequencyByName(name string, org_id int64) (ef models.Execution
375 469
 	err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("(org_id = ? OR org_id = 0) AND name = ?", org_id, name).First(&ef).Error
376 470
 	return
377 471
 }
472
+
473
+func GetWayInfoByName(name string, org_id int64) (ef models.HisProject, err error) {
474
+	err = readDb.Model(&models.HisProject{}).Where("user_org_id = ? AND project_name = ? AND status= 1 AND cost_classify = 100", org_id, name).First(&ef).Error
475
+	return
476
+}

+ 2 - 2
service/fj_service.go View File

@@ -308,7 +308,7 @@ func FJyb2203(psnNo string, mdtrtId string, doctor string, department string, or
308 308
 }
309 309
 
310 310
 //  门诊费用明细信息上传
311
-func FJyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, opter string, url string, app_id string, app_secret string, sign_key string, enc_key string, dise_code string) (string, string, string) {
311
+func FJyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, opter string, url string, app_id string, app_secret string, sign_key string, enc_key string, dise_code string, doctor_number string) (string, string, string) {
312 312
 	// 生成签名
313 313
 	nonce := GetRandomString(32)
314 314
 	timestamp := time.Now().Unix()
@@ -429,7 +429,7 @@ func FJyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
429 429
 		feedetailInfo["medc_way_dscr"] = ""                          // 用药途径描述
430 430
 		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
431 431
 		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
432
-		feedetailInfo["bilg_dr_codg"] = doctor_id                    // 开单医生编码
432
+		feedetailInfo["bilg_dr_codg"] = doctor_number                // 开单医生编码
433 433
 		feedetailInfo["bilg_dr_name"] = doctor                       // 开单医师姓名
434 434
 		feedetailInfo["acord_dept_codg"] = ""                        // 受单科室编码
435 435
 		feedetailInfo["acord_dept_name"] = ""                        // 受单科室名称

+ 53 - 20
service/gdyb_service.go View File

@@ -101,25 +101,29 @@ func Gdyb1101(certNo string, org_name string, doctor string, fixmedins_code stri
101 101
 	if certificates == "3" {
102 102
 		inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
103 103
 		inputData["certno"] = certNo        // 证件号码
104
-		inputData["psn_cert_type"] = "99"   // 人员证件类型
104
+		inputData["psn_cert_type"] = "06"   // 人员证件类型
105
+		inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
106
+
105 107
 	} else {
106 108
 		if id_card_type == 1 {
107 109
 			inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
108 110
 			inputData["card_sn"] = card_sn      // 卡识别码
109 111
 			inputData["certno"] = certNo        // 证件号码
110 112
 			inputData["psn_cert_type"] = ""     // 人员证件类型
113
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
111 114
 
112 115
 		} else {
113 116
 			inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
114 117
 			inputData["card_sn"] = ""           // 卡识别码
115 118
 			inputData["certno"] = certNo        // 证件号码
116 119
 			inputData["psn_cert_type"] = ""     // 人员证件类型
120
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
121
+
117 122
 		}
118 123
 	}
119 124
 
120
-	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
121
-	inputData["begntime"] = ""          // 开始时间
122
-	inputData["psn_name"] = psn_name    // 人员姓名
125
+	inputData["begntime"] = "" // 开始时间
126
+	inputData["psn_name"] = "" // 人员姓名
123 127
 	input["data"] = inputData
124 128
 	inputMessage["input"] = input //交易输入
125 129
 
@@ -3270,6 +3274,11 @@ func Gdyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor
3270 3274
 
3271 3275
 // 生成签名
3272 3276
 func setSignature(timestamp int64, nonce string, secret_key string) string {
3277
+	fmt.Println(timestamp)
3278
+	fmt.Println(nonce)
3279
+	fmt.Println(secret_key)
3280
+	fmt.Println(strconv.FormatInt(timestamp, 10))
3281
+
3273 3282
 	str := strconv.FormatInt(timestamp, 10) + secret_key + nonce + strconv.FormatInt(timestamp, 10)
3274 3283
 	hash := sha256.New()
3275 3284
 	//输入数据
@@ -3282,16 +3291,34 @@ func setSignature(timestamp int64, nonce string, secret_key string) string {
3282 3291
 	return hashCode
3283 3292
 }
3284 3293
 
3294
+const charset = "abcdefghijklmnopqrstuvwxyz" +
3295
+	"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
3296
+
3297
+var seededRand *rand.Rand = rand.New(
3298
+	rand.NewSource(time.Now().UnixNano()))
3299
+
3285 3300
 // 生成随机字符串
3286 3301
 func GetRandomString(l int) string {
3287
-	str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
3288
-	bytes := []byte(str)
3289
-	result := []byte{}
3290
-	r := rand.New(rand.NewSource(time.Now().UnixNano()))
3291
-	for i := 0; i < l; i++ {
3292
-		result = append(result, bytes[r.Intn(len(bytes))])
3293
-	}
3294
-	return string(result)
3302
+
3303
+	//str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
3304
+	//bytes := []byte(str)
3305
+	//result := []byte{}
3306
+	//r := rand.New(rand.NewSource(time.Now().UnixNano()))
3307
+	//for i := 0; i < l; i++ {
3308
+	//	result = append(result, bytes[r.Intn(len(bytes))])
3309
+	//}
3310
+	return String(32)
3311
+}
3312
+func StringWithCharset(length int, charset string) string {
3313
+	b := make([]byte, length)
3314
+	for i := range b {
3315
+		b[i] = charset[seededRand.Intn(len(charset))]
3316
+	}
3317
+	return string(b)
3318
+}
3319
+
3320
+func String(length int) string {
3321
+	return StringWithCharset(length, charset)
3295 3322
 }
3296 3323
 
3297 3324
 // 生成基础报文
@@ -3323,7 +3350,7 @@ func SetInputMessage(nonce string, timestamp int64, org_name string, doctor stri
3323 3350
 	inputMessage["dev_no"] = ""                                                                 // 设备编号
3324 3351
 	inputMessage["dev_safe_info"] = ""                                                          // 设备安全信息
3325 3352
 	inputMessage["cainfo"] = ""                                                                 // 数字签名信息
3326
-	inputMessage["signtype"] = "SM3"                                                            // 签名类型
3353
+	inputMessage["signtype"] = "MOCK"                                                           // 签名类型
3327 3354
 	inputMessage["infver"] = "V1.0"                                                             // 接收方系统代码
3328 3355
 	inputMessage["opter_type"] = "1"                                                            // 经办人类别
3329 3356
 	inputMessage["opter"] = doctor                                                              // 经办人
@@ -3692,9 +3719,10 @@ func Gdyb1101B(certNo string, org_name string, doctor string, fixmedins_code str
3692 3719
 	inputMessage["infno"] = "1101" // 交易编码
3693 3720
 
3694 3721
 	if certificates == 3 {
3695
-		inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
3696
-		inputData["certno"] = certNo        // 证件号码
3697
-		inputData["psn_cert_type"] = "99"   // 人员证件类型
3722
+		inputData["mdtrt_cert_type"] = "99"     // 就诊凭证类型
3723
+		inputData["certno"] = "01836483"        // 证件号码
3724
+		inputData["psn_cert_type"] = "01"       // 人员证件类型
3725
+		inputData["mdtrt_cert_no"] = "01836483" // 就诊凭证编号
3698 3726
 
3699 3727
 	} else {
3700 3728
 		if certificates == 1 {
@@ -3703,11 +3731,15 @@ func Gdyb1101B(certNo string, org_name string, doctor string, fixmedins_code str
3703 3731
 				inputData["card_sn"] = ""           // 卡识别码
3704 3732
 				inputData["certno"] = certNo        // 证件号码
3705 3733
 				inputData["psn_cert_type"] = "01"   // 人员证件类型
3734
+				inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3735
+
3706 3736
 			} else {
3707 3737
 				inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
3708 3738
 				inputData["card_sn"] = ""           // 卡识别码
3709 3739
 				inputData["certno"] = certNo        // 证件号码
3710 3740
 				inputData["psn_cert_type"] = "01"   // 人员证件类型
3741
+				inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3742
+
3711 3743
 			}
3712 3744
 
3713 3745
 		} else if certificates == 6 {
@@ -3715,13 +3747,14 @@ func Gdyb1101B(certNo string, org_name string, doctor string, fixmedins_code str
3715 3747
 			inputData["card_sn"] = ""           // 卡识别码
3716 3748
 			inputData["certno"] = certNo        // 证件号码
3717 3749
 			inputData["psn_cert_type"] = "17"   // 人员证件类型
3750
+			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3751
+
3718 3752
 		}
3719 3753
 
3720 3754
 	}
3721 3755
 
3722
-	inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
3723
-	inputData["begntime"] = ""          // 开始时间
3724
-	inputData["psn_name"] = ""          // 人员姓名
3756
+	inputData["begntime"] = "" // 开始时间
3757
+	inputData["psn_name"] = "" // 人员姓名
3725 3758
 	input["data"] = inputData
3726 3759
 	inputMessage["input"] = input //交易输入
3727 3760
 
@@ -4428,7 +4461,7 @@ func Gdyb9001(org_name string, doctor string, fixmedins_code string, insuplc_adm
4428 4461
 	//生成签名
4429 4462
 	nonce := GetRandomString(32)
4430 4463
 	timestamp := time.Now().Unix()
4431
-	signature := setSignature(timestamp, nonce, secret_key)
4464
+	signature := setSignature(timestamp, nonce, "d6Ad0P1B3z6Dsdst0gYAFPlz8YlIvFDx")
4432 4465
 	//生成输入报文
4433 4466
 	inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
4434 4467
 	input := make(map[string]interface{})

File diff suppressed because it is too large
+ 4070 - 0
service/hb_service.go


+ 1 - 1
service/his_service.go View File

@@ -1422,7 +1422,7 @@ func GetPsnByPatientIdTwo(patient_id int64, record_date int64) (psn models.HisPs
1422 1422
 }
1423 1423
 
1424 1424
 func GetAllHisOrder(org_id int64) (his []*models.HisOrder, err error) {
1425
-	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2022-08-01 00:00:00' AND setl_time <= '2022-09-30 23:59:59'", org_id).Order("setl_time asc").Find(&his).Error
1425
+	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ?  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND med_type = '14' AND setl_time >= '2022-09-01 00:00:00'", org_id).Order("setl_time asc").Find(&his).Error
1426 1426
 	return
1427 1427
 }
1428 1428
 func GetAllHisOrderErr(org_id int64, stage int64) (his []*models.HisOrderError, err error) {

+ 6 - 6
service/hn_service.go View File

@@ -399,11 +399,11 @@ func Hnyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
399 399
 
400 400
 	timestamp2 := time.Now().Unix()
401 401
 
402
-	//tempTime := time.Unix(timestamp2, 0)
403
-	//timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
402
+	tempTime := time.Unix(timestamp2, 0)
403
+	timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
404 404
 	var customs []*Custom
405 405
 	for _, item := range hisPrescription {
406
-		tm := time.Unix(item.PreTime, 0)
406
+		//tm := time.Unix(item.PreTime, 0)
407 407
 
408 408
 		if item.Type == 1 { //药品
409 409
 			for _, subItem := range item.HisDoctorAdviceInfo {
@@ -421,7 +421,7 @@ func Hnyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
421 421
 						DoctorName:              new_doctor_name,
422 422
 						ProvinceDrugMedListCodg: "",
423 423
 						ProvinceGoodMedListCodg: "",
424
-						FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
424
+						FeeOcurTime:             timeFormatOne,
425 425
 					}
426 426
 
427 427
 					if subItem.BaseDrugLib.DrugClassify == "2" {
@@ -451,7 +451,7 @@ func Hnyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
451 451
 							HospApprFlag:            -1,
452 452
 							ProvinceDrugMedListCodg: "",
453 453
 							ProvinceGoodMedListCodg: "",
454
-							FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
454
+							FeeOcurTime:             timeFormatOne,
455 455
 						}
456 456
 						customs = append(customs, cus)
457 457
 					}
@@ -471,7 +471,7 @@ func Hnyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
471 471
 							DoctorName:              new_doctor_name,
472 472
 							ProvinceDrugMedListCodg: "",
473 473
 							ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
474
-							FeeOcurTime:             tm.Format("2006-01-02 15:04:05"),
474
+							FeeOcurTime:             timeFormatOne,
475 475
 						}
476 476
 						customs = append(customs, cus)
477 477
 					}

+ 45 - 43
service/jsyb_service.go View File

@@ -612,12 +612,13 @@ func Jsyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
612 612
 		feedetailInfo["medc_way_dscr"] = ""                          // 用药途径描述
613 613
 		feedetailInfo["bilg_dept_codg"] = dept_code                  // 开单科室编码
614 614
 		feedetailInfo["bilg_dept_name"] = dept                       // 开单科室名称
615
-		feedetailInfo["bilg_dr_codg"] = item.DoctorNumber            // 开单医生编码
616
-		feedetailInfo["bilg_dr_name"] = item.DoctorName              // 开单医师姓名
617
-		feedetailInfo["acord_dept_codg"] = ""                        // 受单科室编码
618
-		feedetailInfo["acord_dept_name"] = ""                        // 受单科室名称
619
-		feedetailInfo["orders_dr_code"] = ""                         // 受单医生编码
620
-		feedetailInfo["orders_dr_name"] = ""                         // 受单医生姓名
615
+
616
+		feedetailInfo["bilg_dr_codg"] = "D371621008686"   // 开单医生编码
617
+		feedetailInfo["bilg_dr_name"] = "王云刚"             // 开单医师姓名
618
+		feedetailInfo["acord_dept_codg"] = ""             // 受单科室编码
619
+		feedetailInfo["acord_dept_name"] = ""             // 受单科室名称
620
+		feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
621
+		feedetailInfo["orders_dr_name"] = "王云刚"           // 受单医生姓名
621 622
 		if balance_accounts_type == "8" {
622 623
 			feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
623 624
 		} else {
@@ -1029,8 +1030,8 @@ func SetJSInputMessage(timestamp int64, org_name string, doctor string, fixmedin
1029 1030
 		inputMessage["opter"] = "晁海燕"      // 经办人
1030 1031
 		inputMessage["opter_name"] = "晁海燕" // 经办人姓名
1031 1032
 	} else {
1032
-		inputMessage["opter"] = doctor      // 经办人
1033
-		inputMessage["opter_name"] = doctor // 经办人姓名
1033
+		inputMessage["opter"] = "孙欣欣"      // 经办人
1034
+		inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
1034 1035
 	}
1035 1036
 	inputMessage["inf_time"] = timeFormatOne        // 交易时间
1036 1037
 	inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
@@ -1772,37 +1773,38 @@ func Jsyb3502(struct3502 models.Struct3502) (string, string) {
1772 1773
 func Jsyb3503(struct3503 models.Struct3503) (string, string) {
1773 1774
 	timestamp := time.Now().Unix()
1774 1775
 	// 生成输入报文
1775
-	inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsCode, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
1776
+	fmt.Println(struct3503)
1777
+	inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
1778
+
1776 1779
 	input := make(map[string]interface{})
1777
-	inputData := make(map[string]interface{})
1780
+
1778 1781
 	inputMessage["infno"] = "3503"
1779
-	inputData["med_list_codg"] = struct3503.MedListCodg
1780
-	inputData["fixmedins_hilist_id"] = struct3503.FixmedinsCode
1781
-	inputData["fixmedins_hilist_name"] = struct3503.OrgName
1782
-
1783
-	inputData["dynt_no"] = ""
1784
-	inputData["fixmedins_bchno"] = struct3503.FixmedinsBchno // 人员编号 (来自1101接口返回)
1785
-
1786
-	inputData["spler_name"] = struct3503.SplerName       // 人员编号 (来自1101接口返回)
1787
-	inputData["spler_pmtno"] = ""                        // 人员编号 (来自1101接口返回)
1788
-	inputData["manu_lotnum"] = struct3503.ManuLotnum     // 人员编号 (来自1101接口返回)
1789
-	inputData["prodentp_name"] = struct3503.ProdentpName // 人员编号 (来自1101接口返回)
1790
-	inputData["aprvno"] = struct3503.Aprvno              // 人员编号 (来自1101接口返回)
1791
-	inputData["manu_date"] = struct3503.ManuDate         // 人员编号 (来自1101接口返回)
1792
-	inputData["expy_end"] = struct3503.ExpyEnd           // 人员编号 (来自1101接口返回)
1793
-
1794
-	inputData["finl_trns_pric"] = struct3503.FinlTrnsPric // 人员编号 (来自1101接口返回)
1795
-	inputData["purc_retn_cnt"] = struct3503.PurcRetnCnt   // 人员编号 (来自1101接口返回)
1796
-	inputData["purc_invo_codg"] = struct3503.PurcInvoCodg // 人员编号 (来自1101接口返回)
1797
-	inputData["purc_invo_no"] = struct3503.PurcInvoNo     // 人员编号 (来自1101接口返回)
1798
-
1799
-	inputData["rx_flag"] = struct3503.RxFlag // 人员编号 (来自1101接口返回)
1800
-
1801
-	inputData["purc_retn_stoin_time"] = struct3503.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
1802
-	inputData["purc_retn_opter_name"] = struct3503.PurcRetnOpterName // 人员编号 (来自1101接口返回)
1803
-	inputData["prod_geay_flag"] = ""                                 // 人员编号 (来自1101接口返回)
1804
-	inputData["memo"] = ""                                           // 人员编号 (来自1101接口返回)
1805
-	input["purcinfo"] = inputData
1782
+
1783
+	item := struct3503
1784
+	feedetailInfo := make(map[string]interface{})
1785
+	feedetailInfo["med_list_codg"] = item.MedListCodg
1786
+	feedetailInfo["fixmedins_hilist_id"] = item.FixmedinsHilistId
1787
+	feedetailInfo["fixmedins_hilist_name"] = item.FixmedinsHilistName
1788
+	feedetailInfo["dynt_no"] = ""
1789
+	feedetailInfo["fixmedins_bchno"] = item.FixmedinsBchno         // 人员编号 (来自1101接口返回)
1790
+	feedetailInfo["spler_name"] = item.SplerName                   // 人员编号 (来自1101接口返回)
1791
+	feedetailInfo["spler_pmtno"] = ""                              // 人员编号 (来自1101接口返回)
1792
+	feedetailInfo["manu_lotnum"] = item.ManuLotnum                 // 人员编号 (来自1101接口返回)
1793
+	feedetailInfo["prodentp_name"] = item.ProdentpName             // 人员编号 (来自1101接口返回)
1794
+	feedetailInfo["aprvno"] = item.Aprvno                          // 人员编号 (来自1101接口返回)
1795
+	feedetailInfo["manu_date"] = item.ManuDate                     // 人员编号 (来自1101接口返回)
1796
+	feedetailInfo["expy_end"] = item.ExpyEnd                       // 人员编号 (来自1101接口返回)
1797
+	feedetailInfo["finl_trns_pric"] = item.FinlTrnsPric            // 人员编号 (来自1101接口返回)
1798
+	feedetailInfo["purc_retn_cnt"] = item.PurcRetnCnt              // 人员编号 (来自1101接口返回)
1799
+	feedetailInfo["purc_invo_codg"] = item.PurcInvoCodg            // 人员编号 (来自1101接口返回)
1800
+	feedetailInfo["purc_invo_no"] = item.PurcInvoNo                // 人员编号 (来自1101接口返回)
1801
+	feedetailInfo["rx_flag"] = item.RxFlag                         // 人员编号 (来自1101接口返回)
1802
+	feedetailInfo["purc_retn_stoin_time"] = item.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
1803
+	feedetailInfo["purc_retn_opter_name"] = item.PurcRetnOpterName // 人员编号 (来自1101接口返回)
1804
+	feedetailInfo["prod_geay_flag"] = ""                           // 人员编号 (来自1101接口返回)
1805
+	feedetailInfo["memo"] = ""                                     // 人员编号 (来自1101接口返回)
1806
+
1807
+	input["purcinfo"] = feedetailInfo
1806 1808
 	inputMessage["input"] = input //交易输入
1807 1809
 
1808 1810
 	bytesData, err := json.Marshal(inputMessage)
@@ -1856,14 +1858,14 @@ func Jsyb3504(struct3504 models.Struct3504) (string, string) {
1856 1858
 func Jsyb3505(struct3505 models.Struct3505) (string, string) {
1857 1859
 	timestamp := time.Now().Unix()
1858 1860
 	// 生成输入报文
1859
-	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
1861
+	inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
1860 1862
 	input := make(map[string]interface{})
1861 1863
 	inputData := make(map[string]interface{})
1862
-	inputMessage["infno"] = "3505"                              // 交易编码
1863
-	inputData["med_list_codg"] = struct3505.MedListCodg         // 定点医药机构目录编号
1864
-	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
1865
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName     // 定点医药机构目录名称
1866
-	inputData["fixmedins_bchno"] = struct3505.FixmedinsCode     // 人员编号 (来自1101接口返回)
1864
+	inputMessage["infno"] = "3505"                                  // 交易编码
1865
+	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
1866
+	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
1867
+	inputData["fixmedins_hilist_name"] = struct3505.OrgName         // 定点医药机构目录名称
1868
+	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
1867 1869
 
1868 1870
 	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
1869 1871
 	inputData["prsc_dr_certno"] = struct3505.PrscDrCertno      // 人员编号 (来自1101接口返回)