Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

test_user 4 months ago
parent
commit
7b60c1e645
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
 }
193
 }
194
 func (c *HisApiController) FJ3501AND3502() {
194
 func (c *HisApiController) FJ3501AND3502() {
195
 	ids := c.getString("ids")
195
 	ids := c.getString("ids")
196
-	//ids := c.getint("admin_")
197
 	admin_user_id, _ := c.GetInt64("admin_user_id")
196
 	admin_user_id, _ := c.GetInt64("admin_user_id")
198
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
197
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
199
 
198
 
224
 			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
223
 			struct3501.InvCnt = strconv.FormatInt(drug.StockMaxNumber, 10)
225
 			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02 15:04:05")
224
 			struct3501.ExpyEnd = time.Unix(drug.ExpiryDate, 0).Format("2006-01-02 15:04:05")
226
 			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3501"
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
 			result1, result2, result3 := service.FJyb3501(struct3501)
230
 			result1, result2, result3 := service.FJyb3501(struct3501)
229
 			fmt.Println(result1)
231
 			fmt.Println(result1)
230
 			fmt.Println(result2)
232
 			fmt.Println(result2)
251
 			struct3502.SignKey = miConfig.SignKey
253
 			struct3502.SignKey = miConfig.SignKey
252
 			struct3502.SecretKey = miConfig.SecretKey
254
 			struct3502.SecretKey = miConfig.SecretKey
253
 
255
 
254
-			struct3502.InvChgType = "102"
256
+			struct3502.Memo = ""
257
+			struct3502.InvChgType = "108"
255
 			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
258
 			struct3501.FixmedinsBchno = strconv.FormatInt(time.Now().Unix(), 10) + "-" + strconv.FormatInt(drug.ID, 10) + "-" + "3502"
256
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
259
 			struct3502.Cnt = strconv.FormatInt(drug.WarehousingCount, 10)
257
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
260
 			struct3502.Pric = fmt.Sprintf("%.2f", drug.BaseDrugLib.RetailPrice)
276
 			struct3502.SecretKey = miConfig.SecretKey
279
 			struct3502.SecretKey = miConfig.SecretKey
277
 			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
280
 			struct3502.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
278
 			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
281
 			struct3502.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
279
-			struct3502.InvChgType = "102"
282
+			struct3502.InvChgType = "108"
280
 
283
 
281
 			struct3502.Url = miConfig.Url
284
 			struct3502.Url = miConfig.Url
282
 			struct3502.AppId = miConfig.Cainfo
285
 			struct3502.AppId = miConfig.Cainfo
295
 		}
298
 		}
296
 	}
299
 	}
297
 }
300
 }
298
-
299
 func (c *HisApiController) DeletePCandBG() {
301
 func (c *HisApiController) DeletePCandBG() {
300
 	ids := c.getString("ids")
302
 	ids := c.getString("ids")
301
 	id_arr := strings.Split(ids, ",")
303
 	id_arr := strings.Split(ids, ",")
381
 			var struct3507 models.Struct3507
383
 			var struct3507 models.Struct3507
382
 			struct3507.FixmedinsBchno = ""
384
 			struct3507.FixmedinsBchno = ""
383
 			struct3507.InvDataType = "1"
385
 			struct3507.InvDataType = "1"
386
+			struct3507.Opter = roles.UserName
384
 			struct3507.OrgName = miConfig.OrgName
387
 			struct3507.OrgName = miConfig.OrgName
385
 			struct3507.AccessKey = miConfig.AccessKey
388
 			struct3507.AccessKey = miConfig.AccessKey
386
 			struct3507.RequestUrl = miConfig.Url
389
 			struct3507.RequestUrl = miConfig.Url
440
 	ids := c.getString("ids")
443
 	ids := c.getString("ids")
441
 	id_arr := strings.Split(ids, ",")
444
 	id_arr := strings.Split(ids, ",")
442
 	flows, _ := service.GetNewDrugFlowInfo(id_arr)
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
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
449
 	miConfig, _ := service.FindMedicalInsuranceInfo(c.GetAdminUserInfo().CurrentOrgId)
444
 
450
 
445
 	for _, item := range flows {
451
 	for _, item := range flows {
450
 				if item.IsSale == 1 { //是否已经销售,1是   0否
456
 				if item.IsSale == 1 { //是否已经销售,1是   0否
451
 					//是否已经变更 1是  0否
457
 					//是否已经变更 1是  0否
452
 					if item.IsChange == 0 { //没变更,进行变更操作
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
 				} else { //没销售,
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
 					if item.IsChange == 0 { //没变更,进行变更操作
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
 			} else { //还没结算
469
 			} else { //还没结算
464
 				if item.IsChange == 0 { //没变更,进行变更操作
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
 				if item.IsSale == 1 { //是否已经销售,1是   0否
481
 				if item.IsSale == 1 { //是否已经销售,1是   0否
476
 					//是否已经变更 1是  0否
482
 					//是否已经变更 1是  0否
477
 					if item.IsChange == 0 { //没变更,进行变更操作
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
 				} else { //没销售,
486
 				} else { //没销售,
481
 					//进行商品销售退货接口
487
 					//进行商品销售退货接口
482
 					CancleSaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item.HisDoctorAdviceInfo, miConfig, "")
488
 					CancleSaleStock(c.GetAdminUserInfo().CurrentOrgId, prescription, item.HisDoctorAdviceInfo, miConfig, "")
483
 					if item.IsChange == 0 { //没变更,进行变更操作
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
 			} else { //还没结算
493
 			} else { //还没结算
488
 				if item.IsChange == 0 { //没变更,进行变更操作
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
 		} else { //其他方式
500
 		} else { //其他方式
495
 			if item.IsChange == 0 { //没变更,进行变更操作
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
 	var struct3502 models.Struct3502
509
 	var struct3502 models.Struct3502
504
 	struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
510
 	struct3502.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
505
 	struct3502.FixmedinsHilistId = miConfig.Code
511
 	struct3502.FixmedinsHilistId = miConfig.Code
506
 	struct3502.FixmedinsHilistName = miConfig.OrgName
512
 	struct3502.FixmedinsHilistName = miConfig.OrgName
507
 	struct3502.FixmedinsCode = miConfig.Code
513
 	struct3502.FixmedinsCode = miConfig.Code
514
+	struct3502.Opter = role.UserName
508
 	struct3502.RxFlag = "0"
515
 	struct3502.RxFlag = "0"
509
 	struct3502.InvChgTime = time.Unix(drug.CreatedTime, 0).Format("2006-01-02 15:04:05")
516
 	struct3502.InvChgTime = time.Unix(drug.CreatedTime, 0).Format("2006-01-02 15:04:05")
510
 	struct3502.OrgName = miConfig.OrgName
517
 	struct3502.OrgName = miConfig.OrgName
531
 	fmt.Println(result3)
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
 	var struct3505 models.Struct3505
542
 	var struct3505 models.Struct3505
536
 	struct3505.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
543
 	struct3505.MedListCodg = drug.BaseDrugLib.MedicalInsuranceNumber
537
 	struct3505.FixmedinsHilistId = miConfig.Code
544
 	struct3505.FixmedinsHilistId = miConfig.Code

+ 1 - 1
service/fj_service.go View File

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