Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 6 months ago
parent
commit
39284ab285

+ 11 - 5
controllers/dialysis_api_controller.go View File

@@ -2586,7 +2586,6 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2586 2586
 				dewater_amount = 0
2587 2587
 			}
2588 2588
 
2589
-			fmt.Println("dewater_amount----------------", dewater_amount)
2590 2589
 			// 计算透析处方的相关超滤量
2591 2590
 			schedual, _ := service.MobileGetSchedualDetailSix(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
2592 2591
 			var lastDialysisPrescribe *models.DialysisPrescription
@@ -2669,6 +2668,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2669 2668
 				newprescribe.RecordDate = recordDate.Unix()
2670 2669
 				newprescribe.DewaterAmount = dewater_amount
2671 2670
 				newprescribe.TargetUltrafiltration = dewater_amount
2671
+				newprescribe.PrescriptionWater = dewater_amount
2672 2672
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2673 2673
 				newprescribe.Status = 1
2674 2674
 
@@ -2747,6 +2747,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2747 2747
 					newprescribe.UpdatedTime = time.Now().Unix()
2748 2748
 					newprescribe.RecordDate = recordDate.Unix()
2749 2749
 					newprescribe.DewaterAmount = dewater_amount
2750
+					newprescribe.PrescriptionWater = dewater_amount
2750 2751
 					newprescribe.TargetUltrafiltration = dewater_amount
2751 2752
 					newprescribe.Status = 1
2752 2753
 					newprescribe.Creater = adminUserInfo.AdminUser.Id
@@ -2990,6 +2991,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
2990 2991
 			newprescribe.RecordDate = recordDate.Unix()
2991 2992
 			newprescribe.DewaterAmount = dewater_amount
2992 2993
 			newprescribe.TargetUltrafiltration = dewater_amount
2994
+			newprescribe.PrescriptionWater = dewater_amount
2993 2995
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2994 2996
 			newprescribe.Status = 1
2995 2997
 			if adminUserInfo.CurrentOrgId == 10579 {
@@ -3064,6 +3066,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3064 3066
 				newprescribe.RecordDate = recordDate.Unix()
3065 3067
 				newprescribe.DewaterAmount = dewater_amount
3066 3068
 				newprescribe.TargetUltrafiltration = dewater_amount
3069
+				newprescribe.PrescriptionWater = dewater_amount
3067 3070
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
3068 3071
 				newprescribe.DialysisStrainer = lastDialysisPrescribe.DialysisStrainer
3069 3072
 				newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
@@ -7108,12 +7111,15 @@ func (this *DialysisApiController) GetDialysisAdviceToday() {
7108 7111
 	_, config := service.FindXTHisRecordByOrgId(orgId)
7109 7112
 	appId := this.GetAdminUserInfo().CurrentAppId
7110 7113
 	doctorList, _ := service.GetAllAdminUsers(orgId, appId)
7114
+
7115
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
7111 7116
 	if err == nil {
7112 7117
 		this.ServeSuccessJSON(map[string]interface{}{
7113
-			"list":       list,
7114
-			"drug":       drug,
7115
-			"config":     config,
7116
-			"doctorList": doctorList,
7118
+			"list":             list,
7119
+			"drug":             drug,
7120
+			"config":           config,
7121
+			"doctorList":       doctorList,
7122
+			"manufacturerList": manufacturerList,
7117 7123
 		})
7118 7124
 		return
7119 7125
 

+ 67 - 34
controllers/his_api_controller.go View File

@@ -1998,13 +1998,13 @@ func (c *HisApiController) CreateHisPrescription() {
1998 1998
 											if drug.IsProject == 0 || drug.IsProject == 2 {
1999 1999
 												if all_count == 0 {
2000 2000
 													tx.Rollback()
2001
-													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2001
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足,保存失败")
2002 2002
 													return
2003 2003
 												}
2004 2004
 
2005 2005
 												if prescribing_number > all_count {
2006 2006
 													tx.Rollback()
2007
-													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2007
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足,保存失败")
2008 2008
 													return
2009 2009
 												}
2010 2010
 											}
@@ -2018,12 +2018,12 @@ func (c *HisApiController) CreateHisPrescription() {
2018 2018
 											if drug.IsProject == 0 || drug.IsProject == 2 {
2019 2019
 												if all_count == 0 {
2020 2020
 													tx.Rollback()
2021
-													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2021
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足,保存失败")
2022 2022
 													return
2023 2023
 												}
2024 2024
 												if num > all_count {
2025 2025
 													tx.Rollback()
2026
-													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2026
+													c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足,保存失败")
2027 2027
 													return
2028 2028
 												}
2029 2029
 											}
@@ -2085,12 +2085,12 @@ func (c *HisApiController) CreateHisPrescription() {
2085 2085
 													if drug.IsProject == 0 || drug.IsProject == 2 {
2086 2086
 														if all_count == 0 {
2087 2087
 															tx.Rollback()
2088
-															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2088
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足,保存失败")
2089 2089
 															return
2090 2090
 														}
2091 2091
 														if prescribing_number > all_count {
2092 2092
 															tx.Rollback()
2093
-															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足")
2093
+															c.ServeDynamicFailJsonSend(drug.DrugName + "库存不足,保存失败")
2094 2094
 															return
2095 2095
 														}
2096 2096
 													}
@@ -3659,12 +3659,23 @@ func (c *HisApiController) CreateHisPrescription() {
3659 3659
 
3660 3660
 								//查询改药品是否已经停用
3661 3661
 								base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
3662
+
3662 3663
 								if base.ID > 0 {
3663 3664
 									tx.Rollback()
3664 3665
 									c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
3665 3666
 									return
3666 3667
 
3667 3668
 								}
3669
+
3670
+								drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
3671
+
3672
+								if drugMedical.SumCount == 0 {
3673
+									tx.Rollback()
3674
+									c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
3675
+									return
3676
+
3677
+								}
3678
+
3668 3679
 								service.CreateHisDoctorAdviceOne(&s, tx)
3669 3680
 
3670 3681
 								tx.Commit()
@@ -3737,20 +3748,23 @@ func (c *HisApiController) CreateHisPrescription() {
3737 3748
 
3738 3749
 								}
3739 3750
 
3740
-								//if adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10265 {
3741
-								//
3742
-								//	if p.Type == 3 {
3743
-								//		//查询该耗材是否停用
3744
-								//		goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
3745
-								//		//表示该耗材已经停用,不能保存
3746
-								//		if goodInfoSeven.ID == 0 {
3747
-								//			goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3748
-								//			c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
3749
-								//			return
3750
-								//		}
3751
-								//	}
3752
-								//
3753
-								//}
3751
+								if p.Type == 3 {
3752
+									//查询该耗材是否停用
3753
+									goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
3754
+									//表示该耗材已经停用,不能保存
3755
+									if goodInfoSeven.ID == 0 {
3756
+										goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3757
+										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
3758
+										return
3759
+									}
3760
+
3761
+									goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3762
+									if goodInfoOne.SumCount == 0 {
3763
+										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
3764
+										return
3765
+									}
3766
+
3767
+								}
3754 3768
 
3755 3769
 								//查询保存耗材出库开关是否打开
3756 3770
 								if p.PatientId != 30038 {
@@ -4449,6 +4463,23 @@ func (c *HisApiController) CreateHisPrescription() {
4449 4463
 									}
4450 4464
 								}
4451 4465
 
4466
+								//查询改药品是否已经停用
4467
+								base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
4468
+
4469
+								if base.ID > 0 {
4470
+									c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
4471
+									return
4472
+
4473
+								}
4474
+
4475
+								drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
4476
+
4477
+								if drugMedical.SumCount == 0 {
4478
+									c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
4479
+									return
4480
+
4481
+								}
4482
+
4452 4483
 								service.CreateHisDoctorAdvice(&s)
4453 4484
 
4454 4485
 								//记录日志
@@ -4545,20 +4576,22 @@ func (c *HisApiController) CreateHisPrescription() {
4545 4576
 
4546 4577
 								}
4547 4578
 
4548
-								//if adminInfo.CurrentOrgId == 9671 || adminInfo.CurrentOrgId == 10265 {
4549
-								//
4550
-								//	if p.Type == 3 {
4551
-								//		//查询该耗材是否停用
4552
-								//		goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
4553
-								//		//表示该耗材已经停用,不能保存
4554
-								//		if goodInfoSeven.ID == 0 {
4555
-								//			goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4556
-								//			c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
4557
-								//			return
4558
-								//		}
4559
-								//	}
4560
-								//
4561
-								//}
4579
+								if p.Type == 3 {
4580
+									//查询该耗材是否停用
4581
+									goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
4582
+									//表示该耗材已经停用,不能保存
4583
+									if goodInfoSeven.ID == 0 {
4584
+										goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4585
+										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
4586
+										return
4587
+									}
4588
+
4589
+									goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4590
+									if goodInfoOne.SumCount == 0 {
4591
+										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
4592
+										return
4593
+									}
4594
+								}
4562 4595
 
4563 4596
 								service.CreateHisProjectTwo(&p)
4564 4597
 								//记录日志

+ 8 - 9
controllers/manage_api_controller.go View File

@@ -2890,23 +2890,22 @@ func (this *MachineApiController) SaveReminder() {
2890 2890
 		UserOrgId: orgId,
2891 2891
 		Ctime:     time.Now().Unix(),
2892 2892
 	}
2893
-	data, errs := service.GetRemanderData(orgId)
2894
-	if errs == gorm.ErrRecordNotFound {
2893
+	RemanderData, _ := service.GetRemanderData(orgId)
2894
+
2895
+	if RemanderData.ID == 0 {
2895 2896
 		service.CreateRemander(&remander).Error()
2896
-	} else if errs == nil {
2897
+	}
2898
+	if RemanderData.ID > 0 {
2897 2899
 		deviceRemander := models.DeviceRemander{
2898
-			ID:        data.ID,
2900
+			ID:        RemanderData.ID,
2899 2901
 			IsRun:     id,
2900 2902
 			Status:    1,
2901 2903
 			UserOrgId: orgId,
2902 2904
 			Mtime:     time.Now().Unix(),
2903 2905
 		}
2904 2906
 		service.UpdateRemander(&deviceRemander)
2905
-		//if err != nil {
2906
-		//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
2907
-		//	return
2908
-		//}
2909 2907
 	}
2908
+
2910 2909
 	this.ServeSuccessJSON(map[string]interface{}{
2911 2910
 		"id": id,
2912 2911
 	})
@@ -5884,7 +5883,7 @@ func (this *MachineApiController) GetNewAirWayDisinfectList() {
5884 5883
 	}
5885 5884
 	orgId := this.GetAdminUserInfo().CurrentOrgId
5886 5885
 	list, total, err := service.GetNewAirWayDisinfectList(limit, page, startTime, endTime, orgId)
5887
-	fmt.Println("lisitwoowowow", list)
5886
+
5888 5887
 	if err != nil {
5889 5888
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
5890 5889
 		return

+ 97 - 94
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -2236,100 +2236,100 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2236 2236
 				}
2237 2237
 
2238 2238
 				////针对异常未出库问题的脚本
2239
-				//if adminInfo.Org.Id == 10598 {
2240
-				//
2241
-				//	newadviceInfo := &models.HisDoctorAdviceInfo{
2242
-				//		ID:                    advice.ID,
2243
-				//		UserOrgId:             advice.UserOrgId,
2244
-				//		PatientId:             advice.PatientId,
2245
-				//		HisPatientId:          advice.HisPatientId,
2246
-				//		AdviceType:            advice.AdviceType,
2247
-				//		AdviceDate:            advice.AdviceDate,
2248
-				//		StartTime:             advice.StartTime,
2249
-				//		AdviceName:            advice.AdviceName,
2250
-				//		AdviceDesc:            advice.AdviceDesc,
2251
-				//		ReminderDate:          advice.ReminderDate,
2252
-				//		SingleDose:            advice.SingleDose,
2253
-				//		SingleDoseUnit:        advice.SingleDoseUnit,
2254
-				//		PrescribingNumber:     advice.PrescribingNumber,
2255
-				//		PrescribingNumberUnit: advice.PrescribingNumberUnit,
2256
-				//		DeliveryWay:           advice.DeliveryWay,
2257
-				//		ExecutionFrequency:    advice.ExecutionFrequency,
2258
-				//		AdviceDoctor:          advice.AdviceDoctor,
2259
-				//		Status:                advice.Status,
2260
-				//		CreatedTime:           advice.CreatedTime,
2261
-				//		UpdatedTime:           advice.UpdatedTime,
2262
-				//		AdviceAffirm:          advice.AdviceAffirm,
2263
-				//		Remark:                advice.Remark,
2264
-				//		StopTime:              advice.StopTime,
2265
-				//		StopReason:            advice.StopReason,
2266
-				//		StopDoctor:            advice.StopDoctor,
2267
-				//		StopState:             advice.StopState,
2268
-				//		ParentId:              advice.ParentId,
2269
-				//		ExecutionTime:         advice.ExecutionTime,
2270
-				//		ExecutionStaff:        advice.ExecutionStaff,
2271
-				//		ExecutionState:        advice.ExecutionState,
2272
-				//		Checker:               advice.Checker,
2273
-				//		RecordDate:            advice.RecordDate,
2274
-				//		DialysisOrderId:       advice.DialysisOrderId,
2275
-				//		CheckTime:             advice.CheckTime,
2276
-				//		CheckState:            advice.CheckState,
2277
-				//		DrugSpec:              advice.DrugSpec,
2278
-				//		DrugSpecUnit:          advice.DrugSpecUnit,
2279
-				//		Groupno:               advice.Groupno,
2280
-				//		RemindType:            advice.RemindType,
2281
-				//		FrequencyType:         advice.FrequencyType,
2282
-				//		DayCount:              advice.DayCount,
2283
-				//		WeekDay:               advice.WeekDay,
2284
-				//		TemplateId:            advice.TemplateId,
2285
-				//		Modifier:              advice.Modifier,
2286
-				//		DrugId:                advice.DrugId,
2287
-				//		Price:                 advice.Price,
2288
-				//		PrescriptionId:        advice.PrescriptionId,
2289
-				//		MedListCodg:           advice.MedListCodg,
2290
-				//		FeedetlSn:             advice.FeedetlSn,
2291
-				//		Day:                   advice.DayCount,
2292
-				//		ChildDoctorAdvice:     nil,
2293
-				//		Drug:                  models.Drug{},
2294
-				//		Diagnosis:             advice.Diagnosis,
2295
-				//		Way:                   advice.Way,
2296
-				//		HospApprFlag:          advice.HospApprFlag,
2297
-				//		LmtUsedFlag:           advice.LmtUsedFlag,
2298
-				//		HisOrderInfo:          models.HisOrderInfo{},
2299
-				//		IsMedicine:            advice.IsMedicine,
2300
-				//		ExecutionFrequencyId:  advice.ExecutionFrequencyId,
2301
-				//		Child:                 nil,
2302
-				//		IsSettle:              advice.IsSettle,
2303
-				//		IsMobile:              advice.IsMobile,
2304
-				//		IsSelfDrug:            advice.IsSelfDrug,
2305
-				//		DrugWayCount:          advice.DrugWayCount,
2306
-				//	}
2307
-				//	outListExport, _ := service.GetWarehouseOutListExport(advice.DrugId, advice.PatientId, advice.AdviceDate, advice.ID)
2308
-				//
2309
-				//	var out_count int64
2310
-				//	if len(outListExport) > 0 {
2311
-				//		for _, item := range outListExport {
2312
-				//			if item.CountUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
2313
-				//				out_count = item.Count * medical.MinNumber
2314
-				//			}
2315
-				//			if item.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
2316
-				//				out_count = item.Count
2317
-				//			}
2318
-				//			if item.CountUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
2319
-				//				out_count = item.Count * medical.MinNumber
2320
-				//			}
2321
-				//
2322
-				//		}
2323
-				//	}
2324
-				//	//按最小单位出库
2325
-				//	//var cha_count = total_count - out_count
2326
-				//	fmt.Println("cha_count--------------------------------------", out_count)
2327
-				//
2328
-				//	var cha_count = 1
2329
-				//	newadviceInfo.PrescribingNumber = float64(cha_count)
2330
-				//	newadviceInfo.PrescribingNumberUnit = medical.MinUnit
2331
-				//	service.NewHisDrugsDelivery(advice.UserOrgId, creater, newadviceInfo, tx)
2332
-				//}
2239
+				if adminInfo.Org.Id == 10644 {
2240
+
2241
+					newadviceInfo := &models.HisDoctorAdviceInfo{
2242
+						ID:                    advice.ID,
2243
+						UserOrgId:             advice.UserOrgId,
2244
+						PatientId:             advice.PatientId,
2245
+						HisPatientId:          advice.HisPatientId,
2246
+						AdviceType:            advice.AdviceType,
2247
+						AdviceDate:            advice.AdviceDate,
2248
+						StartTime:             advice.StartTime,
2249
+						AdviceName:            advice.AdviceName,
2250
+						AdviceDesc:            advice.AdviceDesc,
2251
+						ReminderDate:          advice.ReminderDate,
2252
+						SingleDose:            advice.SingleDose,
2253
+						SingleDoseUnit:        advice.SingleDoseUnit,
2254
+						PrescribingNumber:     advice.PrescribingNumber,
2255
+						PrescribingNumberUnit: advice.PrescribingNumberUnit,
2256
+						DeliveryWay:           advice.DeliveryWay,
2257
+						ExecutionFrequency:    advice.ExecutionFrequency,
2258
+						AdviceDoctor:          advice.AdviceDoctor,
2259
+						Status:                advice.Status,
2260
+						CreatedTime:           advice.CreatedTime,
2261
+						UpdatedTime:           advice.UpdatedTime,
2262
+						AdviceAffirm:          advice.AdviceAffirm,
2263
+						Remark:                advice.Remark,
2264
+						StopTime:              advice.StopTime,
2265
+						StopReason:            advice.StopReason,
2266
+						StopDoctor:            advice.StopDoctor,
2267
+						StopState:             advice.StopState,
2268
+						ParentId:              advice.ParentId,
2269
+						ExecutionTime:         advice.ExecutionTime,
2270
+						ExecutionStaff:        advice.ExecutionStaff,
2271
+						ExecutionState:        advice.ExecutionState,
2272
+						Checker:               advice.Checker,
2273
+						RecordDate:            advice.RecordDate,
2274
+						DialysisOrderId:       advice.DialysisOrderId,
2275
+						CheckTime:             advice.CheckTime,
2276
+						CheckState:            advice.CheckState,
2277
+						DrugSpec:              advice.DrugSpec,
2278
+						DrugSpecUnit:          advice.DrugSpecUnit,
2279
+						Groupno:               advice.Groupno,
2280
+						RemindType:            advice.RemindType,
2281
+						FrequencyType:         advice.FrequencyType,
2282
+						DayCount:              advice.DayCount,
2283
+						WeekDay:               advice.WeekDay,
2284
+						TemplateId:            advice.TemplateId,
2285
+						Modifier:              advice.Modifier,
2286
+						DrugId:                advice.DrugId,
2287
+						Price:                 advice.Price,
2288
+						PrescriptionId:        advice.PrescriptionId,
2289
+						MedListCodg:           advice.MedListCodg,
2290
+						FeedetlSn:             advice.FeedetlSn,
2291
+						Day:                   advice.DayCount,
2292
+						ChildDoctorAdvice:     nil,
2293
+						Drug:                  models.Drug{},
2294
+						Diagnosis:             advice.Diagnosis,
2295
+						Way:                   advice.Way,
2296
+						HospApprFlag:          advice.HospApprFlag,
2297
+						LmtUsedFlag:           advice.LmtUsedFlag,
2298
+						HisOrderInfo:          models.HisOrderInfo{},
2299
+						IsMedicine:            advice.IsMedicine,
2300
+						ExecutionFrequencyId:  advice.ExecutionFrequencyId,
2301
+						Child:                 nil,
2302
+						IsSettle:              advice.IsSettle,
2303
+						IsMobile:              advice.IsMobile,
2304
+						IsSelfDrug:            advice.IsSelfDrug,
2305
+						DrugWayCount:          advice.DrugWayCount,
2306
+					}
2307
+					outListExport, _ := service.GetWarehouseOutListExport(advice.DrugId, advice.PatientId, advice.AdviceDate, advice.ID)
2308
+					fmt.Println(outListExport)
2309
+					//var out_count int64
2310
+					//if len(outListExport) > 0 {
2311
+					//	for _, item := range outListExport {
2312
+					//		if item.CountUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
2313
+					//			out_count = item.Count * medical.MinNumber
2314
+					//		}
2315
+					//		if item.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
2316
+					//			out_count = item.Count
2317
+					//		}
2318
+					//		if item.CountUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
2319
+					//			out_count = item.Count * medical.MinNumber
2320
+					//		}
2321
+					//
2322
+					//	}
2323
+					//}
2324
+					//按最小单位出库
2325
+					//var cha_count = total_count - out_count
2326
+
2327
+					var cha_count = 100
2328
+					fmt.Println("cha_count--------------------------------------", cha_count)
2329
+					newadviceInfo.PrescribingNumber = float64(cha_count)
2330
+					newadviceInfo.PrescribingNumberUnit = medical.MinUnit
2331
+					service.NewHisDrugsDelivery(advice.UserOrgId, creater, newadviceInfo, tx)
2332
+				}
2333 2333
 
2334 2334
 			}
2335 2335
 		}
@@ -3350,6 +3350,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
3350 3350
 		newprescribe.RecordDate = theAssessmentDateTime
3351 3351
 		newprescribe.DewaterAmount = dewater_amount
3352 3352
 		newprescribe.TargetUltrafiltration = dewater_amount
3353
+		newprescribe.PrescriptionWater = dewater_amount
3353 3354
 		newprescribe.Status = 1
3354 3355
 		newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
3355 3356
 		newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
@@ -3518,6 +3519,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
3518 3519
 			newprescribe.RecordDate = theAssessmentDateTime
3519 3520
 			newprescribe.DewaterAmount = dewater_amount
3520 3521
 			newprescribe.TargetUltrafiltration = dewater_amount
3522
+			newprescribe.PrescriptionWater = dewater_amount
3521 3523
 			newprescribe.Status = 1
3522 3524
 			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
3523 3525
 			newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
@@ -3689,6 +3691,7 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
3689 3691
 			newprescribe.RecordDate = theAssessmentDateTime
3690 3692
 			newprescribe.DewaterAmount = dewater_amount
3691 3693
 			newprescribe.TargetUltrafiltration = dewater_amount
3694
+			newprescribe.PrescriptionWater = dewater_amount
3692 3695
 			newprescribe.Status = 1
3693 3696
 			newprescribe.DialysisDialyszers = system_dialysisPrescribe.DialysisDialyszers
3694 3697
 			newprescribe.DialysisIrrigation = system_dialysisPrescribe.DialysisIrrigation

+ 7 - 2
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go View File

@@ -82,13 +82,16 @@ func (this *StaffScheduleApiController) GetMobileStaffScheduleList() {
82 82
 	}
83 83
 
84 84
 	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
85
+
86
+	scheduleRemark, _ := service.GetStaffScheduleRemark(orgId, startTime, endTime)
85 87
 	if err != nil {
86 88
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
87 89
 		return
88 90
 	}
89 91
 
90 92
 	this.ServeSuccessJSON(map[string]interface{}{
91
-		"staffList": staffList,
93
+		"staffList":      staffList,
94
+		"scheduleRemark": scheduleRemark,
92 95
 	})
93 96
 }
94 97
 
@@ -122,13 +125,15 @@ func (this *StaffScheduleApiController) GetMobileNextWeekScheduleLIst() {
122 125
 	}
123 126
 
124 127
 	staffList, err := service.GetStaffScheduleList(orgId, startTime, endTime)
128
+	scheduleRemark, _ := service.GetStaffScheduleRemark(orgId, startTime, endTime)
125 129
 	if err != nil {
126 130
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
127 131
 		return
128 132
 	}
129 133
 
130 134
 	this.ServeSuccessJSON(map[string]interface{}{
131
-		"staffList": staffList,
135
+		"staffList":      staffList,
136
+		"scheduleRemark": scheduleRemark,
132 137
 	})
133 138
 }
134 139
 

+ 244 - 31
controllers/patient_api_controller.go View File

@@ -160,6 +160,8 @@ func PatientApiRegistRouters() {
160 160
 
161 161
 	beego.Router("/api/patient/deletepatientlapsorecord", &DialysisApiController{}, "Get:DeletePatientLapseRecord")
162 162
 
163
+	beego.Router("/api/patient/getpatientlapselist", &DialysisApiController{}, "Get:GetPatientLapaseList")
164
+
163 165
 }
164 166
 func (c *PatientApiController) GetExportList() {
165 167
 	startTime := c.GetString("start_time")
@@ -399,6 +401,7 @@ func (c *PatientApiController) CreatePatient() {
399 401
 	patient.FirstLetter = firstLetter
400 402
 
401 403
 	err := service.CreatePatient(&patient, contagions, diseases)
404
+
402 405
 	fmt.Println("创建病人失败err")
403 406
 	if err != nil {
404 407
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreatePatient)
@@ -407,6 +410,27 @@ func (c *PatientApiController) CreatePatient() {
407 410
 
408 411
 	//获取老表的最后一条数据
409 412
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
413
+	creater := adminUserInfo.AdminUser.Id
414
+	record := models.XtPatientLaspseRecord{
415
+		PatientId:     patients.ID,
416
+		RecordDate:    time.Now().Unix(),
417
+		LapseDate:     time.Now().Unix(),
418
+		LapseType:     1,
419
+		LapseClass:    0,
420
+		LapseReason:   "",
421
+		AdminUserId:   creater,
422
+		Remark:        "",
423
+		UserOrgId:     0,
424
+		Ctime:         time.Now().Unix(),
425
+		Mtime:         time.Now().Unix(),
426
+		Status:        1,
427
+		LapseTypeName: "转入",
428
+		HisType:       0,
429
+		HisZone:       "",
430
+		HisBed:        "",
431
+	}
432
+	service.CreatePatientRecord(record)
433
+
410 434
 	patientsNew := models.XtPatientsNew{
411 435
 		UserOrgId:                    adminUserInfo.CurrentOrgId,
412 436
 		UserId:                       0,
@@ -7548,10 +7572,38 @@ func (c *PatientApiController) SavePatientLapse() {
7548 7572
 
7549 7573
 	lapse_reason := dataBody["lapse_reason"].(string)
7550 7574
 
7551
-	start_time := dataBody["record_date"].(string)
7575
+	record_date := dataBody["record_date"].(string)
7576
+
7577
+	lapse_type_name := dataBody["lapse_type_name"].(string)
7578
+
7579
+	his_bed := dataBody["his_bed"].(string)
7580
+
7581
+	his_zone := dataBody["his_zone"].(string)
7582
+
7583
+	his_type := int64(dataBody["his_type"].(float64))
7584
+
7585
+	patient_address := dataBody["patient_address"].(string)
7586
+
7587
+	start_time := dataBody["start_time"].(string)
7588
+
7589
+	end_time := dataBody["end_time"].(string)
7590
+
7591
+	start_time_one := dataBody["start_time_one"].(string)
7592
+
7593
+	end_time_one := dataBody["end_time_one"].(string)
7552 7594
 
7553 7595
 	timeLayout := "2006-01-02"
7554 7596
 	loc, _ := time.LoadLocation("Local")
7597
+	var recordDate int64
7598
+	if len(record_date) > 0 {
7599
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7600
+		if err != nil {
7601
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7602
+			return
7603
+		}
7604
+		recordDate = theTime.Unix()
7605
+	}
7606
+
7555 7607
 	var startTime int64
7556 7608
 	if len(start_time) > 0 {
7557 7609
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
@@ -7562,30 +7614,91 @@ func (c *PatientApiController) SavePatientLapse() {
7562 7614
 		startTime = theTime.Unix()
7563 7615
 	}
7564 7616
 
7617
+	var endTime int64
7618
+	if len(end_time) > 0 {
7619
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
7620
+		if err != nil {
7621
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7622
+			return
7623
+		}
7624
+		endTime = theTime.Unix()
7625
+	}
7626
+
7627
+	var startTimeOne int64
7628
+	if len(start_time_one) > 0 {
7629
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
7630
+		if err != nil {
7631
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7632
+			return
7633
+		}
7634
+		startTimeOne = theTime.Unix()
7635
+	}
7636
+
7637
+	var endTimeOne int64
7638
+	if len(end_time_one) > 0 {
7639
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 00:00:00", loc)
7640
+		if err != nil {
7641
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7642
+			return
7643
+		}
7644
+		endTimeOne = theTime.Unix()
7645
+	}
7646
+
7565 7647
 	remark := dataBody["remark"].(string)
7566 7648
 
7567 7649
 	org_id := c.GetAdminUserInfo().CurrentOrgId
7568 7650
 
7569 7651
 	record := models.XtPatientLaspseRecord{
7570
-		PatientId:   patient_id,
7571
-		RecordDate:  startTime,
7572
-		LapseDate:   startTime,
7573
-		LapseType:   lapse_type,
7574
-		LapseClass:  lapse_class,
7575
-		LapseReason: lapse_reason,
7576
-		AdminUserId: admin_user_id,
7577
-		Remark:      remark,
7578
-		UserOrgId:   org_id,
7579
-		Ctime:       time.Now().Unix(),
7580
-		Mtime:       time.Now().Unix(),
7581
-		Status:      1,
7652
+		PatientId:      patient_id,
7653
+		RecordDate:     recordDate,
7654
+		LapseDate:      recordDate,
7655
+		LapseType:      lapse_type,
7656
+		LapseClass:     lapse_class,
7657
+		LapseReason:    lapse_reason,
7658
+		AdminUserId:    admin_user_id,
7659
+		Remark:         remark,
7660
+		UserOrgId:      org_id,
7661
+		Ctime:          time.Now().Unix(),
7662
+		Mtime:          time.Now().Unix(),
7663
+		Status:         1,
7664
+		LapseTypeName:  lapse_type_name,
7665
+		HisBed:         his_bed,
7666
+		HisType:        his_type,
7667
+		HisZone:        his_zone,
7668
+		StartTime:      startTime,
7669
+		EndTime:        endTime,
7670
+		StartTimeOne:   startTimeOne,
7671
+		EndTimeOne:     endTimeOne,
7672
+		PatientAddress: patient_address,
7582 7673
 	}
7583 7674
 
7584 7675
 	//病人转出
7585
-	if lapse_type == 1 {
7586
-		service.UpdateScheduleByDeathTime(patient_id, startTime)
7676
+	if lapse_type == 2 {
7677
+
7678
+		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate)
7679
+
7680
+		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7681
+
7682
+		service.UpdateScheduleItemByPatientId(patient_id)
7683
+	}
7684
+
7685
+	//病人转出
7686
+	if lapse_type == 3 {
7687
+
7688
+		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate)
7689
+
7690
+		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7691
+
7587 7692
 		service.UpdateScheduleItemByPatientId(patient_id)
7588 7693
 	}
7694
+
7695
+	//病人转出
7696
+	if lapse_type == 1 {
7697
+
7698
+		service.UpdatePatientLapsetoByPatientIdTwo(patient_id, recordDate)
7699
+
7700
+	}
7701
+
7589 7702
 	service.CreatePatientRecord(record)
7590 7703
 
7591 7704
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -7639,10 +7752,39 @@ func (c *DialysisApiController) UpdatePatientLapseRecord() {
7639 7752
 
7640 7753
 	lapse_reason := dataBody["lapse_reason"].(string)
7641 7754
 
7642
-	start_time := dataBody["record_date"].(string)
7755
+	record_date := dataBody["record_date"].(string)
7756
+
7757
+	lapse_type_name := dataBody["lapse_type_name"].(string)
7758
+
7759
+	his_bed := dataBody["his_bed"].(string)
7760
+
7761
+	his_zone := dataBody["his_zone"].(string)
7762
+
7763
+	his_type := int64(dataBody["his_type"].(float64))
7764
+
7765
+	patient_address := dataBody["patient_address"].(string)
7766
+
7767
+	start_time := dataBody["start_time"].(string)
7768
+
7769
+	end_time := dataBody["end_time"].(string)
7770
+
7771
+	start_time_one := dataBody["start_time_one"].(string)
7772
+
7773
+	end_time_one := dataBody["end_time_one"].(string)
7643 7774
 
7644 7775
 	timeLayout := "2006-01-02"
7645 7776
 	loc, _ := time.LoadLocation("Local")
7777
+
7778
+	var recordDate int64
7779
+	if len(record_date) > 0 {
7780
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
7781
+		if err != nil {
7782
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7783
+			return
7784
+		}
7785
+		recordDate = theTime.Unix()
7786
+	}
7787
+
7646 7788
 	var startTime int64
7647 7789
 	if len(start_time) > 0 {
7648 7790
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
@@ -7653,6 +7795,36 @@ func (c *DialysisApiController) UpdatePatientLapseRecord() {
7653 7795
 		startTime = theTime.Unix()
7654 7796
 	}
7655 7797
 
7798
+	var endTime int64
7799
+	if len(end_time) > 0 {
7800
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
7801
+		if err != nil {
7802
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7803
+			return
7804
+		}
7805
+		endTime = theTime.Unix()
7806
+	}
7807
+
7808
+	var startTimeOne int64
7809
+	if len(start_time_one) > 0 {
7810
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_one+" 00:00:00", loc)
7811
+		if err != nil {
7812
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7813
+			return
7814
+		}
7815
+		startTimeOne = theTime.Unix()
7816
+	}
7817
+
7818
+	var endTimeOne int64
7819
+	if len(end_time_one) > 0 {
7820
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_one+" 00:00:00", loc)
7821
+		if err != nil {
7822
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7823
+			return
7824
+		}
7825
+		endTimeOne = theTime.Unix()
7826
+	}
7827
+
7656 7828
 	remark := dataBody["remark"].(string)
7657 7829
 
7658 7830
 	id := int64(dataBody["id"].(float64))
@@ -7660,27 +7832,54 @@ func (c *DialysisApiController) UpdatePatientLapseRecord() {
7660 7832
 	org_id := c.GetAdminUserInfo().CurrentOrgId
7661 7833
 
7662 7834
 	record := models.XtPatientLaspseRecord{
7663
-		ID:          id,
7664
-		PatientId:   patient_id,
7665
-		RecordDate:  startTime,
7666
-		LapseDate:   startTime,
7667
-		LapseType:   lapse_type,
7668
-		LapseClass:  lapse_class,
7669
-		LapseReason: lapse_reason,
7670
-		AdminUserId: admin_user_id,
7671
-		Remark:      remark,
7672
-		UserOrgId:   org_id,
7673
-		Ctime:       time.Now().Unix(),
7674
-		Mtime:       time.Now().Unix(),
7675
-		Status:      1,
7835
+		ID:             id,
7836
+		PatientId:      patient_id,
7837
+		RecordDate:     recordDate,
7838
+		LapseDate:      recordDate,
7839
+		LapseType:      lapse_type,
7840
+		LapseClass:     lapse_class,
7841
+		LapseReason:    lapse_reason,
7842
+		AdminUserId:    admin_user_id,
7843
+		Remark:         remark,
7844
+		UserOrgId:      org_id,
7845
+		Ctime:          time.Now().Unix(),
7846
+		Mtime:          time.Now().Unix(),
7847
+		Status:         1,
7848
+		LapseTypeName:  lapse_type_name,
7849
+		HisZone:        his_zone,
7850
+		HisBed:         his_bed,
7851
+		HisType:        his_type,
7852
+		StartTime:      startTime,
7853
+		StartTimeOne:   startTimeOne,
7854
+		EndTime:        endTime,
7855
+		EndTimeOne:     endTimeOne,
7856
+		PatientAddress: patient_address,
7676 7857
 	}
7677 7858
 
7678 7859
 	//病人转出
7679
-	if lapse_type == 1 {
7680
-		service.UpdateScheduleByDeathTime(patient_id, startTime)
7860
+	if lapse_type == 2 {
7861
+		service.UpdatePatientLapsetoByPatientId(patient_id, recordDate)
7862
+
7863
+		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7864
+
7865
+		service.UpdateScheduleItemByPatientId(patient_id)
7866
+	}
7867
+
7868
+	if lapse_type == 3 {
7869
+		service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate)
7870
+
7871
+		service.UpdateScheduleByDeathTime(patient_id, recordDate)
7872
+
7681 7873
 		service.UpdateScheduleItemByPatientId(patient_id)
7682 7874
 	}
7683 7875
 
7876
+	//病人转出
7877
+	if lapse_type == 1 {
7878
+
7879
+		service.UpdatePatientLapsetoByPatientIdTwo(patient_id, recordDate)
7880
+
7881
+	}
7882
+
7684 7883
 	service.SavePatientLapseRecord(record)
7685 7884
 
7686 7885
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -7699,3 +7898,17 @@ func (c *DialysisApiController) DeletePatientLapseRecord() {
7699 7898
 	})
7700 7899
 
7701 7900
 }
7901
+
7902
+func (c *DialysisApiController) GetPatientLapaseList() {
7903
+
7904
+	orgId := c.GetAdminUserInfo().CurrentOrgId
7905
+
7906
+	list, _ := service.GetPatientAllagicListOne(orgId)
7907
+
7908
+	fmt.Println("lsit", list)
7909
+
7910
+	//for _, item := range list {
7911
+	//
7912
+	//
7913
+	//}
7914
+}

+ 27 - 16
controllers/stock_in_api_controller.go View File

@@ -8055,27 +8055,38 @@ func (this *StockManagerApiController) UpdateBaseDrugListByUserOrgID() {
8055 8055
 
8056 8056
 func (this *StockManagerApiController) UpdateGoodInfoByUserOrgId() {
8057 8057
 
8058
-	orgId := this.GetAdminUserInfo().CurrentOrgId
8059
-
8060
-	info, _ := service.GetAllWareHouseOutByUserOrg(orgId)
8061
-
8062
-	if len(info) > 0 {
8063
-		for _, item := range info {
8064
-			dealer, _ := service.GetDealerById(item.Dealer)
8065
-
8066
-			//manufacturer, _ := service.GetManufactureById(item.Manufacturer)
8058
+	//orgId := this.GetAdminUserInfo().CurrentOrgId
8067 8059
 
8068
-			service.UpdateGoodInfoByUserOrgIdTwo(item.ID, dealer.DealerName)
8069
-		}
8070
-	}
8071
-	//goodList, _ := service.GetAllGoodList(orgId)
8060
+	//info, _ := service.GetAllWareHouseOutByUserOrg(10633)
8072 8061
 	//
8073
-	//for _, item := range goodList {
8062
+	//if len(info) > 0 {
8063
+	//	for _, item := range info {
8074 8064
 	//
8075
-	//	good_type_name := service.GetAllGoodTypeName(item.GoodTypeId, orgId)
8065
+	//		//dealer, _ := service.GetDealerById(item.Dealer)
8076 8066
 	//
8077
-	//	service.UpdateGoodTypeName(item.ID, good_type_name)
8067
+	//		//manufacturer, _ := service.GetManufactureById(item.Manufacturer)
8068
+	//
8069
+	//		//service.UpdateGoodInfoByUserOrgIdTwo(item.ID, dealer.DealerName)
8070
+	//	}
8078 8071
 	//}
8072
+	goodList, _ := service.GetAllGoodList(10633)
8073
+
8074
+	for _, item := range goodList {
8075
+		service.UpdateStockFlowByList(item.ID, item.PackingPrice)
8076
+		//service.UpdateWarehouseOutInfoByPrice(item.ID, item.PackingPrice)
8077
+
8078
+		//outList, _ := service.GetWarehosueOutInfoByPrice(item.ID, 10633)
8079
+		//
8080
+		//for _, it := range outList {
8081
+		//	//service.UpdateWarehouseOut(it.ID, item.PackingPrice)
8082
+		//
8083
+		//	service.UpdateStockFlowByList(it.GoodId, item.PackingPrice)
8084
+		//}
8085
+
8086
+		//good_type_name := service.GetAllGoodTypeName(item.GoodTypeId, orgId)
8087
+		//
8088
+		//service.UpdateGoodTypeName(item.ID, good_type_name)
8089
+	}
8079 8090
 
8080 8091
 	//
8081 8092
 	//for _, item := range goodList {

+ 1 - 0
models/dialysis.go View File

@@ -1514,6 +1514,7 @@ type HisDoctorAdviceFourty struct {
1514 1514
 	IsSettle              int64                    `gorm:"column:is_settle" json:"is_settle" form:"is_settle"`
1515 1515
 	Drug                  Drug                     `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
1516 1516
 	IsSelfDrug            int64                    `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
1517
+	DeliveryWay           string                   `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
1517 1518
 }
1518 1519
 
1519 1520
 func (HisDoctorAdviceFourty) TableName() string {

+ 1 - 0
models/drug.go View File

@@ -297,6 +297,7 @@ type BaseDrugLibTwenty struct {
297 297
 	DoseUnit       string `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
298 298
 	DrugStatus     string `gorm:"column:drug_status" json:"drug_status" form:"drug_status"`
299 299
 	DrugStockLimit string `gorm:"column:drug_stock_limit" json:"drug_stock_limit_count" form:"drug_stock_limit"`
300
+	Manufacturer   int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
300 301
 }
301 302
 
302 303
 func (BaseDrugLibTwenty) TableName() string {

+ 2 - 0
models/good_models.go View File

@@ -241,6 +241,7 @@ type GoodInfoSeven struct {
241 241
 	GoodName          string `gorm:"column:good_name" json:"good_name" form:"good_name"`
242 242
 	GoodStatus        string `gorm:"column:good_status" json:"good_status" form:"good_status"`
243 243
 	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
244
+	SumCount          int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
244 245
 }
245 246
 
246 247
 func (GoodInfoSeven) TableName() string {
@@ -424,6 +425,7 @@ type GoodInformationFourty struct {
424 425
 	GoodName          string `gorm:"column:good_name" json:"good_name" form:"good_name"`
425 426
 	Status            int64  `gorm:"column:status" json:"status"`
426 427
 	PackingUnit       string `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
428
+	SumCount          int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
427 429
 }
428 430
 
429 431
 func (GoodInformationFourty) TableName() string {

+ 22 - 13
models/patient_models.go View File

@@ -2766,19 +2766,28 @@ func (XtTreatmentPlan) TableName() string {
2766 2766
 }
2767 2767
 
2768 2768
 type XtPatientLaspseRecord struct {
2769
-	ID          int64  `gorm:"column:id" json:"id" form:"id"`
2770
-	PatientId   int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2771
-	RecordDate  int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2772
-	LapseDate   int64  `gorm:"column:lapse_date" json:"lapse_date" form:"lapse_date"`
2773
-	LapseType   int64  `gorm:"column:lapse_type" json:"lapse_type" form:"lapse_type"`
2774
-	LapseClass  int64  `gorm:"column:lapse_class" json:"lapse_class" form:"lapse_class"`
2775
-	LapseReason string `gorm:"column:lapse_reason" json:"lapse_reason" form:"lapse_reason"`
2776
-	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2777
-	Remark      string `gorm:"column:remark" json:"remark" form:"remark"`
2778
-	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2779
-	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2780
-	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2781
-	Status      int64  `gorm:"column:status" json:"status" form:"status"`
2769
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
2770
+	PatientId      int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2771
+	RecordDate     int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2772
+	LapseDate      int64  `gorm:"column:lapse_date" json:"lapse_date" form:"lapse_date"`
2773
+	LapseType      int64  `gorm:"column:lapse_type" json:"lapse_type" form:"lapse_type"`
2774
+	LapseClass     int64  `gorm:"column:lapse_class" json:"lapse_class" form:"lapse_class"`
2775
+	LapseReason    string `gorm:"column:lapse_reason" json:"lapse_reason" form:"lapse_reason"`
2776
+	AdminUserId    int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2777
+	Remark         string `gorm:"column:remark" json:"remark" form:"remark"`
2778
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2779
+	Ctime          int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2780
+	Mtime          int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2781
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
2782
+	LapseTypeName  string `gorm:"column:lapse_type_name" json:"lapse_type_name" form:"lapse_type_name"`
2783
+	HisType        int64  `gorm:"column:his_type" json:"his_type" form:"his_type"`
2784
+	HisZone        string `gorm:"column:his_zone" json:"his_zone" form:"his_zone"`
2785
+	HisBed         string `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
2786
+	PatientAddress string `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
2787
+	StartTime      int64  `gorm:"column:start_time" json:"start_time" form:"start_time"`
2788
+	EndTime        int64  `gorm:"column:end_time" json:"end_time" form:"end_time"`
2789
+	StartTimeOne   int64  `gorm:"column:start_time_one" json:"start_time_one" form:"start_time_one"`
2790
+	EndTimeOne     int64  `gorm:"column:end_time_one" json:"end_time_one" form:"end_time_one"`
2782 2791
 }
2783 2792
 
2784 2793
 func (XtPatientLaspseRecord) TableName() string {

+ 1 - 0
models/self_drug_models.go View File

@@ -81,6 +81,7 @@ type XtBaseDrug struct {
81 81
 	TotalCountTwo          int64   `gorm:"column:total_count_two" json:"total_count_two" form:"total_count_two"`
82 82
 	IsShow                 int64   `gorm:"column:is_show" json:"is_show" form:"is_show"`
83 83
 	IsSelfDrug             int64   `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
84
+	SumCount               int64   `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
84 85
 }
85 86
 
86 87
 func (XtBaseDrug) TableName() string {

+ 57 - 1
service/patient_service.go View File

@@ -1955,7 +1955,29 @@ func CreateExportPatient(patient *models.Patients, contagions []int64, org_creat
1955 1955
 		BloodId:           patient.ID,
1956 1956
 		Avatar:            "https://images.shengws.com/201809182128111.png",
1957 1957
 	}
1958
+
1958 1959
 	err = utx.Create(&patientsNew).Error
1960
+
1961
+	record := models.XtPatientLaspseRecord{
1962
+		PatientId:     patient.ID,
1963
+		RecordDate:    time.Now().Unix(),
1964
+		LapseDate:     time.Now().Unix(),
1965
+		LapseType:     1,
1966
+		LapseClass:    0,
1967
+		LapseReason:   "",
1968
+		AdminUserId:   org_creator,
1969
+		Remark:        "",
1970
+		UserOrgId:     patient.UserOrgId,
1971
+		Ctime:         time.Now().Unix(),
1972
+		Mtime:         time.Now().Unix(),
1973
+		Status:        1,
1974
+		LapseTypeName: "转入",
1975
+		HisType:       0,
1976
+		HisZone:       "",
1977
+		HisBed:        "",
1978
+	}
1979
+	err = utx.Create(&record).Error
1980
+
1959 1981
 	if err != nil {
1960 1982
 		utx.Rollback()
1961 1983
 		btx.Rollback()
@@ -2103,6 +2125,33 @@ func UpdateScheduleByDeathTime(patientid int64, shcheduledate int64) error {
2103 2125
 	return err
2104 2126
 }
2105 2127
 
2128
+func UpdatePatientLapsetoByPatientId(patient_id int64, record_date int64) error {
2129
+
2130
+	err := XTWriteDB().Model(&models.Patients{}).Where("id = ? and status= 1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 2}).Error
2131
+
2132
+	err = XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status=1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 2}).Error
2133
+
2134
+	return err
2135
+}
2136
+
2137
+func UpdatePatientLapsetoByPatientIdOne(patient_id int64, record_date int64) error {
2138
+
2139
+	err := XTWriteDB().Model(&models.Patients{}).Where("id = ? and status= 1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 3}).Error
2140
+
2141
+	err = XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status=1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 3}).Error
2142
+
2143
+	return err
2144
+}
2145
+
2146
+func UpdatePatientLapsetoByPatientIdTwo(patient_id int64, record_date int64) error {
2147
+
2148
+	err := XTWriteDB().Model(&models.Patients{}).Where("id = ? and status= 1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 1}).Error
2149
+
2150
+	err = XTWriteDB().Model(&models.XtPatientsNew{}).Where("blood_id = ? and status=1", patient_id).Updates(map[string]interface{}{"death_time": record_date, "lapseto": 1}).Error
2151
+
2152
+	return err
2153
+}
2154
+
2106 2155
 func UpdateScheduleItemByPatientId(id int64) error {
2107 2156
 
2108 2157
 	err := XTWriteDB().Model(models.PatientScheduleTemplateItem{}).Where("patient_id = ? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
@@ -3072,6 +3121,13 @@ func GetPatientAllagicList(patient_id int64, user_org_id int64) (list []*models.
3072 3121
 	return list, err
3073 3122
 }
3074 3123
 
3124
+func GetPatientAllagicListOne(user_org_id int64) (list []*models.XtPatientAllergic, err error) {
3125
+
3126
+	err = XTReadDB().Where("user_org_id =? and status= 1", user_org_id).Find(&list).Error
3127
+
3128
+	return list, err
3129
+}
3130
+
3075 3131
 func GetNewMonitorRecord(orgID int64, date int64, partition int64, patientId int64) ([]*models.NewMonitorDialysisScheduleList, error) {
3076 3132
 	var mds []*models.NewMonitorDialysisScheduleList
3077 3133
 
@@ -4124,7 +4180,7 @@ func GetPatientLapseRecord(patient_id int64, limit int64, page int64, user_org_i
4124 4180
 	if user_org_id > 0 {
4125 4181
 		db = db.Where("user_org_id = ?", user_org_id)
4126 4182
 	}
4127
-	err = db.Count(&total).Offset(offset).Limit(limit).Find(&record).Error
4183
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_date desc").Find(&record).Error
4128 4184
 
4129 4185
 	return record, total, err
4130 4186
 }

+ 28 - 0
service/stock_service.go View File

@@ -9462,3 +9462,31 @@ func CreateSelfDrugFlowOne(flow models.XtSelfDrugFlow, tx *gorm.DB) error {
9462 9462
 	}
9463 9463
 	return err
9464 9464
 }
9465
+
9466
+func UpdateWarehouseOutInfoByPrice(good_id int64, packing_price float64) error {
9467
+
9468
+	err = XTWriteDB().Model(&models.WarehousingInfo{}).Where("good_id =? and status =1 and is_check=1", good_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
9469
+
9470
+	return err
9471
+}
9472
+
9473
+func GetWarehosueOutInfoByPrice(good_id int64, org_id int64) (out []*models.WarehouseOutInfo, err error) {
9474
+
9475
+	err = XTReadDB().Where("good_id = ? and org_id = ? and status=1 and price =0", good_id, org_id).Find(&out).Error
9476
+
9477
+	return out, err
9478
+}
9479
+
9480
+func UpdateWarehouseOut(good_id int64, packing_price float64) error {
9481
+
9482
+	err := XTWriteDB().Model(&models.WarehouseOutInfo{}).Where("id = ? and status=1", good_id).Updates(map[string]interface{}{"price": packing_price}).Error
9483
+
9484
+	return err
9485
+}
9486
+
9487
+func UpdateStockFlowByList(good_id int64, packing_price float64) error {
9488
+
9489
+	err := XTWriteDB().Model(models.VmStockFlow{}).Where("good_id = ? and user_org_id = 10633 and status=1", good_id).Updates(map[string]interface{}{"price": packing_price}).Error
9490
+
9491
+	return err
9492
+}