|
@@ -497,10 +497,10 @@ type gzjhyz struct {
|
497
|
497
|
func GetGzjhYz(sync_time int64, his_user_id string) (str gzjhResult, checkStr string) {
|
498
|
498
|
apiurl := "http://219.135.166.106:8067/WebService.asmx/queryyzxx"
|
499
|
499
|
rep := httplib.Get(apiurl)
|
500
|
|
- rep.Param("sync_time", strconv.FormatInt(sync_time,10))
|
501
|
|
- rep.Param("access_token","0")
|
|
500
|
+ rep.Param("sync_time", strconv.FormatInt(sync_time, 10))
|
|
501
|
+ rep.Param("access_token", "0")
|
502
|
502
|
rep.Param("his_user_id", his_user_id)
|
503
|
|
- utils.InfoLog(strconv.FormatInt(sync_time,10))
|
|
503
|
+ utils.InfoLog(strconv.FormatInt(sync_time, 10))
|
504
|
504
|
utils.InfoLog(his_user_id)
|
505
|
505
|
// str, _ := rep.String()
|
506
|
506
|
xmlKey := XmlKey{}
|
|
@@ -528,16 +528,16 @@ func SyncGzjhyz() (err error) {
|
528
|
528
|
|
529
|
529
|
redisClient := RedisClient()
|
530
|
530
|
defer redisClient.Close()
|
531
|
|
- sync_time_tt, _ := redisClient.Get(redisClient.Context(),"gdjh_sync_time").Result()
|
|
531
|
+ sync_time_tt, _ := redisClient.Get("gdjh_sync_time").Result()
|
532
|
532
|
|
533
|
|
- sync_time,_ := strconv.ParseInt(sync_time_tt,10,64)
|
|
533
|
+ sync_time, _ := strconv.ParseInt(sync_time_tt, 10, 64)
|
534
|
534
|
if sync_time == 0 {
|
535
|
535
|
sync_time = time.Now().Unix()
|
536
|
536
|
}
|
537
|
537
|
new_sync_time := time.Now().Unix()
|
538
|
538
|
utils.InfoLog("new_sync_time:%v", new_sync_time)
|
539
|
539
|
// 切换为当前时间
|
540
|
|
- redisClient.Set(redisClient.Context(),"gdjh_sync_time", new_sync_time, time.Minute*60*24)
|
|
540
|
+ redisClient.Set("gdjh_sync_time", new_sync_time, time.Minute*60*24)
|
541
|
541
|
// 第二步: 获取当天排班患者的住院号
|
542
|
542
|
schedulesDateStr := time.Now().Format("2006-01-02")
|
543
|
543
|
schedulesDate, _ := utils.ParseTimeStringToTime("2006-01-02", schedulesDateStr)
|
|
@@ -545,19 +545,19 @@ func SyncGzjhyz() (err error) {
|
545
|
545
|
var patient_zy_ids string
|
546
|
546
|
// patient_zy_ids, _ := redisClient.Get(redisClient.Context(),"gdjh_patient_zy_ids").Result()
|
547
|
547
|
// if len(patient_zy_ids) == 0 {
|
548
|
|
- schedules, _ := GetPatientGzjhList(org_id, schedulesTime)
|
549
|
|
- if len(schedules) > 0 {
|
550
|
|
- for _, item := range schedules {
|
551
|
|
- // if len(item.Patients.AdmissionNumber) > 0 {
|
552
|
|
- if len(patient_zy_ids) == 0 {
|
553
|
|
- patient_zy_ids = item.Patients.IdCardNo + "-" + strconv.FormatInt(item.Patients.ID, 10) + "-" + item.Patients.AdmissionNumber
|
554
|
|
- } else {
|
555
|
|
- patient_zy_ids = patient_zy_ids + "," + item.Patients.IdCardNo + "-" + strconv.FormatInt(item.Patients.ID, 10) + "-" + item.Patients.AdmissionNumber
|
556
|
|
- }
|
557
|
|
- // }
|
|
548
|
+ schedules, _ := GetPatientGzjhList(org_id, schedulesTime)
|
|
549
|
+ if len(schedules) > 0 {
|
|
550
|
+ for _, item := range schedules {
|
|
551
|
+ // if len(item.Patients.AdmissionNumber) > 0 {
|
|
552
|
+ if len(patient_zy_ids) == 0 {
|
|
553
|
+ patient_zy_ids = item.Patients.IdCardNo + "-" + strconv.FormatInt(item.Patients.ID, 10) + "-" + item.Patients.AdmissionNumber
|
|
554
|
+ } else {
|
|
555
|
+ patient_zy_ids = patient_zy_ids + "," + item.Patients.IdCardNo + "-" + strconv.FormatInt(item.Patients.ID, 10) + "-" + item.Patients.AdmissionNumber
|
558
|
556
|
}
|
559
|
|
- // redisClient.Set(redisClient.Context(),"gdjh_patient_zy_ids", patient_zy_ids, time.Minute*5)
|
|
557
|
+ // }
|
560
|
558
|
}
|
|
559
|
+ // redisClient.Set(redisClient.Context(),"gdjh_patient_zy_ids", patient_zy_ids, time.Minute*5)
|
|
560
|
+ }
|
561
|
561
|
// }
|
562
|
562
|
utils.InfoLog("2gdjh_patient_zy_ids:%v", patient_zy_ids)
|
563
|
563
|
|
|
@@ -569,7 +569,7 @@ func SyncGzjhyz() (err error) {
|
569
|
569
|
patient_id := temp_id[1]
|
570
|
570
|
admission_number := temp_id[2]
|
571
|
571
|
gzjhyz, yzstr := GetGzjhYz(sync_time, id)
|
572
|
|
- if len(gzjhyz.Result) == 0 && len(admission_number) > 0{
|
|
572
|
+ if len(gzjhyz.Result) == 0 && len(admission_number) > 0 {
|
573
|
573
|
utils.InfoLog("admission_number:%v", admission_number)
|
574
|
574
|
gzjhyz, yzstr = GetGzjhYz(sync_time, admission_number)
|
575
|
575
|
}
|
|
@@ -581,12 +581,12 @@ func SyncGzjhyz() (err error) {
|
581
|
581
|
for _, yz := range gzjhyz.Result {
|
582
|
582
|
// 根据姓名获取医生ID
|
583
|
583
|
var doctor_id int64
|
584
|
|
- temp_doctor_id, _ := redisClient.Get(redisClient.Context(),"gdjh_doctor_id_" + yz.DoctorId).Result()
|
|
584
|
+ temp_doctor_id, _ := redisClient.Get("gdjh_doctor_id_" + yz.DoctorId).Result()
|
585
|
585
|
if len(temp_doctor_id) == 0 {
|
586
|
586
|
doctor, _ := GetAdminUserId(org_id, yz.DoctorId)
|
587
|
587
|
doctor_id = doctor.AdminUserId
|
588
|
588
|
if doctor_id > 0 {
|
589
|
|
- redisClient.Set(redisClient.Context(),"gdjh_doctor_id_"+yz.DoctorId, doctor_id, time.Minute*60*2)
|
|
589
|
+ redisClient.Set("gdjh_doctor_id_"+yz.DoctorId, doctor_id, time.Minute*60*2)
|
590
|
590
|
} else {
|
591
|
591
|
continue
|
592
|
592
|
}
|
|
@@ -628,9 +628,9 @@ func SyncGzjhyz() (err error) {
|
628
|
628
|
if advice_info.ID > 0 {
|
629
|
629
|
key := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(temp_patient_id, 10) + ":" + strconv.FormatInt(schedulesTime, 10) + ":doctor_advices"
|
630
|
630
|
//清空key 值
|
631
|
|
- redisClient.Set(redisClient.Context(),key, "", time.Second)
|
|
631
|
+ redisClient.Set(key, "", time.Second)
|
632
|
632
|
keyOne := strconv.FormatInt(org_id, 10) + ":" + strconv.FormatInt(schedulesTime, 10) + ":advice_list_all"
|
633
|
|
- redisClient.Set(redisClient.Context(),keyOne, "", time.Second)
|
|
633
|
+ redisClient.Set(keyOne, "", time.Second)
|
634
|
634
|
continue
|
635
|
635
|
} else {
|
636
|
636
|
if len(yz.AdviceName) > 0 {
|
|
@@ -918,7 +918,7 @@ func SyncHbJldyyz() (err error) {
|
918
|
918
|
|
919
|
919
|
redisClient := RedisClient()
|
920
|
920
|
defer redisClient.Close()
|
921
|
|
- sync_time, _ := redisClient.Get(redisClient.Context(),"gdjh_sync_time1").Result()
|
|
921
|
+ sync_time, _ := redisClient.Get("gdjh_sync_time1").Result()
|
922
|
922
|
if len(sync_time) == 0 {
|
923
|
923
|
sync_time = strconv.FormatInt(time.Now().Unix(), 10)
|
924
|
924
|
utils.InfoLog("sync_time:%v", sync_time)
|
|
@@ -929,12 +929,12 @@ func SyncHbJldyyz() (err error) {
|
929
|
929
|
new_sync_time := time.Now().Unix()
|
930
|
930
|
utils.InfoLog("new_sync_time:%v", new_sync_time)
|
931
|
931
|
// 切换为当前时间
|
932
|
|
- redisClient.Set(redisClient.Context(),"gdjh_sync_time", new_sync_time, time.Minute*60*24)
|
|
932
|
+ redisClient.Set("gdjh_sync_time", new_sync_time, time.Minute*60*24)
|
933
|
933
|
// 第二步: 获取当天排班患者的住院号
|
934
|
934
|
schedulesDateStr := time.Now().Format("2006-01-02")
|
935
|
935
|
schedulesDate, _ := utils.ParseTimeStringToTime("2006-01-02", schedulesDateStr)
|
936
|
936
|
schedulesTime := schedulesDate.Unix()
|
937
|
|
- patient_zy_ids, _ := redisClient.Get(redisClient.Context(),"gdjh_patient_zy_ids").Result()
|
|
937
|
+ patient_zy_ids, _ := redisClient.Get("gdjh_patient_zy_ids").Result()
|
938
|
938
|
if len(patient_zy_ids) == 0 {
|
939
|
939
|
schedules, _ := GetPatientGzjhList(org_id, schedulesTime)
|
940
|
940
|
if len(schedules) > 0 {
|
|
@@ -945,7 +945,7 @@ func SyncHbJldyyz() (err error) {
|
945
|
945
|
patient_zy_ids = patient_zy_ids + "," + item.Patients.IdCardNo + "-" + strconv.FormatInt(item.Patients.ID, 10)
|
946
|
946
|
}
|
947
|
947
|
}
|
948
|
|
- redisClient.Set(redisClient.Context(),"gdjh_patient_zy_ids", patient_zy_ids, time.Minute*60*2)
|
|
948
|
+ redisClient.Set("gdjh_patient_zy_ids", patient_zy_ids, time.Minute*60*2)
|
949
|
949
|
}
|
950
|
950
|
}
|
951
|
951
|
utils.InfoLog("2gdjh_patient_zy_ids:%v", patient_zy_ids)
|
|
@@ -962,12 +962,12 @@ func SyncHbJldyyz() (err error) {
|
962
|
962
|
utils.InfoLog("yz:%v", yz)
|
963
|
963
|
// 根据姓名获取医生ID
|
964
|
964
|
var doctor_id int64
|
965
|
|
- temp_doctor_id, _ := redisClient.Get(redisClient.Context(),"gdjh_doctor_id_" + strconv.FormatInt(yz.DoctorId, 10)).Result()
|
|
965
|
+ temp_doctor_id, _ := redisClient.Get("gdjh_doctor_id_" + strconv.FormatInt(yz.DoctorId, 10)).Result()
|
966
|
966
|
if len(temp_doctor_id) == 0 {
|
967
|
967
|
doctor, _ := GetAdminUserId(org_id, yz.DoctorName)
|
968
|
968
|
doctor_id = doctor.AdminUserId
|
969
|
969
|
if doctor_id > 0 {
|
970
|
|
- redisClient.Set(redisClient.Context(),"gdjh_doctor_id_"+strconv.FormatInt(yz.DoctorId, 10), doctor_id, time.Minute*60*2)
|
|
970
|
+ redisClient.Set("gdjh_doctor_id_"+strconv.FormatInt(yz.DoctorId, 10), doctor_id, time.Minute*60*2)
|
971
|
971
|
} else {
|
972
|
972
|
continue
|
973
|
973
|
}
|