28169 1 год назад
Родитель
Сommit
8e84e72dff

+ 8 - 4
controllers/his_api_controller.go Просмотреть файл

@@ -1648,9 +1648,11 @@ func (c *HisApiController) GetHisPatientInfo() {
1648 1648
 				if info.RetailPrice > 0 {
1649 1649
 					subItem.Drug.MinPrice = info.RetailPrice
1650 1650
 
1651
-					service.UpdatePrescriptionAdvice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice, subItem.PatientId)
1651
+					if admin.CurrentOrgId != 10598 {
1652 1652
 
1653
-					service.UpdateBaseMinPrice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1653
+						service.UpdatePrescriptionAdvice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice, subItem.PatientId)
1654
+						service.UpdateBaseMinPrice(subItem.DrugId, admin.CurrentOrgId, info.RetailPrice)
1655
+					}
1654 1656
 
1655 1657
 				}
1656 1658
 			}
@@ -1665,9 +1667,11 @@ func (c *HisApiController) GetHisPatientInfo() {
1665 1667
 					if info.Price > 0 {
1666 1668
 						subItem.GoodInfo.PackingPrice = info.Price
1667 1669
 
1668
-						service.UpdatePrescriptionProject(subItem.ProjectId, admin.CurrentOrgId, info.Price, subItem.PatientId)
1670
+						if admin.CurrentOrgId != 10598 {
1669 1671
 
1670
-						service.UpdateGood(subItem.ProjectId, admin.CurrentOrgId, info.Price)
1672
+							service.UpdatePrescriptionProject(subItem.ProjectId, admin.CurrentOrgId, info.Price, subItem.PatientId)
1673
+							service.UpdateGood(subItem.ProjectId, admin.CurrentOrgId, info.Price)
1674
+						}
1671 1675
 
1672 1676
 					}
1673 1677
 				}

+ 16 - 16
controllers/mobile_api_controllers/patient_api_controller.go Просмотреть файл

@@ -1696,22 +1696,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1696 1696
 				//fmt.Println("config+++++++++++", config.IsOpen)
1697 1697
 				//fmt.Println("config+++++++++++", item.UserOrgId)
1698 1698
 				//
1699
-				//if config.IsOpen == 1 && item.UserOrgId == 10210 {
1700
-				//
1701
-				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1702
-				//	//更新字典里面的库存
1703
-				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1704
-				//	var sum_count int64
1705
-				//	for _, its := range stockInfo {
1706
-				//		if its.MaxUnit == medical.MaxUnit {
1707
-				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1708
-				//		}
1709
-				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1710
-				//	}
1711
-				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1712
-				//	//剩余库存
1713
-				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1714
-				//}
1699
+				if config.IsOpen == 1 && item.UserOrgId == 10402 {
1700
+
1701
+					service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1702
+					//更新字典里面的库存
1703
+					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1704
+					var sum_count int64
1705
+					for _, its := range stockInfo {
1706
+						if its.MaxUnit == medical.MaxUnit {
1707
+							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1708
+						}
1709
+						sum_count += its.StockMaxNumber + its.StockMinNumber
1710
+					}
1711
+					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1712
+					//剩余库存
1713
+					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1714
+				}
1715 1715
 
1716 1716
 			}
1717 1717
 		}

+ 7 - 7
controllers/sign_api_controller.go Просмотреть файл

@@ -1232,17 +1232,17 @@ func (this *SignApiController) ToAutoDiagnose() {
1232 1232
 	//	service.ModifyPatient(item.PatientId, item.Count)
1233 1233
 	//}
1234 1234
 
1235
-	//list, _ := service.GetNewAllpatient(orgId)
1236
-	//
1237
-	//for _, item := range list {
1238
-	//	service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1239
-	//}
1235
+	list, _ := service.GetNewAllpatient(orgId)
1240 1236
 
1241
-	list, _ := service.GetAllDialysisOrder(6963)
1242 1237
 	for _, item := range list {
1243
-		service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1238
+		service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
1244 1239
 	}
1245 1240
 
1241
+	//list, _ := service.GetAllDialysisOrder(6963)
1242
+	//for _, item := range list {
1243
+	//	service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
1244
+	//}
1245
+
1246 1246
 	//drugList, _ := service.GetAllBaseDrugList(10571)
1247 1247
 	//for _, item := range drugList {
1248 1248
 	//	//service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)

+ 13 - 10
models/pharmacy_models.go Просмотреть файл

@@ -46,16 +46,19 @@ func (TmpPatientOne) TableName() string {
46 46
 
47 47
 // 药品信息
48 48
 type PharmacyContent struct {
49
-	Name         string //名称
50
-	SingleDosage string //单次用量
51
-	Usage        string //用法
52
-	Frequency    string //频率
53
-	Days         string //天数
54
-	Total        string //总量
55
-	Doctor       string //开立医生
56
-	DataSources  string //数据来源
57
-	Remarks      string //备注
58
-	DrugId       int64
49
+	Name           string //名称
50
+	SingleDosage   string //单次用量
51
+	Usage          string //用法
52
+	Frequency      string //频率
53
+	Days           string //天数
54
+	Total          string //总量
55
+	Doctor         string //开立医生
56
+	DataSources    string //数据来源
57
+	Remarks        string //备注
58
+	DrugId         int64
59
+	ExecutionTime  int64
60
+	ExecutionStaff int64
61
+	ExecutionState int64
59 62
 }
60 63
 
61 64
 // 发药明细列表

+ 0 - 1
service/dialysis_service.go Просмотреть файл

@@ -1493,7 +1493,6 @@ func SaveHisDoctorAdvice(advice *models.HisDoctorAdviceInfo) (err error) {
1493 1493
 func SaveHisDoctorAdviceOne(advice *models.HisDoctorAdviceInfo, tx *gorm.DB) (err error) {
1494 1494
 	err = tx.Save(&advice).Error
1495 1495
 	if err != nil {
1496
-
1497 1496
 		tx.Rollback()
1498 1497
 		return
1499 1498
 	}

+ 26 - 20
service/pharmacy_service.go Просмотреть файл

@@ -321,16 +321,19 @@ func GetPatientMedication(orgid, patient_id, stime, etime, is_medicine int64) (p
321 321
 
322 322
 		for _, v := range tmp {
323 323
 			pp = append(pp, &models.PharmacyContent{
324
-				Name:         v.AdviceName,
325
-				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
326
-				Usage:        v.DeliveryWay,
327
-				Frequency:    v.ExecutionFrequency,
328
-				Days:         config.ToString(v.Day) + "天",
329
-				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
330
-				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
331
-				DataSources:  "his处方",
332
-				Remarks:      v.Remark, //备注
333
-				DrugId:       v.DrugId,
324
+				Name:           v.AdviceName,
325
+				SingleDosage:   config.ToString(v.SingleDose) + v.SingleDoseUnit,
326
+				Usage:          v.DeliveryWay,
327
+				Frequency:      v.ExecutionFrequency,
328
+				Days:           config.ToString(v.Day) + "天",
329
+				Total:          config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
330
+				Doctor:         GetAdminUserName(v.AdviceDoctor, orgid), //开立医生
331
+				DataSources:    "his处方",
332
+				Remarks:        v.Remark, //备注
333
+				DrugId:         v.DrugId,
334
+				ExecutionState: v.ExecutionState,
335
+				ExecutionStaff: v.ExecutionStaff,
336
+				ExecutionTime:  v.ExecutionTime,
334 337
 			})
335 338
 		}
336 339
 
@@ -351,16 +354,19 @@ func GetPatientMedication(orgid, patient_id, stime, etime, is_medicine int64) (p
351 354
 
352 355
 		for _, v := range tmp_advice {
353 356
 			pp = append(pp, &models.PharmacyContent{
354
-				Name:         v.AdviceName,
355
-				SingleDosage: config.ToString(v.SingleDose) + v.SingleDoseUnit,
356
-				Usage:        v.DeliveryWay,
357
-				Frequency:    v.ExecutionFrequency,
358
-				Days:         "-",
359
-				Total:        config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
360
-				Doctor:       GetAdminUserName(v.AdviceDoctor, orgid),
361
-				DataSources:  "临时医嘱",
362
-				Remarks:      v.Remark,
363
-				DrugId:       v.DrugId,
357
+				Name:           v.AdviceName,
358
+				SingleDosage:   config.ToString(v.SingleDose) + v.SingleDoseUnit,
359
+				Usage:          v.DeliveryWay,
360
+				Frequency:      v.ExecutionFrequency,
361
+				Days:           "-",
362
+				Total:          config.ToString(v.PrescribingNumber) + v.PrescribingNumberUnit,
363
+				Doctor:         GetAdminUserName(v.AdviceDoctor, orgid),
364
+				DataSources:    "临时医嘱",
365
+				Remarks:        v.Remark,
366
+				DrugId:         v.DrugId,
367
+				ExecutionState: v.ExecutionState,
368
+				ExecutionStaff: v.ExecutionStaff,
369
+				ExecutionTime:  v.ExecutionTime,
364 370
 			})
365 371
 		}
366 372
 		return

+ 1 - 1
service/schedule_service.go Просмотреть файл

@@ -1524,7 +1524,7 @@ func GetDoctorAdviceListSchedule(org_id int64, patient_id int64) (advices []*mod
1524 1524
 func GetLastDialysisPrescriptionTwo(org_id int64, patient_id int64, mode_id int64, schedule_date int64) (models.NewDialysisPrescription, error) {
1525 1525
 
1526 1526
 	dialysisprescription := models.NewDialysisPrescription{}
1527
-	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode_id = ? and status = 1 and record_date>=1704038400 and record_date<?", org_id, patient_id, mode_id, schedule_date).Order("id desc").First(&dialysisprescription).Error
1527
+	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode_id = ? and status = 1 and record_date = ?", org_id, patient_id, mode_id, schedule_date).Order("id desc").First(&dialysisprescription).Error
1528 1528
 	return dialysisprescription, err
1529 1529
 
1530 1530
 }

+ 1 - 1
service/sign_service.go Просмотреть файл

@@ -2099,7 +2099,7 @@ func UpdateSchPatient(patient_id int64, schedule_date int64, user_org_id int64,
2099 2099
 
2100 2100
 func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
2101 2101
 
2102
-	err = XTReadDB().Where("status =1 and user_org_id =10265").Find(&list).Error
2102
+	err = XTReadDB().Where("status =1 and user_org_id =?", org_id).Find(&list).Error
2103 2103
 
2104 2104
 	return list, err
2105 2105
 }