陈少旭 5 months ago
parent
commit
903f74a381
2 changed files with 23 additions and 16 deletions
  1. 22 15
      controllers/sg/his_api_controller.go
  2. 1 1
      service/fj_service.go

+ 22 - 15
controllers/sg/his_api_controller.go View File

@@ -193,7 +193,6 @@ func HisManagerApiRegistRouters() {
193 193
 }
194 194
 func (c *HisApiController) FJ3501AND3502() {
195 195
 	ids := c.getString("ids")
196
-	//ids := c.getint("admin_")
197 196
 	admin_user_id, _ := c.GetInt64("admin_user_id")
198 197
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
199 198
 
@@ -224,7 +223,10 @@ func (c *HisApiController) FJ3501AND3502() {
224 223
 			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
225 224
 			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02 15:04:05")
226 225
 			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3501"
227
-			struct3501.Memo = "入库"
226
+			memo := make(map[string]interface{})
227
+			memo["pric"] = drug.Price
228
+			bytesData, _ := json.Marshal(memo)
229
+			struct3501.Memo = string(bytesData)
228 230
 			result1, result2, result3 := service.FJyb3501(struct3501)
229 231
 			fmt.Println(result1)
230 232
 			fmt.Println(result2)
@@ -251,7 +253,8 @@ func (c *HisApiController) FJ3501AND3502() {
251 253
 			struct3502.SignKey = miConfig.SignKey
252 254
 			struct3502.SecretKey = miConfig.SecretKey
253 255
 
254
-			struct3502.InvChgType = "102"
256
+			struct3502.Memo = ""
257
+			struct3502.InvChgType = "108"
255 258
 			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
256 259
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
257 260
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
@@ -276,7 +279,7 @@ func (c *HisApiController) FJ3501AND3502() {
276 279
 			struct3502.SecretKey = miConfig.SecretKey
277 280
 			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
278 281
 			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
279
-			struct3502.InvChgType = "102"
282
+			struct3502.InvChgType = "108"
280 283
 
281 284
 			struct3502.Url = miConfig.Url
282 285
 			struct3502.AppId = miConfig.Cainfo
@@ -295,7 +298,6 @@ func (c *HisApiController) FJ3501AND3502() {
295 298
 		}
296 299
 	}
297 300
 }
298
-
299 301
 func (c *HisApiController) DeletePCandBG() {
300 302
 	ids := c.getString("ids")
301 303
 	id_arr := strings.Split(ids, ",")
@@ -381,6 +383,7 @@ func (c *HisApiController) DeleteXSandBG() {
381 383
 			var struct3507 models.Struct3507
382 384
 			struct3507.FixmedinsBchno = ""
383 385
 			struct3507.InvDataType = "1"
386
+			struct3507.Opter = roles.UserName
384 387
 			struct3507.OrgName = miConfig.OrgName
385 388
 			struct3507.AccessKey = miConfig.AccessKey
386 389
 			struct3507.RequestUrl = miConfig.Url
@@ -440,6 +443,9 @@ func (c *HisApiController) ChangeDrug() {
440 443
 	ids := c.getString("ids")
441 444
 	id_arr := strings.Split(ids, ",")
442 445
 	flows, _ := service.GetNewDrugFlowInfo(id_arr)
446
+	admin_user_id, _ := c.GetInt64("admin_user_id")
447
+	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
448
+
443 449
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
444 450
 
445 451
 	for _, item := range flows {
@@ -450,19 +456,19 @@ func (c *HisApiController) ChangeDrug() {
450 456
 				if item.IsSale == 1 { //是否已经销售,1是   0否
451 457
 					//是否已经变更 1是  0否
452 458
 					if item.IsChange == 0 { //没变更,进行变更操作
453
-						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
459
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102", roles)
454 460
 					}
455 461
 				} else { //没销售,
456 462
 					//进行商品销售接口
457
-					SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item.HisDoctorAdviceInfo, miConfig, "")
463
+					SaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item.HisDoctorAdviceInfo, miConfig, "", roles)
458 464
 
459 465
 					if item.IsChange == 0 { //没变更,进行变更操作
460
-						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
466
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102", roles)
461 467
 					}
462 468
 				}
463 469
 			} else { //还没结算
464 470
 				if item.IsChange == 0 { //没变更,进行变更操作
465
-					ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
471
+					ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102", roles)
466 472
 
467 473
 				}
468 474
 			}
@@ -475,36 +481,37 @@ func (c *HisApiController) ChangeDrug() {
475 481
 				if item.IsSale == 1 { //是否已经销售,1是   0否
476 482
 					//是否已经变更 1是  0否
477 483
 					if item.IsChange == 0 { //没变更,进行变更操作
478
-						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
484
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102", roles)
479 485
 					}
480 486
 				} else { //没销售,
481 487
 					//进行商品销售退货接口
482 488
 					CancleSaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item.HisDoctorAdviceInfo, miConfig, "")
483 489
 					if item.IsChange == 0 { //没变更,进行变更操作
484
-						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
490
+						ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102", roles)
485 491
 					}
486 492
 				}
487 493
 			} else { //还没结算
488 494
 				if item.IsChange == 0 { //没变更,进行变更操作
489
-					ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
495
+					ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102", roles)
490 496
 
491 497
 				}
492 498
 			}
493 499
 
494 500
 		} else { //其他方式
495 501
 			if item.IsChange == 0 { //没变更,进行变更操作
496
-				ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102")
502
+				ChangeStock(item.Count, item.HisDoctorAdviceInfo, miConfig, "102", roles)
497 503
 			}
498 504
 		}
499 505
 	}
500 506
 }
501 507
 
502
-func ChangeStock(count int64, drug models.HisDoctorAdviceInfo, miConfig models.MedicalInsuranceOrgConfig, chgType string) {
508
+func ChangeStock(count int64, drug models.HisDoctorAdviceInfo, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole) {
503 509
 	var struct3502 models.Struct3502
504 510
 	struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
505 511
 	struct3502.FixmedinsHilistId = miConfig.Code
506 512
 	struct3502.FixmedinsHilistName = miConfig.OrgName
507 513
 	struct3502.FixmedinsCode = miConfig.Code
514
+	struct3502.Opter = role.UserName
508 515
 	struct3502.RxFlag = "0"
509 516
 	struct3502.InvChgTime = time.Unix(drug.CreatedTime, 0).Format("2006-01-02 15:04:05")
510 517
 	struct3502.OrgName = miConfig.OrgName
@@ -531,7 +538,7 @@ func ChangeStock(count int64, drug models.HisDoctorAdviceInfo, miConfig models.M
531 538
 	fmt.Println(result3)
532 539
 
533 540
 }
534
-func SaleStock(org_id int64, pre models.HisPrescription, drug models.HisDoctorAdviceInfo, miConfig models.MedicalInsuranceOrgConfig, chgType string) {
541
+func SaleStock(org_id int64, pre models.HisPrescription, drug models.HisDoctorAdviceInfo, miConfig models.MedicalInsuranceOrgConfig, chgType string, role models.UserAdminRole) {
535 542
 	var struct3505 models.Struct3505
536 543
 	struct3505.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
537 544
 	struct3505.FixmedinsHilistId = miConfig.Code

+ 1 - 1
service/fj_service.go View File

@@ -3036,7 +3036,7 @@ func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
3036 3036
 	inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno        // 人员编号 (来自1101接口返回)
3037 3037
 	inputData["manu_date"] = struct3501.ManuDate                    // 人员编号 (来自1101接口返回)
3038 3038
 	inputData["expy_end"] = struct3501.ExpyEnd                      // 人员编号 (来自1101接口返回)
3039
-	inputData["memo"] = ""                                          // 人员编号 (来自1101接口返回)
3039
+	inputData["memo"] = struct3501.Memo                             // 人员编号 (来自1101接口返回)
3040 3040
 	druginputData["drug_trac_codg"] = "123"
3041 3041
 	//druginputData2["drugtracinfo"] = druginputData
3042 3042
 	inputData["drug_trac_info"] = druginputData