test_user 4 weeks ago
parent
commit
23b88ab2c8
4 changed files with 85 additions and 354 deletions
  1. 41 103
      controllers/sg/his_api_controller.go
  2. 3 0
      models/his_models.go
  3. 24 247
      service/gdyb_service.go
  4. 17 4
      service/his_service.go

+ 41 - 103
controllers/sg/his_api_controller.go View File

34
 	"syscall"
34
 	"syscall"
35
 	"time"
35
 	"time"
36
 	"unsafe"
36
 	"unsafe"
37
+	"github.com/go-ole/go-ole"
38
+
37
 )
39
 )
38
 
40
 
39
 type HisApiController struct {
41
 type HisApiController struct {
204
 	beego.Router("/api/35082", &HisApiController{}, "get:Get35082")
206
 	beego.Router("/api/35082", &HisApiController{}, "get:Get35082")
205
 
207
 
206
 	beego.Router("/api/changedrug/four", &HisApiController{}, "get:ChangeDrugfour")
208
 	beego.Router("/api/changedrug/four", &HisApiController{}, "get:ChangeDrugfour")
209
+	beego.Router("/api/changedrug/five", &HisApiController{}, "get:ChangeDrugFive")
210
+
207
 	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
211
 	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
212
+	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
213
+
208
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
214
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
209
 
215
 
210
 }
216
 }
224
 }
230
 }
225
 
231
 
226
 func (c *HisApiController) TestNet() {
232
 func (c *HisApiController) TestNet() {
227
-	c.ServeSuccessJSON(map[string]interface{}{
228
-		"msg": "成功",
229
-	})
233
+	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
234
+	return
235
+	//c.ServeSuccessJSON(map[string]interface{}{
236
+	//	"msg": "成功",
237
+	//})
230
 }
238
 }
231
 
239
 
232
 func (c *HisApiController) Get3508() {
240
 func (c *HisApiController) Get3508() {
2727
 		stime = stmp.Unix()
2735
 		stime = stmp.Unix()
2728
 		etime = stime + 86399
2736
 		etime = stime + 86399
2729
 	}
2737
 	}
2738
+
2730
 	advicelist, _ := service.FindUploadHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
2739
 	advicelist, _ := service.FindUploadHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
2731
 	var flows []*models.DrugFlow
2740
 	var flows []*models.DrugFlow
2732
 	for _, item := range advicelist {
2741
 	for _, item := range advicelist {
2733
-		flow, _ := service.GetNewUploadDrugFlowInfoByPatientTwo(patient_id, item.ID, times, c.GetAdminUserInfo().CurrentOrgId)
2742
+		flow, _ := service.GetNewUploadDrugFlowInfoByPatientTwo(patient_id, item.DrugId, stime, c.GetAdminUserInfo().CurrentOrgId)
2734
 		flows = append(flows, flow...)
2743
 		flows = append(flows, flow...)
2735
 	}
2744
 	}
2736
 
2745
 
2742
 	for _, item := range flows {
2751
 	for _, item := range flows {
2743
 		if item.IsSale == 1 {
2752
 		if item.IsSale == 1 {
2744
 			var res FJ3507Result
2753
 			var res FJ3507Result
2745
-			var res2 FJ3507Result
2746
 
2754
 
2747
 			var struct3507 models.Struct3507
2755
 			var struct3507 models.Struct3507
2748
 			struct3507.FixmedinsBchno = item.Bchno
2756
 			struct3507.FixmedinsBchno = item.Bchno
2914
 			}
2922
 			}
2915
 
2923
 
2916
 			if res.Infcode == 0 {
2924
 			if res.Infcode == 0 {
2925
+				service.SaveDoctoradviceStatusTwo(item.HisDoctorAdviceInfo.ID)
2917
 				item.IsSale = 0
2926
 				item.IsSale = 0
2918
 				item.SaleDate = ""
2927
 				item.SaleDate = ""
2919
 				item.Bchno = ""
2928
 				item.Bchno = ""
2920
-
2921
-				err2 := service.SaveDF(item)
2922
-				if err2 == nil {
2923
-					var struct3507_2 models.Struct3507
2924
-					struct3507_2.OrgName = miConfig.OrgName
2925
-					struct3507_2.AccessKey = miConfig.AccessKey
2926
-					struct3507_2.RequestUrl = miConfig.Url
2927
-					struct3507_2.Opter = roles.UserName
2928
-					struct3507_2.FixmedinsCode = miConfig.Code
2929
-					struct3507_2.Code = miConfig.Code
2930
-
2931
-					struct3507_2.SecretKey = miConfig.SecretKey
2932
-					struct3507_2.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
2933
-					struct3507_2.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
2934
-					struct3507_2.Url = miConfig.Url
2935
-					struct3507_2.AppId = miConfig.Cainfo
2936
-					struct3507_2.AppSecret = miConfig.AppSecret
2937
-					struct3507_2.Enckey = miConfig.EncKey
2938
-					struct3507_2.SignKey = miConfig.SignKey
2939
-					struct3507_2.SecretKey = miConfig.SecretKey
2940
-					struct3507_2.FixmedinsBchno = item.BgBchno
2941
-					struct3507_2.InvDataType = "2"
2942
-
2943
-					if miConfig.MdtrtareaAdmvs == "350500" {
2944
-						result11, result22, _ := service.FJyb3507(struct3507_2)
2945
-						saveLog(result11, result22, "3507", "3507")
2946
-
2947
-						var respJSON3 map[string]interface{}
2948
-						if err := json.Unmarshal([]byte(string(result11)), &respJSON3); err != nil {
2949
-							utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2950
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2951
-							return
2952
-						}
2953
-						userJSONBytes3, _ := json.Marshal(respJSON3)
2954
-						if err := json.Unmarshal(userJSONBytes3, &res2); err != nil {
2955
-							utils.ErrorLog("解析失败:%v", err)
2956
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2957
-							return
2958
-						}
2959
-					} else {
2960
-
2961
-						data := make(map[string]interface{})
2962
-						data["struct_3507s"] = struct3507_2
2963
-						client := &http.Client{}
2964
-						bytesData, _ := json.Marshal(data)
2965
-						var req *http.Request
2966
-						if miConfig.MdtrtareaAdmvs == "320921" {
2967
-							req, _ = http.NewRequest("POST", "http://192.168.2.3:9532/"+"jsyb/3507", bytes.NewReader(bytesData))
2968
-						} else {
2969
-							req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3507", bytes.NewReader(bytesData))
2970
-						}
2971
-
2972
-						resp, _ := client.Do(req)
2973
-						defer resp.Body.Close()
2974
-						body, ioErr := ioutil.ReadAll(resp.Body)
2975
-						if ioErr != nil {
2976
-							utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
2977
-						}
2978
-						var respJSON map[string]interface{}
2979
-						if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
2980
-							utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
2981
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2982
-							return
2983
-						}
2984
-						var resSix10265 ResultSix10265 //1101结果
2985
-						respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
2986
-						result, _ := json.Marshal(respJSON)
2987
-						if err := json.Unmarshal([]byte(result), &resSix10265); err != nil {
2988
-							utils.ErrorLog("解析失败:%v", err)
2989
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2990
-							return
2991
-						}
2992
-						res2.InfRefmsgid = resSix10265.InfRefmsgid
2993
-						//res.Output = resSix10265.Output
2994
-						res2.ErrMsg = resSix10265.ErrMsg
2995
-						res2.Cainfo = resSix10265.Cainfo
2996
-						res2.WarnMsg = resSix10265.WarnMsg
2997
-						infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64)
2998
-						res2.Infcode = infocode
2999
-					}
3000
-
3001
-					if res2.Infcode == 0 {
3002
-						item.IsChange = 0
3003
-						item.BgBchno = ""
3004
-						service.SaveDF2(item)
3005
-					} else {
3006
-						err = append(err, "删除"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+"变更失败,失败原因:"+res.ErrMsg)
3007
-					}
3008
-				}
2929
+				service.SaveDF(item)
3009
 			} else {
2930
 			} else {
3010
 				err = append(err, "删除"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+"盘存失败,失败原因:"+res.ErrMsg)
2931
 				err = append(err, "删除"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+"盘存失败,失败原因:"+res.ErrMsg)
3011
 			}
2932
 			}
3043
 	advicelist, _ := service.FindeHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
2964
 	advicelist, _ := service.FindeHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
3044
 	var flows []*models.DrugFlow
2965
 	var flows []*models.DrugFlow
3045
 	for _, item := range advicelist {
2966
 	for _, item := range advicelist {
3046
-		flow, _ := service.GetNewDrugFlowInfoByPatient(patient_id, item.ID, stime, c.GetAdminUserInfo().CurrentOrgId)
2967
+		flow, _ := service.GetNewDrugFlowInfoByPatient(patient_id, item.DrugId, stime, c.GetAdminUserInfo().CurrentOrgId)
3047
 		flows = append(flows, flow...)
2968
 		flows = append(flows, flow...)
3048
 	}
2969
 	}
3049
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
2970
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3090
 						}
3011
 						}
3091
 					}
3012
 					}
3092
 					if res.Infcode == 0 {
3013
 					if res.Infcode == 0 {
3014
+						service.SaveDoctoradviceStatus(item.HisDoctorAdviceInfo.ID)
3093
 						item.IsSale = 1
3015
 						item.IsSale = 1
3094
 						item.Bchno = number
3016
 						item.Bchno = number
3095
 						item.SaleDate = time.Now().Format("2006-01-02")
3017
 						item.SaleDate = time.Now().Format("2006-01-02")
5252
 		struct3505.PharName = "彭斯遥"
5174
 		struct3505.PharName = "彭斯遥"
5253
 		struct3505.PharPracCertNo = "30220200943042010052"
5175
 		struct3505.PharPracCertNo = "30220200943042010052"
5254
 	}
5176
 	}
5177
+
5178
+	if org_id == 9504 {
5179
+		struct3505.PharName = "资美红"
5180
+		struct3505.PharPracCertNo = "D440904006635"
5181
+	}
5255
 	order := service.GetHisOrderByNumber(pre.BatchNumber)
5182
 	order := service.GetHisOrderByNumber(pre.BatchNumber)
5256
 	struct3505.SetlId = order.SetlId
5183
 	struct3505.SetlId = order.SetlId
5257
 	struct3505.MdtrtSn = order.MdtrtId
5184
 	struct3505.MdtrtSn = order.MdtrtId
5262
 
5189
 
5263
 	if drug.HisDoctorAdviceInfo.PrescribingNumberUnit != drug.HisDoctorAdviceInfo.BaseDrugLib.MinUnit {
5190
 	if drug.HisDoctorAdviceInfo.PrescribingNumberUnit != drug.HisDoctorAdviceInfo.BaseDrugLib.MinUnit {
5264
 		struct3505.TrdnFlag = "0"
5191
 		struct3505.TrdnFlag = "0"
5192
+
5265
 	} else {
5193
 	} else {
5266
 		struct3505.TrdnFlag = "1"
5194
 		struct3505.TrdnFlag = "1"
5267
 	}
5195
 	}
5268
 
5196
 
5197
+	if drug.HisDoctorAdviceInfo.ZeroFlag == 1{
5198
+		struct3505.TrdnFlag = "1"
5199
+	}
5200
+
5201
+	if drug.HisDoctorAdviceInfo.ZeroFlag == 2{
5202
+		struct3505.TrdnFlag = "0"
5203
+
5204
+	}
5205
+
5269
 	struct3505.RtalDocno = order.Number
5206
 	struct3505.RtalDocno = order.Number
5270
 	struct3505.PsnCertType = "01"
5207
 	struct3505.PsnCertType = "01"
5271
 
5208
 
33489
 						} else {
33426
 						} else {
33490
 							var result string
33427
 							var result string
33491
 							var request_log string
33428
 							var request_log string
33429
+							var dat map[string]interface{}
33430
+
33492
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
33431
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
33493
 							allTotal = fmt.Sprintf("%.2f", total_two)
33432
 							allTotal = fmt.Sprintf("%.2f", total_two)
33494
 							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" {
33433
 							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" {
33518
 
33457
 
33519
 										}
33458
 										}
33520
 
33459
 
33521
-										var dat map[string]interface{}
33522
 										if err := json.Unmarshal([]byte(result), &dat); err == nil {
33460
 										if err := json.Unmarshal([]byte(result), &dat); err == nil {
33523
 											fmt.Println(dat)
33461
 											fmt.Println(dat)
33524
 										} else {
33462
 										} else {
33541
 									result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
33479
 									result, request_log = service.Gdyb2206(his.PsnNo, his.Number, chrg_bchno, cert_no, insutype, allTotal, miConfig.OrgName, roles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, strconv.FormatInt(reg_type, 10), his.IdCardType, 0, 0, 0, 0, his.IdType, admin_user_id)
33542
 
33480
 
33543
 								}
33481
 								}
33482
+								if err := json.Unmarshal([]byte(result), &dat); err == nil {
33483
+									fmt.Println(dat)
33484
+								} else {
33485
+									fmt.Println(err)
33486
+								}
33487
+								saveLog(result, request_log, "2206", "预结算")
33544
 							}
33488
 							}
33545
 
33489
 
33546
-							var dat map[string]interface{}
33547
-							if err := json.Unmarshal([]byte(result), &dat); err == nil {
33548
-								fmt.Println(dat)
33549
-							} else {
33550
-								fmt.Println(err)
33551
-							}
33552
-							saveLog(result, request_log, "2206", "预结算")
33490
+
33553
 							//userJSONBytes, _ := json.Marshal(dat)
33491
 							//userJSONBytes, _ := json.Marshal(dat)
33554
 							//
33492
 							//
33555
 							//if err := json.Unmarshal(userJSONBytes, &res); err != nil {
33493
 							//if err := json.Unmarshal(userJSONBytes, &res); err != nil {

+ 3 - 0
models/his_models.go View File

239
 
239
 
240
 	NewGroupno string `gorm:"column:-" json:"new_groupno" form:"new_groupno"`
240
 	NewGroupno string `gorm:"column:-" json:"new_groupno" form:"new_groupno"`
241
 	Newfn      string `gorm:"column:-" json:"newfn" form:"newfn"`
241
 	Newfn      string `gorm:"column:-" json:"newfn" form:"newfn"`
242
+	IsUpload           int64 `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
243
+	ZeroFlag           int64 `gorm:"column:zero_flag" json:"zero_flag" form:"zero_flag"`
244
+
242
 
245
 
243
 	BaseDrugLib BaseDrugLib `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
246
 	BaseDrugLib BaseDrugLib `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
244
 }
247
 }

+ 24 - 247
service/gdyb_service.go View File

217
 
217
 
218
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
218
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
219
 
219
 
220
-	if insuplc_admdvs == "421300" {
221
-		var json2 string
222
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101A", string(bytesData), json2)
223
-		out, err := cmd.Output()
224
-		if err != nil {
225
-			fmt.Println("error:", err.Error())
226
-		}
227
-		fmt.Println(string(out))
228
-		return hex.EncodeToString(out)
229
-	} else {
220
+ {
230
 		request, err := http.NewRequest("POST", url, reader)
221
 		request, err := http.NewRequest("POST", url, reader)
231
 		if err != nil {
222
 		if err != nil {
232
 			fmt.Println(err.Error())
223
 			fmt.Println(err.Error())
316
 		url = gdyb_url + "2201"
307
 		url = gdyb_url + "2201"
317
 	}
308
 	}
318
 
309
 
319
-	if insuplc_admdvs == "421300" {
320
-		var json2 string
321
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
322
-		out, err := cmd.Output()
323
-		if err != nil {
324
-			fmt.Println("error:", err.Error())
325
-		}
326
-		fmt.Println(string(out))
327
-
328
-		return hex.EncodeToString(out), requestLog
329
-	} else {
310
+	  {
330
 		request, err := http.NewRequest("POST", url, reader)
311
 		request, err := http.NewRequest("POST", url, reader)
331
 		if err != nil {
312
 		if err != nil {
332
 			fmt.Println(err.Error())
313
 			fmt.Println(err.Error())
432
 		url = gdyb_url + "2201"
413
 		url = gdyb_url + "2201"
433
 	}
414
 	}
434
 
415
 
435
-	if insuplc_admdvs == "421300" {
436
-		var json2 string
437
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
438
-		out, err := cmd.Output()
439
-		if err != nil {
440
-			fmt.Println("error:", err.Error())
441
-		}
442
-		fmt.Println(string(out))
443
-
444
-		return hex.EncodeToString(out), requestLog
445
-	} else {
416
+	  {
446
 		fmt.Println(url)
417
 		fmt.Println(url)
447
 		fmt.Println(gdyb_paasid)
418
 		fmt.Println(gdyb_paasid)
448
 		fmt.Println(secret_key)
419
 		fmt.Println(secret_key)
534
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2202"
505
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2202"
535
 
506
 
536
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2202"
507
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2202"
537
-	if insuplc_admdvs == "421300" {
538
-		var json2 string
539
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2202", string(bytesData), json2)
540
-		out, err := cmd.Output()
541
-		if err != nil {
542
-			fmt.Println("error:", err.Error())
543
-		}
544
-		fmt.Println(string(out))
545
-
546
-		return hex.EncodeToString(out), requestLog
547
-	} else {
508
+	{
548
 
509
 
549
 		request, err := http.NewRequest("POST", url, reader)
510
 		request, err := http.NewRequest("POST", url, reader)
550
 		if err != nil {
511
 		if err != nil {
666
 		url = gdyb_url + "2203"
627
 		url = gdyb_url + "2203"
667
 	}
628
 	}
668
 
629
 
669
-	if insuplc_admdvs == "421300" {
670
-		var json2 string
671
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
672
-		out, err := cmd.Output()
673
-		if err != nil {
674
-			fmt.Println("error:", err.Error())
675
-		}
676
-		fmt.Println(string(out))
677
-
678
-		return hex.EncodeToString(out), requestLog
679
-	} else {
630
+	{
680
 		request, err := http.NewRequest("POST", url, reader)
631
 		request, err := http.NewRequest("POST", url, reader)
681
 		if err != nil {
632
 		if err != nil {
682
 			fmt.Println(err.Error())
633
 			fmt.Println(err.Error())
783
 	} else {
734
 	} else {
784
 		url = gdyb_url + "2203"
735
 		url = gdyb_url + "2203"
785
 	}
736
 	}
786
-
787
-	if insuplc_admdvs == "421300" {
788
-		var json2 string
789
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
790
-		out, err := cmd.Output()
791
-		if err != nil {
792
-			fmt.Println("error:", err.Error())
793
-		}
794
-		fmt.Println(string(out))
795
-
796
-		return hex.EncodeToString(out), requestLog
797
-	} else {
737
+ {
798
 		request, err := http.NewRequest("POST", url, reader)
738
 		request, err := http.NewRequest("POST", url, reader)
799
 		if err != nil {
739
 		if err != nil {
800
 			fmt.Println(err.Error())
740
 			fmt.Println(err.Error())
903
 		url = gdyb_url + "2203"
843
 		url = gdyb_url + "2203"
904
 	}
844
 	}
905
 
845
 
906
-	if insuplc_admdvs == "421300" {
907
-		var json2 string
908
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203A", string(bytesData), json2)
909
-		out, err := cmd.Output()
910
-		if err != nil {
911
-			fmt.Println("error:", err.Error())
912
-		}
913
-		fmt.Println(string(out))
914
-
915
-		return hex.EncodeToString(out), requestLog
916
-	} else {
846
+ {
917
 
847
 
918
 		request, err := http.NewRequest("POST", url, reader)
848
 		request, err := http.NewRequest("POST", url, reader)
919
 		if err != nil {
849
 		if err != nil {
1012
 	var url string
942
 	var url string
1013
 
943
 
1014
 	url = gdyb_url + "2203"
944
 	url = gdyb_url + "2203"
1015
-
1016
-	if insuplc_admdvs == "421300" {
1017
-		var json2 string
1018
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203A", string(bytesData), json2)
1019
-		out, err := cmd.Output()
1020
-		if err != nil {
1021
-			fmt.Println("error:", err.Error())
1022
-		}
1023
-		fmt.Println(string(out))
1024
-
1025
-		return hex.EncodeToString(out), requestLog
1026
-	} else {
945
+{
1027
 
946
 
1028
 		request, err := http.NewRequest("POST", url, reader)
947
 		request, err := http.NewRequest("POST", url, reader)
1029
 		if err != nil {
948
 		if err != nil {
1323
 
1242
 
1324
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
1243
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
1325
 
1244
 
1326
-	if insuplc_admdvs == "421300" {
1327
-		var json2 string
1328
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
1329
-		out, err := cmd.Output()
1330
-		if err != nil {
1331
-			fmt.Println("error:", err.Error())
1332
-		}
1333
-		fmt.Println(string(out))
1334
-
1335
-		return hex.EncodeToString(out), requestLog
1336
-	} else {
1245
+ {
1337
 
1246
 
1338
 		request, err := http.NewRequest("POST", url, reader)
1247
 		request, err := http.NewRequest("POST", url, reader)
1339
 		if err != nil {
1248
 		if err != nil {
1555
 
1464
 
1556
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
1465
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2204"
1557
 
1466
 
1558
-	if insuplc_admdvs == "421300" {
1559
-		var json2 string
1560
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
1561
-		out, err := cmd.Output()
1562
-		if err != nil {
1563
-			fmt.Println("error:", err.Error())
1564
-		}
1565
-		fmt.Println(string(out))
1566
-
1567
-		return hex.EncodeToString(out), requestLog
1568
-	} else {
1467
+	{
1569
 
1468
 
1570
 		request, err := http.NewRequest("POST", url, reader)
1469
 		request, err := http.NewRequest("POST", url, reader)
1571
 		if err != nil {
1470
 		if err != nil {
1652
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2205"
1551
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2205"
1653
 
1552
 
1654
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2205"
1553
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2205"
1655
-
1656
-	if insuplc_admdvs == "421300" {
1657
-		var json2 string
1658
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2205", string(bytesData), json2)
1659
-		out, err := cmd.Output()
1660
-		if err != nil {
1661
-			fmt.Println("error:", err.Error())
1662
-		}
1663
-		fmt.Println(string(out))
1664
-
1665
-		return hex.EncodeToString(out), requestLog
1666
-	} else {
1554
+{
1667
 		request, err := http.NewRequest("POST", url, reader)
1555
 		request, err := http.NewRequest("POST", url, reader)
1668
 		fmt.Println(err)
1556
 		fmt.Println(err)
1669
 
1557
 
1738
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1626
 			inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
1739
 		}
1627
 		}
1740
 	}
1628
 	}
1741
-	if insuplc_admdvs == "421300" {
1742
-		if med_type == "11" || med_type == "1112" || med_type == "1111" {
1743
-			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1744
-		} else if med_type == "14" {
1745
-			inputData["med_type"] = "140110" // 医疗类别 11 普通门诊  12 门诊挂号
1746
-		}
1747
-	} else {
1629
+	 {
1748
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
1630
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
1749
 	}
1631
 	}
1750
 
1632
 
1789
 
1671
 
1790
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2206"
1672
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2206"
1791
 
1673
 
1792
-	if insuplc_admdvs == "421300" {
1793
-		var json2 string
1794
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2206", string(bytesData), json2)
1795
-		out, err := cmd.Output()
1796
-		if err != nil {
1797
-			fmt.Println("error:", err.Error())
1798
-		}
1799
-		fmt.Println(string(out))
1800
-
1801
-		return hex.EncodeToString(out), requestLog
1802
-	} else {
1674
+	 {
1803
 		request, err := http.NewRequest("POST", url, reader)
1675
 		request, err := http.NewRequest("POST", url, reader)
1804
 		if err != nil {
1676
 		if err != nil {
1805
 			fmt.Println(err.Error())
1677
 			fmt.Println(err.Error())
1871
 	if med_type == "1111" || med_type == "1112" {
1743
 	if med_type == "1111" || med_type == "1112" {
1872
 		med_type = "11"
1744
 		med_type = "11"
1873
 	}
1745
 	}
1874
-	if insuplc_admdvs == "421300" {
1875
-		if med_type == "11" {
1876
-			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
1877
-		} else if med_type == "14" {
1878
-			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
1879
-		}
1880
-	} else {
1746
+ {
1881
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
1747
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
1882
 	}
1748
 	}
1883
 	inputData["medfee_sumamt"] = total           // 医疗费总额
1749
 	inputData["medfee_sumamt"] = total           // 医疗费总额
1920
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
1786
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
1921
 
1787
 
1922
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
1788
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
1923
-
1924
-	if insuplc_admdvs == "421300" {
1925
-		var json2 string
1926
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
1927
-		out, err := cmd.Output()
1928
-		if err != nil {
1929
-			fmt.Println("error:", err.Error())
1930
-		}
1931
-		mjson, _ := json.Marshal(inputMessage)
1932
-		str2 := string(mjson)
1933
-		fmt.Println(string(out))
1934
-
1935
-		return hex.EncodeToString(out), str2
1936
-	} else {
1789
+ {
1937
 
1790
 
1938
 		request, err := http.NewRequest("POST", url, reader)
1791
 		request, err := http.NewRequest("POST", url, reader)
1939
 		if err != nil {
1792
 		if err != nil {
1996
 	if med_type == "1111" || med_type == "1112" {
1849
 	if med_type == "1111" || med_type == "1112" {
1997
 		med_type = "11"
1850
 		med_type = "11"
1998
 	}
1851
 	}
1999
-	if insuplc_admdvs == "421300" {
2000
-		if med_type == "11" {
2001
-			inputData["med_type"] = "110104" // 医疗类别 11 普通门诊  12 门诊挂号
2002
-		} else if med_type == "14" {
2003
-			inputData["med_type"] = "140101" // 医疗类别 11 普通门诊  12 门诊挂号
2004
-		}
2005
-	} else {
1852
+	{
2006
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
1853
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
2007
 	}
1854
 	}
2008
 	inputData["medfee_sumamt"] = total           // 医疗费总额
1855
 	inputData["medfee_sumamt"] = total           // 医疗费总额
2046
 
1893
 
2047
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
1894
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
2048
 
1895
 
2049
-	if insuplc_admdvs == "421300" {
2050
-		var json2 string
2051
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
2052
-		out, err := cmd.Output()
2053
-		if err != nil {
2054
-			fmt.Println("error:", err.Error())
2055
-		}
2056
-		mjson, _ := json.Marshal(inputMessage)
2057
-		str2 := string(mjson)
2058
-		fmt.Println(string(out))
2059
-
2060
-		return hex.EncodeToString(out), str2
2061
-	} else {
1896
+ {
2062
 
1897
 
2063
 		request, err := http.NewRequest("POST", url, reader)
1898
 		request, err := http.NewRequest("POST", url, reader)
2064
 		if err != nil {
1899
 		if err != nil {
2147
 
1982
 
2148
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2208"
1983
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2208"
2149
 
1984
 
2150
-	if insuplc_admdvs == "421300" {
2151
-		var json2 string
2152
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
2153
-		out, err := cmd.Output()
2154
-		if err != nil {
2155
-			fmt.Println("error:", err.Error())
2156
-		}
2157
-		mjson, _ := json.Marshal(inputMessage)
2158
-		str2 := string(mjson)
2159
-		fmt.Println(string(out))
2160
-
2161
-		return hex.EncodeToString(out), str2
2162
-	} else {
1985
+	 {
2163
 		request, err := http.NewRequest("POST", url, reader)
1986
 		request, err := http.NewRequest("POST", url, reader)
2164
 		if err != nil {
1987
 		if err != nil {
2165
 			fmt.Println(err.Error())
1988
 			fmt.Println(err.Error())
5972
 	} else {
5795
 	} else {
5973
 		url = gdyb_url + "3260"
5796
 		url = gdyb_url + "3260"
5974
 	}
5797
 	}
5975
-
5976
-	if insuplc_admdvs == "421300" {
5977
-		var json2 string
5978
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
5979
-		out, err := cmd.Output()
5980
-		if err != nil {
5981
-			fmt.Println("error:", err.Error())
5982
-		}
5983
-		fmt.Println(string(out))
5984
-		return hex.EncodeToString(out), inputLog
5985
-	} else {
5798
+ {
5986
 
5799
 
5987
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
5800
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
5988
 		request, err := http.NewRequest("POST", url, reader)
5801
 		request, err := http.NewRequest("POST", url, reader)
6424
 		url = gdyb_url + "3262"
6237
 		url = gdyb_url + "3262"
6425
 	}
6238
 	}
6426
 
6239
 
6427
-	if insuplc_admdvs == "421300" {
6428
-		var json2 string
6429
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
6430
-		out, err := cmd.Output()
6431
-		if err != nil {
6432
-			fmt.Println("error:", err.Error())
6433
-		}
6434
-		fmt.Println(string(out))
6435
-		return hex.EncodeToString(out), inputLog
6436
-	} else {
6240
+	 {
6437
 
6241
 
6438
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6242
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6439
 		request, err := http.NewRequest("POST", url, reader)
6243
 		request, err := http.NewRequest("POST", url, reader)
6525
 		url = gdyb_url + "9001"
6329
 		url = gdyb_url + "9001"
6526
 	}
6330
 	}
6527
 
6331
 
6528
-	if insuplc_admdvs == "421300" {
6529
-		var json2 string
6530
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
6531
-		out, err := cmd.Output()
6532
-		if err != nil {
6533
-			fmt.Println("error:", err.Error())
6534
-		}
6535
-		fmt.Println(string(out))
6536
-		return hex.EncodeToString(out), inputLog
6537
-	} else {
6332
+ {
6538
 
6333
 
6539
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6334
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6540
 
6335
 
6619
 		url = gdyb_url + "9001"
6414
 		url = gdyb_url + "9001"
6620
 	}
6415
 	}
6621
 
6416
 
6622
-	if insuplc_admdvs == "421300" {
6623
-		var json2 string
6624
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
6625
-		out, err := cmd.Output()
6626
-		if err != nil {
6627
-			fmt.Println("error:", err.Error())
6628
-		}
6629
-		fmt.Println(string(out))
6630
-		return hex.EncodeToString(out), inputLog
6631
-	} else {
6417
+	 {
6632
 
6418
 
6633
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6419
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6634
 
6420
 
6792
 		url = gdyb_url + "1101"
6578
 		url = gdyb_url + "1101"
6793
 	}
6579
 	}
6794
 
6580
 
6795
-	if insuplc_admdvs == "421300" {
6796
-		var json2 string
6797
-		cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
6798
-		out, err := cmd.Output()
6799
-		if err != nil {
6800
-			fmt.Println("error:", err.Error())
6801
-		}
6802
-		fmt.Println(string(out))
6803
-		return hex.EncodeToString(out), inputLog
6804
-	} else {
6581
+ {
6805
 
6582
 
6806
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6583
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6807
 		request, err := http.NewRequest("POST", url, reader)
6584
 		request, err := http.NewRequest("POST", url, reader)
7438
 	input := make(map[string]interface{})
7215
 	input := make(map[string]interface{})
7439
 	inputData := make(map[string]interface{})
7216
 	inputData := make(map[string]interface{})
7440
 	inputMessage["infno"] = "3507"                          // 交易编码
7217
 	inputMessage["infno"] = "3507"                          // 交易编码
7441
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
7218
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
7442
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
7219
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
7443
 
7220
 
7444
 	input["data"] = inputData
7221
 	input["data"] = inputData

+ 17 - 4
service/his_service.go View File

1757
 }
1757
 }
1758
 
1758
 
1759
 func GetNewDrugFlowInfoByPatient(patient_id int64, drug_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1759
 func GetNewDrugFlowInfoByPatient(patient_id int64, drug_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1760
-	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1 and id in (?) and patinet_id = ? and drug_id = ? and system_time = ?", org_id, patient_id, drug_id, time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1760
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1  and patient_id = ? and drug_id = ? and system_time = ?", org_id, patient_id, drug_id, time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1761
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1761
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1762
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1762
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1763
 	return
1763
 	return
1764
 }
1764
 }
1765
 
1765
 
1766
 func GetNewUploadDrugFlowInfoByPatientTwo(patient_id int64, advice_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1766
 func GetNewUploadDrugFlowInfoByPatientTwo(patient_id int64, advice_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1767
-	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1 and id in (?) and patinet_id = ? and advice_id = ? and system_time = ? and is_sale = 1 and is_bg = 1", org_id, patient_id, advice_id, time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1767
+	err = readDb.Model(&models.DrugFlow{}).Where("user_org_id = ? and status = 1  and patient_id = ? and drug_id = ? and system_time = ? and is_sale = 1", org_id, patient_id, advice_id, time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1768
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1768
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1769
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1769
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1770
 	return
1770
 	return
1907
 	IsMedicine           int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1907
 	IsMedicine           int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1908
 	ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1908
 	ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1909
 	IsSelfDrug           int64 `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1909
 	IsSelfDrug           int64 `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1910
+	IsUpload           int64 `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
1911
+
1910
 }
1912
 }
1911
 
1913
 
1912
 type Drug struct {
1914
 type Drug struct {
2129
 
2131
 
2130
 func FindeHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2132
 func FindeHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2131
 
2133
 
2132
-	db := XTReadDB().Model(&advice).Where("status= 1 and is_medicine = 0 and drug_code <> ''")
2134
+	db := XTReadDB().Model(&advice).Where("status= 1  and drug_code <> ''")
2133
 
2135
 
2134
 	if orgid > 0 {
2136
 	if orgid > 0 {
2135
 		db = db.Where("user_org_id = ?", orgid)
2137
 		db = db.Where("user_org_id = ?", orgid)
2150
 
2152
 
2151
 func FindUploadHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2153
 func FindUploadHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2152
 
2154
 
2153
-	db := XTReadDB().Model(&advice).Where("status= 1 and is_medicine = 0")
2155
+	db := XTReadDB().Model(&advice).Where("status= 1")
2154
 
2156
 
2155
 	if orgid > 0 {
2157
 	if orgid > 0 {
2156
 		db = db.Where("user_org_id = ?", orgid)
2158
 		db = db.Where("user_org_id = ?", orgid)
2168
 	err = db.Find(&advice).Error
2170
 	err = db.Find(&advice).Error
2169
 	return advice, err
2171
 	return advice, err
2170
 }
2172
 }
2173
+
2174
+func SaveDoctoradviceStatus(id int64){
2175
+	 writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 1})
2176
+
2177
+}
2178
+
2179
+
2180
+func SaveDoctoradviceStatusTwo(id int64){
2181
+	writeDb.Model(&models.HisDoctorAdviceInfo{}).Where("id = ?", id).Updates(map[string]interface{}{"is_upload": 0})
2182
+
2183
+}