csx 3 years ago
parent
commit
6859bec60a
4 changed files with 29 additions and 28 deletions
  1. 6 2
      controllers/lis.go
  2. 1 0
      routers/router.go
  3. 6 10
      service/bl_service.go
  4. 16 16
      service/cron.go

+ 6 - 2
controllers/lis.go View File

398
 
398
 
399
 func (c *LisController) SyncBlLis() {
399
 func (c *LisController) SyncBlLis() {
400
 	service.GetDataInsertDB(10138)
400
 	service.GetDataInsertDB(10138)
401
-
401
+	c.ServeSuccessJSON(map[string]interface{}{
402
+		"resultList": "同步成功",
403
+	})
402
 }
404
 }
403
 
405
 
404
 func (c *LisController) SyncBlResultLis() {
406
 func (c *LisController) SyncBlResultLis() {
405
 
407
 
406
 	service.GetResultDataInsertDB(10138)
408
 	service.GetResultDataInsertDB(10138)
407
-
409
+	c.ServeSuccessJSON(map[string]interface{}{
410
+		"resultList": "同步成功",
411
+	})
408
 }
412
 }

+ 1 - 0
routers/router.go View File

18
 	beego.Router("/api/lis/hbdyyzsync", &controllers.LisController{}, "get:SyncHbJldyyz")
18
 	beego.Router("/api/lis/hbdyyzsync", &controllers.LisController{}, "get:SyncHbJldyyz")
19
 	beego.Router("/api/lis/hbdylissync", &controllers.LisController{}, "get:SyncHbJldyLis")
19
 	beego.Router("/api/lis/hbdylissync", &controllers.LisController{}, "get:SyncHbJldyLis")
20
 
20
 
21
+	//百霖lis
21
 	beego.Router("/api/lis/bltest", &controllers.LisController{}, "get:SyncBlLis")
22
 	beego.Router("/api/lis/bltest", &controllers.LisController{}, "get:SyncBlLis")
22
 	beego.Router("/api/lis/blresulttest", &controllers.LisController{}, "get:SyncBlResultLis")
23
 	beego.Router("/api/lis/blresulttest", &controllers.LisController{}, "get:SyncBlResultLis")
23
 
24
 

+ 6 - 10
service/bl_service.go View File

239
 }
239
 }
240
 
240
 
241
 func GetResultRecord() (record []CmResult, err error) {
241
 func GetResultRecord() (record []CmResult, err error) {
242
-	err = dataBase.Model(&CmResult{}).Order("barcode asc").Limit(1).Find(&record).Error
242
+	err = dataBase.Model(&CmResult{}).Order("barcode asc").Find(&record).Error
243
 	return
243
 	return
244
 }
244
 }
245
 
245
 
264
 				}).Where("status = 1")
264
 				}).Where("status = 1")
265
 			}).Where("status = 1")
265
 			}).Where("status = 1")
266
 		}).Where("status = 1")
266
 		}).Where("status = 1")
267
-	}).Where("id > ? AND user_org_id = ? AND status = 1", last_id, org_id).Limit(100).Find(&list).Error
267
+	}).Where("id > ? AND user_org_id = ? AND status = 1", last_id, org_id).Find(&list).Error
268
 	return
268
 	return
269
 }
269
 }
270
 
270
 
277
 				}).Where("status = 1")
277
 				}).Where("status = 1")
278
 			}).Where("status = 1")
278
 			}).Where("status = 1")
279
 		}).Where("status = 1")
279
 		}).Where("status = 1")
280
-	}).Where("user_org_id = ? AND status = 1", org_id).Limit(100).Find(&list).Error
280
+	}).Where("user_org_id = ? AND status = 1", org_id).Find(&list).Error
281
 	return
281
 	return
282
 }
282
 }
283
 
283
 
657
 
657
 
658
 	} else {
658
 	} else {
659
 		if record.LastId != 0 {
659
 		if record.LastId != 0 {
660
-			fmt.Println("~~~~~~~~")
661
-
662
-			list, err := GetResultRecord()
660
+			list, err := GetResultRecordByID(record.LastId)
663
 			fmt.Println(list)
661
 			fmt.Println(list)
664
 			//插入中间库中
662
 			//插入中间库中
665
 			//插入一条插入中间库记录数据
663
 			//插入一条插入中间库记录数据
667
 
665
 
668
 				//插入到系统检验检查数据
666
 				//插入到系统检验检查数据
669
 				for _, item := range list {
667
 				for _, item := range list {
670
-
671
 					project_id := int64(0)
668
 					project_id := int64(0)
672
-					if len("180") > 0 {
669
+					if len(item.Barcode) > 0 {
673
 						project_id, _ = GetBljhProjectID(org_id, item.Groupname)
670
 						project_id, _ = GetBljhProjectID(org_id, item.Groupname)
674
 					} else {
671
 					} else {
675
 						continue
672
 						continue
676
 					}
673
 					}
677
-					printInfo, _ := GetHisLabelPrintInfoById("180")
678
-
674
+					printInfo, _ := GetHisLabelPrintInfoById(item.Barcode)
679
 					item_id, _ := GetBlItemID(org_id, item.Groupname, item.Itemname, project_id)
675
 					item_id, _ := GetBlItemID(org_id, item.Groupname, item.Itemname, project_id)
680
 
676
 
681
 					tx := writeMiddleDb.Begin()
677
 					tx := writeMiddleDb.Begin()

+ 16 - 16
service/cron.go View File

22
 		AutoSyncLis()
22
 		AutoSyncLis()
23
 	})
23
 	})
24
 
24
 
25
-	speclg := "0 0 2 * * ?" // 每天凌晨2点同步 龙岗二院
26
-	createLisSyncCronJob.AddFunc(speclg, func() {
27
-		SyncLisLgty()
28
-	})
29
-
30
-	specys := "0 0 3 * * ?" // 每天凌晨3点同步 沅胜血透
31
-	createLisSyncCronJob.AddFunc(specys, func() {
32
-		SyncHbdyLis()
33
-	})
25
+	//speclg := "0 0 2 * * ?" // 每天凌晨2点同步 龙岗二院
26
+	//createLisSyncCronJob.AddFunc(speclg, func() {
27
+	//	SyncLisLgty()
28
+	//})
29
+	//
30
+	//specys := "0 0 3 * * ?" // 每天凌晨3点同步 沅胜血透
31
+	//createLisSyncCronJob.AddFunc(specys, func() {
32
+	//	SyncHbdyLis()
33
+	//})
34
 
34
 
35
 	// specgzjh := "0 */1 7-20 * *  " // 每2分钟同步 广州暨华HIS医嘱
35
 	// specgzjh := "0 */1 7-20 * *  " // 每2分钟同步 广州暨华HIS医嘱
36
 	// createLisSyncCronJob.AddFunc(specgzjh, func() {
36
 	// createLisSyncCronJob.AddFunc(specgzjh, func() {
37
 	// 	SyncGzjhyz()
37
 	// 	SyncGzjhyz()
38
 	// })
38
 	// })
39
 
39
 
40
-	specgzjhlis := "0 30 3 * * ?" // 每天凌晨3点30同步 广州暨华
41
-	createLisSyncCronJob.AddFunc(specgzjhlis, func() {
42
-		SyncGzjhLis()
43
-	})
44
-
45
-	specszbllis := "0 30 4 * * ?" // 每天凌晨4点30同步 广州暨华
40
+	//specgzjhlis := "0 30 3 * * ?" // 每天凌晨3点30同步 广州暨华
41
+	//createLisSyncCronJob.AddFunc(specgzjhlis, func() {
42
+	//	SyncGzjhLis()
43
+	//})
44
+	//
45
+	specszbllis := "0 0 4 * * ?" // 每天凌晨4点00同步 深圳百霖
46
 	createLisSyncCronJob.AddFunc(specszbllis, func() {
46
 	createLisSyncCronJob.AddFunc(specszbllis, func() {
47
 		SyncSZblLis()
47
 		SyncSZblLis()
48
 	})
48
 	})
49
 
49
 
50
-	specszbllisResult := "0 0 2 * * ?" // 每天凌晨3点00同步 广州暨华
50
+	specszbllisResult := "0 30 4 * * ?" // 每天凌晨4点30同步 深圳百霖
51
 	createLisSyncCronJob.AddFunc(specszbllisResult, func() {
51
 	createLisSyncCronJob.AddFunc(specszbllisResult, func() {
52
 		SyncSZblLisResult()
52
 		SyncSZblLisResult()
53
 	})
53
 	})