test_user 4 semanas atrás
pai
commit
23b88ab2c8
4 arquivos alterados com 85 adições e 354 exclusões
  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 Ver arquivo

@@ -34,6 +34,8 @@ import (
34 34
 	"syscall"
35 35
 	"time"
36 36
 	"unsafe"
37
+	"github.com/go-ole/go-ole"
38
+
37 39
 )
38 40
 
39 41
 type HisApiController struct {
@@ -204,7 +206,11 @@ func HisManagerApiRegistRouters() {
204 206
 	beego.Router("/api/35082", &HisApiController{}, "get:Get35082")
205 207
 
206 208
 	beego.Router("/api/changedrug/four", &HisApiController{}, "get:ChangeDrugfour")
209
+	beego.Router("/api/changedrug/five", &HisApiController{}, "get:ChangeDrugFive")
210
+
207 211
 	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
212
+	beego.Router("/api/delete_xs_bg_two", &HisApiController{}, "get:DeleteXSandBGTwo")
213
+
208 214
 	beego.Router("/api/3201", &HisApiController{}, "get:Get3201")
209 215
 
210 216
 }
@@ -224,9 +230,11 @@ func (c *HisApiController) Get3201() {
224 230
 }
225 231
 
226 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 240
 func (c *HisApiController) Get3508() {
@@ -2727,10 +2735,11 @@ func (c *HisApiController) DeleteXSandBGTwo() {
2727 2735
 		stime = stmp.Unix()
2728 2736
 		etime = stime + 86399
2729 2737
 	}
2738
+
2730 2739
 	advicelist, _ := service.FindUploadHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
2731 2740
 	var flows []*models.DrugFlow
2732 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 2743
 		flows = append(flows, flow...)
2735 2744
 	}
2736 2745
 
@@ -2742,7 +2751,6 @@ func (c *HisApiController) DeleteXSandBGTwo() {
2742 2751
 	for _, item := range flows {
2743 2752
 		if item.IsSale == 1 {
2744 2753
 			var res FJ3507Result
2745
-			var res2 FJ3507Result
2746 2754
 
2747 2755
 			var struct3507 models.Struct3507
2748 2756
 			struct3507.FixmedinsBchno = item.Bchno
@@ -2914,98 +2922,11 @@ func (c *HisApiController) DeleteXSandBGTwo() {
2914 2922
 			}
2915 2923
 
2916 2924
 			if res.Infcode == 0 {
2925
+				service.SaveDoctoradviceStatusTwo(item.HisDoctorAdviceInfo.ID)
2917 2926
 				item.IsSale = 0
2918 2927
 				item.SaleDate = ""
2919 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 2930
 			} else {
3010 2931
 				err = append(err, "删除"+item.HisDoctorAdviceInfo.BaseDrugLib.DrugName+"盘存失败,失败原因:"+res.ErrMsg)
3011 2932
 			}
@@ -3043,7 +2964,7 @@ func (c *HisApiController) ChangeDrugfour() {
3043 2964
 	advicelist, _ := service.FindeHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
3044 2965
 	var flows []*models.DrugFlow
3045 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 2968
 		flows = append(flows, flow...)
3048 2969
 	}
3049 2970
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
@@ -3090,6 +3011,7 @@ func (c *HisApiController) ChangeDrugfour() {
3090 3011
 						}
3091 3012
 					}
3092 3013
 					if res.Infcode == 0 {
3014
+						service.SaveDoctoradviceStatus(item.HisDoctorAdviceInfo.ID)
3093 3015
 						item.IsSale = 1
3094 3016
 						item.Bchno = number
3095 3017
 						item.SaleDate = time.Now().Format("2006-01-02")
@@ -5252,6 +5174,11 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5252 5174
 		struct3505.PharName = "彭斯遥"
5253 5175
 		struct3505.PharPracCertNo = "30220200943042010052"
5254 5176
 	}
5177
+
5178
+	if org_id == 9504 {
5179
+		struct3505.PharName = "资美红"
5180
+		struct3505.PharPracCertNo = "D440904006635"
5181
+	}
5255 5182
 	order := service.GetHisOrderByNumber(pre.BatchNumber)
5256 5183
 	struct3505.SetlId = order.SetlId
5257 5184
 	struct3505.MdtrtSn = order.MdtrtId
@@ -5262,10 +5189,20 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5262 5189
 
5263 5190
 	if drug.HisDoctorAdviceInfo.PrescribingNumberUnit != drug.HisDoctorAdviceInfo.BaseDrugLib.MinUnit {
5264 5191
 		struct3505.TrdnFlag = "0"
5192
+
5265 5193
 	} else {
5266 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 5206
 	struct3505.RtalDocno = order.Number
5270 5207
 	struct3505.PsnCertType = "01"
5271 5208
 
@@ -33489,6 +33426,8 @@ func (c *HisApiController) GetPreUploadInfo() {
33489 33426
 						} else {
33490 33427
 							var result string
33491 33428
 							var request_log string
33429
+							var dat map[string]interface{}
33430
+
33492 33431
 							psn_info, _ := service.GetPsnByPatientId(his.PatientId)
33493 33432
 							allTotal = fmt.Sprintf("%.2f", total_two)
33494 33433
 							if miConfig.Code == "H44030501364" || miConfig.Code == "H44030903432" {
@@ -33518,7 +33457,6 @@ func (c *HisApiController) GetPreUploadInfo() {
33518 33457
 
33519 33458
 										}
33520 33459
 
33521
-										var dat map[string]interface{}
33522 33460
 										if err := json.Unmarshal([]byte(result), &dat); err == nil {
33523 33461
 											fmt.Println(dat)
33524 33462
 										} else {
@@ -33541,15 +33479,15 @@ func (c *HisApiController) GetPreUploadInfo() {
33541 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 33491
 							//userJSONBytes, _ := json.Marshal(dat)
33554 33492
 							//
33555 33493
 							//if err := json.Unmarshal(userJSONBytes, &res); err != nil {

+ 3 - 0
models/his_models.go Ver arquivo

@@ -239,6 +239,9 @@ type HisDoctorAdviceInfo struct {
239 239
 
240 240
 	NewGroupno string `gorm:"column:-" json:"new_groupno" form:"new_groupno"`
241 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 246
 	BaseDrugLib BaseDrugLib `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug"`
244 247
 }

+ 24 - 247
service/gdyb_service.go Ver arquivo

@@ -217,16 +217,7 @@ func Gdyb1101A(certNo string, org_name string, doctor string, fixmedins_code str
217 217
 
218 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 221
 		request, err := http.NewRequest("POST", url, reader)
231 222
 		if err != nil {
232 223
 			fmt.Println(err.Error())
@@ -316,17 +307,7 @@ func Gdyb2201(psnNo string, insutype string, certNo string, org_name string, ope
316 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 311
 		request, err := http.NewRequest("POST", url, reader)
331 312
 		if err != nil {
332 313
 			fmt.Println(err.Error())
@@ -432,17 +413,7 @@ func Gdyb2201A(psnNo string, insutype string, certNo string, org_name string, op
432 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 417
 		fmt.Println(url)
447 418
 		fmt.Println(gdyb_paasid)
448 419
 		fmt.Println(secret_key)
@@ -534,17 +505,7 @@ func Gdyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string,
534 505
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2202"
535 506
 
536 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 510
 		request, err := http.NewRequest("POST", url, reader)
550 511
 		if err != nil {
@@ -666,17 +627,7 @@ func Gdyb2203(psnNo string, mdtrtId string, doctor string, department string, or
666 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 631
 		request, err := http.NewRequest("POST", url, reader)
681 632
 		if err != nil {
682 633
 			fmt.Println(err.Error())
@@ -783,18 +734,7 @@ func Gdyb2203c(psnNo string, mdtrtId string, doctor string, department string, o
783 734
 	} else {
784 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 738
 		request, err := http.NewRequest("POST", url, reader)
799 739
 		if err != nil {
800 740
 			fmt.Println(err.Error())
@@ -903,17 +843,7 @@ func Gdyb2203A(psnNo string, mdtrtId string, doctor string, department string, o
903 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 848
 		request, err := http.NewRequest("POST", url, reader)
919 849
 		if err != nil {
@@ -1012,18 +942,7 @@ func Gdyb2203d(psnNo string, mdtrtId string, doctor string, department string, o
1012 942
 	var url string
1013 943
 
1014 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 947
 		request, err := http.NewRequest("POST", url, reader)
1029 948
 		if err != nil {
@@ -1323,17 +1242,7 @@ func Gdyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescri
1323 1242
 
1324 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 1247
 		request, err := http.NewRequest("POST", url, reader)
1339 1248
 		if err != nil {
@@ -1555,17 +1464,7 @@ func Gdyb2204For441799(psnNo string, mdtrtId string, hisPrescription []*models.H
1555 1464
 
1556 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 1469
 		request, err := http.NewRequest("POST", url, reader)
1571 1470
 		if err != nil {
@@ -1652,18 +1551,7 @@ func Gdyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, d
1652 1551
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2205"
1653 1552
 
1654 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 1555
 		request, err := http.NewRequest("POST", url, reader)
1668 1556
 		fmt.Println(err)
1669 1557
 
@@ -1738,13 +1626,7 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
1738 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 1630
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
1749 1631
 	}
1750 1632
 
@@ -1789,17 +1671,7 @@ func Gdyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
1789 1671
 
1790 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 1675
 		request, err := http.NewRequest("POST", url, reader)
1804 1676
 		if err != nil {
1805 1677
 			fmt.Println(err.Error())
@@ -1871,13 +1743,7 @@ func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
1871 1743
 	if med_type == "1111" || med_type == "1112" {
1872 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 1747
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
1882 1748
 	}
1883 1749
 	inputData["medfee_sumamt"] = total           // 医疗费总额
@@ -1920,20 +1786,7 @@ func Gdyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, ins
1920 1786
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
1921 1787
 
1922 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 1791
 		request, err := http.NewRequest("POST", url, reader)
1939 1792
 		if err != nil {
@@ -1996,13 +1849,7 @@ func Gdyb2207A(psnNo string, mdtrtId string, chrgBchno string, certNo string, in
1996 1849
 	if med_type == "1111" || med_type == "1112" {
1997 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 1853
 		inputData["med_type"] = med_type // 医疗类别 11 普通门诊  12 门诊挂号
2007 1854
 	}
2008 1855
 	inputData["medfee_sumamt"] = total           // 医疗费总额
@@ -2046,19 +1893,7 @@ func Gdyb2207A(psnNo string, mdtrtId string, chrgBchno string, certNo string, in
2046 1893
 
2047 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 1898
 		request, err := http.NewRequest("POST", url, reader)
2064 1899
 		if err != nil {
@@ -2147,19 +1982,7 @@ func Gdyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doct
2147 1982
 
2148 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 1986
 		request, err := http.NewRequest("POST", url, reader)
2164 1987
 		if err != nil {
2165 1988
 			fmt.Println(err.Error())
@@ -5972,17 +5795,7 @@ func Gdyb3260(org_name string, doctor string, fixmedins_code string, insuplc_adm
5972 5795
 	} else {
5973 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 5800
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
5988 5801
 		request, err := http.NewRequest("POST", url, reader)
@@ -6424,16 +6237,7 @@ func Gdyb3262(org_name string, doctor string, fixmedins_code string, insuplc_adm
6424 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 6242
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6439 6243
 		request, err := http.NewRequest("POST", url, reader)
@@ -6525,16 +6329,7 @@ func Gdyb9001(org_name string, doctor string, fixmedins_code string, insuplc_adm
6525 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 6334
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6540 6335
 
@@ -6619,16 +6414,7 @@ func Gdyb9001Two(org_name string, doctor string, fixmedins_code string, insuplc_
6619 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 6419
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6634 6420
 
@@ -6792,16 +6578,7 @@ func Gdyb1101D(certNo string, org_name string, doctor string, fixmedins_code str
6792 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 6583
 		//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
6807 6584
 		request, err := http.NewRequest("POST", url, reader)
@@ -7438,7 +7215,7 @@ func Gdyb3507(struct3507 models.Struct3507, secret_key string) (string, string)
7438 7215
 	input := make(map[string]interface{})
7439 7216
 	inputData := make(map[string]interface{})
7440 7217
 	inputMessage["infno"] = "3507"                          // 交易编码
7441
-	inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
7218
+	inputData["fixmedins_bchno"] = struct3507.FixmedinsBchno // 人员编号 (来自1101接口返回)
7442 7219
 	inputData["inv_data_type"] = struct3507.InvDataType     // 人员编号 (来自1101接口返回)
7443 7220
 
7444 7221
 	input["data"] = inputData

+ 17 - 4
service/his_service.go Ver arquivo

@@ -1757,14 +1757,14 @@ func GetNewDrugFlowInfo(org_id int64, id_arr []string) (flows []*models.DrugFlow
1757 1757
 }
1758 1758
 
1759 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 1761
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1762 1762
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1763 1763
 	return
1764 1764
 }
1765 1765
 
1766 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 1768
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1769 1769
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1770 1770
 	return
@@ -1907,6 +1907,8 @@ type HisDoctorAdviceInfo struct {
1907 1907
 	IsMedicine           int64 `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
1908 1908
 	ExecutionFrequencyId int64 `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
1909 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 1914
 type Drug struct {
@@ -2129,7 +2131,7 @@ func (HisPrescriptionProject) TableName() string {
2129 2131
 
2130 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 2136
 	if orgid > 0 {
2135 2137
 		db = db.Where("user_org_id = ?", orgid)
@@ -2150,7 +2152,7 @@ func FindeHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime i
2150 2152
 
2151 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 2157
 	if orgid > 0 {
2156 2158
 		db = db.Where("user_org_id = ?", orgid)
@@ -2168,3 +2170,14 @@ func FindUploadHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, et
2168 2170
 	err = db.Find(&advice).Error
2169 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
+}