test_user il y a 1 mois
Parent
révision
2eca1fb202

+ 201 - 172
controllers/sg/his_api_controller.go Voir le fichier

@@ -3176,175 +3176,175 @@ func GetNowTime() (int64, int64) {
3176 3176
 //		})
3177 3177
 //	}
3178 3178
 //}
3179
-func (c *HisApiController) ChangeDrugfour() {
3180
-	patient_id, _ := c.GetInt64("patient_id")
3181
-	admin_user_id, _ := c.GetInt64("admin_user_id")
3182
-	//id_arr := strings.Split(ids, ",")
3183
-	times := c.GetString("time", "")
3184
-	timeLayout := "2006-01-02"
3185
-	loc, _ := time.LoadLocation("Local")
3186
-	var stime, etime int64
3187
-	if times == "" {
3188
-		stime, etime = GetNowTime()
3189
-	} else {
3190
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
3191
-		stime = stmp.Unix()
3192
-		etime = stime + 86399
3193
-	}
3194
-	advicelist, _ := service.FindeHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
3195
-	var flows []*models.DrugFlow
3196
-	for _, item := range advicelist {
3197
-		flow, _ := service.GetNewDrugFlowInfoByPatient(patient_id, item.DrugId, times, c.GetAdminUserInfo().CurrentOrgId)
3198
-		flows = append(flows, flow...)
3199
-	}
3200
-	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3201
-	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
3202
-	var err []string
3203
-
3204
-	for _, item := range flows {
3205
-		var res3 ResultSix
3206
-		if item.ConsumableType == 3 { //3为自动出库 7为自动退库
3207
-			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3208
-			if prescription.OrderStatus == 2 {
3209
-				//已经结算
3210
-				//判断是否已经销售
3211
-				if item.IsSale == 1 { //是否已经销售,1是   0否
3212
-					//是否已经变更 1是  0否
3213
-					if item.IsChange == 0 { //没变更,进行变更操作
3214
-						bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3215
-
3216
-						result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3217
-						saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
3218
-						var respJSON3 map[string]interface{}
3219
-						if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3220
-							utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3221
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3222
-							return
3223
-						}
3224
-						userJSONBytes3, _ := json.Marshal(respJSON3)
3225
-						if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3226
-							utils.ErrorLog("解析失败:%v", err)
3227
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3228
-							return
3229
-						}
3230
-						if res3.Infcode == 0 {
3231
-							item.IsChange = 1
3232
-							item.BgBchno = bg_number
3233
-							service.SaveDF2(item)
3234
-						} else {
3235
-
3236
-							err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3237
-						}
3238
-					}
3239
-				} else { //没销售,
3240
-					var res FJ3507Result
3241
-					var res3507for10188 FJ3507ResultFor10188
3242
-					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
3243
-
3244
-					//进行商品销售接口
3245
-					result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
3246
-					saveLog(result3, result4, "3505", "自动出库,未销售进行销售行为,3505")
3247
-					var respJSON3 map[string]interface{}
3248
-					if err := json.Unmarshal([]byte(string(result3)), &respJSON3); err != nil {
3249
-						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3250
-						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3251
-						return
3252
-					}
3253
-					userJSONBytes3, _ := json.Marshal(respJSON3)
3254
-					if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3255
-						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3256
-							utils.ErrorLog("解析失败:%v", err)
3257
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3258
-							return
3259
-						}
3260
-						//if res3507for10188.Infcode
3261
-						res.InfRefmsgid = res3507for10188.InfRefmsgid
3262
-						//res.Output = resSix10265.Output
3263
-						res.ErrMsg = res3507for10188.ErrMsg
3264
-						res.Cainfo = res3507for10188.Cainfo
3265
-						res.WarnMsg = res3507for10188.WarnMsg
3266
-						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3267
-						res.Infcode = infocode
3268
-					} else {
3269
-						if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
3270
-							utils.ErrorLog("解析失败:%v", err)
3271
-							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3272
-							return
3273
-						}
3274
-
3275
-					}
3276
-					if res.Infcode == 0 {
3277
-						item.IsSale = 1
3278
-						item.Bchno = number
3279
-						item.SaleDate = time.Now().Format("2006-01-02")
3280
-
3281
-						err5 := service.SaveDF(item)
3282
-						if err5 == nil {
3283
-							if item.IsChange == 0 { //没变更,进行变更操作
3284
-								bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3285
-
3286
-								result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3287
-								saveLog(result, result2, "3502", "自动出库,没销售,未变更3502")
3288
-
3289
-								var respJSON3 map[string]interface{}
3290
-								if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3291
-									utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3292
-									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3293
-									return
3294
-								}
3295
-								if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3296
-									if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3297
-										utils.ErrorLog("解析失败:%v", err)
3298
-										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3299
-										return
3300
-									}
3301
-									//if res3507for10188.Infcode
3302
-									res3.InfRefmsgid = res3507for10188.InfRefmsgid
3303
-									//res.Output = resSix10265.Output
3304
-									res3.ErrMsg = res3507for10188.ErrMsg
3305
-									res3.Cainfo = res3507for10188.Cainfo
3306
-									res3.WarnMsg = res3507for10188.WarnMsg
3307
-									infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3308
-									res3.Infcode = infocode
3309
-								} else {
3310
-									if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3311
-										utils.ErrorLog("解析失败:%v", err)
3312
-										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3313
-										return
3314
-									}
3315
-								}
3316
-								if res3.Infcode == 0 {
3317
-									item.IsChange = 1
3318
-									item.BgBchno = bg_number
3319
-									service.SaveDF2(item)
3320
-								} else {
3321
-
3322
-									err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3323
-								}
3324
-							}
3325
-						}
3326
-					} else {
3327
-
3328
-						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售失败:"+res.ErrMsg)
3329
-					}
3330
-				}
3331
-
3332
-			} else { //还没结,提示用户去结算,并药品追溯上传
3333
-				err = append(err, item.HisDoctorAdviceInfo.AdviceName+"还没结算,请结算后,在药品追溯页面上传")
3334
-			}
3335
-		}
3336
-	}
3337
-	if len(err) == 0 {
3338
-		c.ServeSuccessJSON(map[string]interface{}{
3339
-			"msg": "销售变更成功",
3340
-		})
3341
-	} else {
3342
-		c.ServeSuccessJSON(map[string]interface{}{
3343
-			"failed_code": -10,
3344
-			"msg":         err,
3345
-		})
3346
-	}
3347
-}
3179
+//func (c *HisApiController) ChangeDrugfour() {
3180
+//	patient_id, _ := c.GetInt64("patient_id")
3181
+//	admin_user_id, _ := c.GetInt64("admin_user_id")
3182
+//	//id_arr := strings.Split(ids, ",")
3183
+//	times := c.GetString("time", "")
3184
+//	timeLayout := "2006-01-02"
3185
+//	loc, _ := time.LoadLocation("Local")
3186
+//	var stime, etime int64
3187
+//	if times == "" {
3188
+//		stime, etime = GetNowTime()
3189
+//	} else {
3190
+//		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
3191
+//		stime = stmp.Unix()
3192
+//		etime = stime + 86399
3193
+//	}
3194
+//	advicelist, _ := service.FindeHisAdviceDocAdvice(c.GetAdminUserInfo().CurrentOrgId, patient_id, stime, etime)
3195
+//	var flows []*models.DrugFlow
3196
+//	for _, item := range advicelist {
3197
+//		flow, _ := service.GetNewDrugFlowInfoByPatient(patient_id, item.DrugId, times, c.GetAdminUserInfo().CurrentOrgId)
3198
+//		flows = append(flows, flow...)
3199
+//	}
3200
+//	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
3201
+//	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
3202
+//	var err []string
3203
+//
3204
+//	for _, item := range flows {
3205
+//		var res3 ResultSix
3206
+//		if item.ConsumableType == 3 { //3为自动出库 7为自动退库
3207
+//			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
3208
+//			if prescription.OrderStatus == 2 {
3209
+//				//已经结算
3210
+//				//判断是否已经销售
3211
+//				if item.IsSale == 1 { //是否已经销售,1是   0否
3212
+//					//是否已经变更 1是  0否
3213
+//					if item.IsChange == 0 { //没变更,进行变更操作
3214
+//						bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3215
+//
3216
+//						result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3217
+//						saveLog(result, result2, "3502", "自动出库,已经销售,未变更3502")
3218
+//						var respJSON3 map[string]interface{}
3219
+//						if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3220
+//							utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3221
+//							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3222
+//							return
3223
+//						}
3224
+//						userJSONBytes3, _ := json.Marshal(respJSON3)
3225
+//						if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3226
+//							utils.ErrorLog("解析失败:%v", err)
3227
+//							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3228
+//							return
3229
+//						}
3230
+//						if res3.Infcode == 0 {
3231
+//							item.IsChange = 1
3232
+//							item.BgBchno = bg_number
3233
+//							service.SaveDF2(item)
3234
+//						} else {
3235
+//
3236
+//							err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3237
+//						}
3238
+//					}
3239
+//				} else { //没销售,
3240
+//					var res FJ3507Result
3241
+//					var res3507for10188 FJ3507ResultFor10188
3242
+//					number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3505"
3243
+//
3244
+//					//进行商品销售接口
3245
+//					result3, result4 := SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item, miConfig, "", roles, number)
3246
+//					saveLog(result3, result4, "3505", "自动出库,未销售进行销售行为,3505")
3247
+//					var respJSON3 map[string]interface{}
3248
+//					if err := json.Unmarshal([]byte(string(result3)), &respJSON3); err != nil {
3249
+//						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3250
+//						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3251
+//						return
3252
+//					}
3253
+//					userJSONBytes3, _ := json.Marshal(respJSON3)
3254
+//					if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3255
+//						if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3256
+//							utils.ErrorLog("解析失败:%v", err)
3257
+//							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3258
+//							return
3259
+//						}
3260
+//						//if res3507for10188.Infcode
3261
+//						res.InfRefmsgid = res3507for10188.InfRefmsgid
3262
+//						//res.Output = resSix10265.Output
3263
+//						res.ErrMsg = res3507for10188.ErrMsg
3264
+//						res.Cainfo = res3507for10188.Cainfo
3265
+//						res.WarnMsg = res3507for10188.WarnMsg
3266
+//						infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3267
+//						res.Infcode = infocode
3268
+//					} else {
3269
+//						if err := json.Unmarshal(userJSONBytes3, &res); err != nil {
3270
+//							utils.ErrorLog("解析失败:%v", err)
3271
+//							c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3272
+//							return
3273
+//						}
3274
+//
3275
+//					}
3276
+//					if res.Infcode == 0 {
3277
+//						item.IsSale = 1
3278
+//						item.Bchno = number
3279
+//						item.SaleDate = time.Now().Format("2006-01-02")
3280
+//
3281
+//						err5 := service.SaveDF(item)
3282
+//						if err5 == nil {
3283
+//							if item.IsChange == 0 { //没变更,进行变更操作
3284
+//								bg_number := strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(item.ID, 10) + "-" + "3502"
3285
+//
3286
+//								result, result2 := ChangeStock(item.Count, item, miConfig, "102", roles, bg_number)
3287
+//								saveLog(result, result2, "3502", "自动出库,没销售,未变更3502")
3288
+//
3289
+//								var respJSON3 map[string]interface{}
3290
+//								if err := json.Unmarshal([]byte(string(result)), &respJSON3); err != nil {
3291
+//									utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
3292
+//									c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3293
+//									return
3294
+//								}
3295
+//								if c.GetAdminUserInfo().CurrentOrgId == 10188 || c.GetAdminUserInfo().CurrentOrgId == 10217 {
3296
+//									if err := json.Unmarshal(userJSONBytes3, &res3507for10188); err != nil {
3297
+//										utils.ErrorLog("解析失败:%v", err)
3298
+//										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3299
+//										return
3300
+//									}
3301
+//									//if res3507for10188.Infcode
3302
+//									res3.InfRefmsgid = res3507for10188.InfRefmsgid
3303
+//									//res.Output = resSix10265.Output
3304
+//									res3.ErrMsg = res3507for10188.ErrMsg
3305
+//									res3.Cainfo = res3507for10188.Cainfo
3306
+//									res3.WarnMsg = res3507for10188.WarnMsg
3307
+//									infocode, _ := strconv.ParseInt(res3507for10188.Infcode, 10, 64)
3308
+//									res3.Infcode = infocode
3309
+//								} else {
3310
+//									if err := json.Unmarshal(userJSONBytes3, &res3); err != nil {
3311
+//										utils.ErrorLog("解析失败:%v", err)
3312
+//										c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3313
+//										return
3314
+//									}
3315
+//								}
3316
+//								if res3.Infcode == 0 {
3317
+//									item.IsChange = 1
3318
+//									item.BgBchno = bg_number
3319
+//									service.SaveDF2(item)
3320
+//								} else {
3321
+//
3322
+//									err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
3323
+//								}
3324
+//							}
3325
+//						}
3326
+//					} else {
3327
+//
3328
+//						err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售失败:"+res.ErrMsg)
3329
+//					}
3330
+//				}
3331
+//
3332
+//			} else { //还没结,提示用户去结算,并药品追溯上传
3333
+//				err = append(err, item.HisDoctorAdviceInfo.AdviceName+"还没结算,请结算后,在药品追溯页面上传")
3334
+//			}
3335
+//		}
3336
+//	}
3337
+//	if len(err) == 0 {
3338
+//		c.ServeSuccessJSON(map[string]interface{}{
3339
+//			"msg": "销售变更成功",
3340
+//		})
3341
+//	} else {
3342
+//		c.ServeSuccessJSON(map[string]interface{}{
3343
+//			"failed_code": -10,
3344
+//			"msg":         err,
3345
+//		})
3346
+//	}
3347
+//}
3348 3348
 
3349 3349
 func (c *HisApiController) ChangeDrug() {
3350 3350
 	ids := c.GetString("ids")
@@ -4616,7 +4616,7 @@ func (c *HisApiController) ChangeDrugTen() {
4616 4616
 	//id_arr := strings.Split(ids, ",")
4617 4617
 	now := time.Now()
4618 4618
 	timestamp := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
4619
-	flows, _ := service.GetNewDrugFlowInforTen(timestamp)
4619
+	flows, _ := service.GetNewDrugFlowInforTen(timestamp,c.GetAdminUserInfo().CurrentOrgId)
4620 4620
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4621 4621
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4622 4622
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
@@ -4624,7 +4624,14 @@ func (c *HisApiController) ChangeDrugTen() {
4624 4624
 	for _, item := range flows {
4625 4625
 		var res3 ResultSix
4626 4626
 		if item.ConsumableType == 3 { //3为自动出库 7为自动退库
4627
+			if item.HisDoctorAdviceInfo.PrescriptionId == 0{
4628
+				continue
4629
+			}
4630
+			if item.HisDoctorAdviceInfo.PrescriptionId == 0{
4631
+				continue
4632
+			}
4627 4633
 			prescription := service.GetHisPrescriptionByID(item.HisDoctorAdviceInfo.PrescriptionId)
4634
+
4628 4635
 			if prescription.OrderStatus == 2 {
4629 4636
 				//已经结算
4630 4637
 				//判断是否已经销售
@@ -5059,7 +5066,7 @@ func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsu
5059 5066
 	struct3502.Code = miConfig.Code
5060 5067
 
5061 5068
 	struct3502.Opter = role.UserName
5062
-	struct3502.RxFlag = "0"
5069
+	struct3502.RxFlag = "1"
5063 5070
 	struct3502.InvChgTime = time.Now().Format("2006-01-02")
5064 5071
 	struct3502.OrgName = miConfig.OrgName
5065 5072
 	struct3502.AccessKey = miConfig.AccessKey
@@ -5088,6 +5095,9 @@ func ChangeStock(count int64, drug *models.DrugFlow, miConfig models.MedicalInsu
5088 5095
 		result1, result2 := service.Gzyb3502(struct3502, struct3502.SecretKey)
5089 5096
 		return result1, result2
5090 5097
 
5098
+	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440")  {
5099
+		result1, result2 := service.Gdyb3502(struct3502, struct3502.SecretKey)
5100
+		return result1, result2
5091 5101
 	} else {
5092 5102
 		data := make(map[string]interface{})
5093 5103
 		data["struct_3502s"] = struct3502
@@ -5149,15 +5159,31 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5149 5159
 		struct3505.PharPracCertNo = "210441200001378"
5150 5160
 	}
5151 5161
 
5162
+	if org_id == 10402 {
5163
+		struct3505.PharName = "刘韶健"
5164
+		struct3505.PharPracCertNo = "2015026440262015440501001198"
5165
+	}
5166
+
5167
+	if org_id == 10567 {
5168
+		struct3505.PharName = "范小兰"
5169
+		struct3505.PharPracCertNo = "0200102079485"
5170
+	}
5152 5171
 	order := service.GetHisOrderByNumber(pre.BatchNumber)
5153 5172
 	struct3505.SetlId = order.SetlId
5154 5173
 	struct3505.MdtrtSn = order.MdtrtId
5155 5174
 	struct3505.ManuLotnum = drug.Number
5156 5175
 	struct3505.ManuDate = time.Unix(drug.ProductDate, 0).Format("2006-01-02")
5157 5176
 	struct3505.ExpyEnd = ""
5158
-	struct3505.RxFlag = "0"
5177
+	struct3505.RxFlag = "1"
5159 5178
 	struct3505.TrdnFlag = "1"
5160 5179
 	struct3505.RtalDocno = order.Number
5180
+	struct3505.PsnCertType = "01"
5181
+
5182
+	struct3505.CertNo = order.Certno
5183
+	struct3505.PsnNo = order.PsnNo
5184
+	struct3505.PsnName = order.PsnName
5185
+
5186
+
5161 5187
 	struct3505.Url = miConfig.Url
5162 5188
 	struct3505.AppId = miConfig.Cainfo
5163 5189
 	struct3505.AppSecret = miConfig.AppSecret
@@ -5188,6 +5214,9 @@ func SaleStock(org_id int64, pre models.HisPrescription, drug *models.DrugFlow,
5188 5214
 	} else if miConfig.MdtrtareaAdmvs == "440100" {
5189 5215
 		result1, result2 := service.Gzyb3505(struct3505, struct3505.SecretKey)
5190 5216
 		return result1, result2
5217
+	}else if strings.HasPrefix(miConfig.MdtrtareaAdmvs[0:3], "440")  {
5218
+		result1, result2 := service.Gdyb3505(struct3505, struct3505.SecretKey)
5219
+		return result1, result2
5191 5220
 	} else {
5192 5221
 		data := make(map[string]interface{})
5193 5222
 		data["struct_3505s"] = struct3505

+ 1 - 1
models/new_stock_models.go Voir le fichier

@@ -423,7 +423,7 @@ type DrugFlow struct {
423 423
 	LastStockMaxNumber        int64                `gorm:"column:last_stock_max_number" json:"last_stock_max_number" form:"last_stock_max_number"`
424 424
 	LastStockMinNumber        int64                `gorm:"column:last_stock_min_number" json:"last_stock_min_number" form:"last_stock_min_number"`
425 425
 	AdviceId                  int64                `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
426
-	HisDoctorAdviceInfo       HisDoctorAdviceInfo  `gorm:"ForeignKey:PatientID,RecordDate;AssociationForeignKey,DrugId:PatientID,SystemTime,DrugId" json:"advice"`
426
+	HisDoctorAdviceInfo       HisDoctorAdviceInfo  `gorm:"ForeignKey:PatientID,RecordDate,DrugId;AssociationForeignKey:PatientID,SystemTime,DrugId" json:"advice"`
427 427
 	SupplyWarehouseId         int64                `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
428 428
 	SupplyCancelOutId         int64                `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
429 429
 	SupplyWarehouseDetailInfo int64                `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`

+ 14 - 7
service/gdyb_service.go Voir le fichier

@@ -8477,8 +8477,8 @@ func Gzyb3502(struct3502 models.Struct3502, secret_key string) (string, string)
8477 8477
 	inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
8478 8478
 	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
8479 8479
 
8480
-	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
8481
-	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
8480
+	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsHilistId // 定点医药机构目录编号
8481
+	inputData["fixmedins_hilist_name"] = struct3502.FixmedinsHilistName     // 定点医药机构目录名称
8482 8482
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
8483 8483
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
8484 8484
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
@@ -8500,10 +8500,10 @@ func Gzyb3502(struct3502 models.Struct3502, secret_key string) (string, string)
8500 8500
 	}
8501 8501
 	reader := bytes.NewReader(bytesData)
8502 8502
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
8503
-	gdyb_url := beego.AppConfig.String("gdyb_url")
8503
+	//gdyb_url := beego.AppConfig.String("gdyb_url")
8504 8504
 	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
8505 8505
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
8506
-	url := gdyb_url + "3502"
8506
+	url := "http://hosp-gz.gd.hsip.gov.cn/ebus/gdyb_api/prd/hsa/hgs/" + "3502"
8507 8507
 	request, err := http.NewRequest("POST", url, reader)
8508 8508
 	if err != nil {
8509 8509
 		fmt.Println(err.Error())
@@ -8700,7 +8700,7 @@ func Gzyb3505(struct3505 models.Struct3505, secret_key string) (string, string)
8700 8700
 	inputMessage["infno"] = "3505"                                  // 交易编码
8701 8701
 	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
8702 8702
 	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
8703
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName         // 定点医药机构目录名称
8703
+	inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName         // 定点医药机构目录名称
8704 8704
 	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
8705 8705
 
8706 8706
 	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
@@ -8731,6 +8731,7 @@ func Gzyb3505(struct3505 models.Struct3505, secret_key string) (string, string)
8731 8731
 
8732 8732
 	inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
8733 8733
 	inputData["stoout_no"] = struct3505.StooutNo   // 人员编号 (来自1101接口返回)
8734
+	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType                          // 人员编号 (来自1101接口返回)
8734 8735
 
8735 8736
 	inputData["bchno"] = struct3505.Bchno                          // 人员编号 (来自1101接口返回)
8736 8737
 	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
@@ -8751,10 +8752,16 @@ func Gzyb3505(struct3505 models.Struct3505, secret_key string) (string, string)
8751 8752
 	}
8752 8753
 	reader := bytes.NewReader(bytesData)
8753 8754
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
8754
-	gdyb_url := beego.AppConfig.String("gdyb_url")
8755
+	//gdyb_url := ""
8755 8756
 	gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
8757
+
8758
+
8756 8759
 	//url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
8757
-	url := gdyb_url + "3505"
8760
+	//url := "" + "3505"
8761
+	url := "http://hosp-gz.gd.hsip.gov.cn/ebus/gdyb_api/prd/hsa/hgs/" + "3505"
8762
+
8763
+	fmt.Println(gdyb_paasid)
8764
+	fmt.Println(url)
8758 8765
 	request, err := http.NewRequest("POST", url, reader)
8759 8766
 	if err != nil {
8760 8767
 		fmt.Println(err.Error())

+ 7 - 4
service/his_service.go Voir le fichier

@@ -612,6 +612,9 @@ type HisOrder struct {
612 612
 	PayWay                  int64   `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
613 613
 	PayPrice                float64 `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
614 614
 	PayCardNo               string  `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
615
+	Certno                  string    `gorm:"column:certno" json:"certno" form:"certno"`
616
+	PsnName                 string    `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
617
+
615 618
 	DiscountPrice           float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
616 619
 	PreferentialPrice       float64 `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
617 620
 	RealityPrice            float64 `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
@@ -1739,7 +1742,7 @@ func GetNewDrugFlowInfo(org_id int64, id_arr []string) (flows []*models.DrugFlow
1739 1742
 	return
1740 1743
 }
1741 1744
 
1742
-func GetNewDrugFlowInfoByPatient(patient_id int64, advdrug_idice_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1745
+func GetNewDrugFlowInfoByPatient(patient_id int64, drug_id int64, time int64, org_id int64) (flows []*models.DrugFlow, err error) {
1743 1746
 	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 {
1744 1747
 		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1745 1748
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
@@ -1767,9 +1770,9 @@ func GetNewDrugFlowInfothree() (flows []*models.DrugFlow, err error) {
1767 1770
 	return
1768 1771
 }
1769 1772
 
1770
-func GetNewDrugFlowInforTen(system_time int64) (flows []*models.DrugFlow, err error) {
1771
-	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("user_org_id = 10318 and status = 1 and consumable_type = 3 and is_sale = 0 and system_time = ?", system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1772
-		return db.Where("status = 1").Preload("BaseDrugLib", "status=1")
1773
+func GetNewDrugFlowInforTen(system_time int64,org_id int64) (flows []*models.DrugFlow, err error) {
1774
+	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id,system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1775
+		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1773 1776
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1774 1777
 	return
1775 1778
 }

+ 2 - 2
service/nm_service.go Voir le fichier

@@ -1078,7 +1078,7 @@ func NMyb3502(struct3502 models.Struct3502, secret_key string) (string, string)
1078 1078
 	inputData["inv_chg_type"] = struct3502.InvChgType   // 定点医药机构目录编号
1079 1079
 
1080 1080
 	inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
1081
-	inputData["fixmedins_hilist_name"] = struct3502.OrgName     // 定点医药机构目录名称
1081
+	inputData["fixmedins_hilist_name"] = struct3502.FixmedinsHilistName     // 定点医药机构目录名称
1082 1082
 	inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno    // 人员编号 (来自1101接口返回)
1083 1083
 	inputData["pric"] = struct3502.Pric                         // 人员编号 (来自1101接口返回)
1084 1084
 	inputData["cnt"] = struct3502.Cnt                           // 人员编号 (来自1101接口返回)
@@ -1294,7 +1294,7 @@ func NMyb3505(struct3505 models.Struct3505, secret_key string) (string,string) {
1294 1294
 	inputMessage["infno"] = "3505"                                  // 交易编码
1295 1295
 	inputData["med_list_codg"] = struct3505.MedListCodg             // 定点医药机构目录编号
1296 1296
 	inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
1297
-	inputData["fixmedins_hilist_name"] = struct3505.OrgName         // 定点医药机构目录名称
1297
+	inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName         // 定点医药机构目录名称
1298 1298
 	inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno        // 人员编号 (来自1101接口返回)
1299 1299
 
1300 1300
 	inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)