Bladeren bron

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

陈少旭 7 maanden geleden
bovenliggende
commit
0f05d86eee

BIN
XT_New.exe Bestand weergeven


+ 6 - 6
controllers/base_api_controller.go Bestand weergeven

@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10644 //机构id
86
+		subscibe.OrgId = 10666 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,8 +93,8 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 17634 //4
96
+		adminUserInfo.CurrentOrgId = 10666 //机构id小英9675或4
97
+		adminUserInfo.CurrentAppId = 18173 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
100 100
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10644 //机构id小英9675或4
332
+		subscibe.OrgId = 10666 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,8 +339,8 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10644 //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 17634 //4
342
+		adminUserInfo.CurrentOrgId = 10666 //机构id小英9675或4
343
+		adminUserInfo.CurrentAppId = 18173 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes
346 346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 4 - 1
controllers/dialysis_api_controller.go Bestand weergeven

@@ -5036,7 +5036,7 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
5036 5036
 		advice.AdviceType = adviceType
5037 5037
 
5038 5038
 		advice.StartTime = StartTime
5039
-		if StartTime < 0 {
5039
+		if advice.StartTime < 0 {
5040 5040
 			advice.StartTime = time.Now().Unix()
5041 5041
 		}
5042 5042
 		advice.AdviceDate = AdviceDate
@@ -5167,6 +5167,9 @@ func (c *DialysisApiController) CreateRemindDoctorAdvice() {
5167 5167
 					child.Remark = Remark
5168 5168
 					child.AdviceType = adviceType
5169 5169
 					child.StartTime = StartTime
5170
+					if child.StartTime < 0 {
5171
+						child.StartTime = time.Now().Unix()
5172
+					}
5170 5173
 					child.AdviceDate = AdviceDate
5171 5174
 					child.RecordDate = RecordDate
5172 5175
 					child.Status = 1

+ 100 - 93
controllers/mobile_api_controllers/patient_api_controller.go Bestand weergeven

@@ -1814,99 +1814,102 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1814 1814
 					}
1815 1815
 				}
1816 1816
 
1817
-				//针对异常未出库问题的脚本
1818
-				if adminInfo.Org.Id == 10598 {
1819
-
1820
-					newadviceInfo := &models.HisDoctorAdviceInfo{
1821
-						ID:                    advice.ID,
1822
-						UserOrgId:             advice.UserOrgId,
1823
-						PatientId:             advice.PatientId,
1824
-						HisPatientId:          advice.HisPatientId,
1825
-						AdviceType:            advice.AdviceType,
1826
-						AdviceDate:            advice.AdviceDate,
1827
-						StartTime:             advice.StartTime,
1828
-						AdviceName:            advice.AdviceName,
1829
-						AdviceDesc:            advice.AdviceDesc,
1830
-						ReminderDate:          advice.ReminderDate,
1831
-						SingleDose:            advice.SingleDose,
1832
-						SingleDoseUnit:        advice.SingleDoseUnit,
1833
-						PrescribingNumber:     advice.PrescribingNumber,
1834
-						PrescribingNumberUnit: advice.PrescribingNumberUnit,
1835
-						DeliveryWay:           advice.DeliveryWay,
1836
-						ExecutionFrequency:    advice.ExecutionFrequency,
1837
-						AdviceDoctor:          advice.AdviceDoctor,
1838
-						Status:                advice.Status,
1839
-						CreatedTime:           advice.CreatedTime,
1840
-						UpdatedTime:           advice.UpdatedTime,
1841
-						AdviceAffirm:          advice.AdviceAffirm,
1842
-						Remark:                advice.Remark,
1843
-						StopTime:              advice.StopTime,
1844
-						StopReason:            advice.StopReason,
1845
-						StopDoctor:            advice.StopDoctor,
1846
-						StopState:             advice.StopState,
1847
-						ParentId:              advice.ParentId,
1848
-						ExecutionTime:         advice.ExecutionTime,
1849
-						ExecutionStaff:        advice.ExecutionStaff,
1850
-						ExecutionState:        advice.ExecutionState,
1851
-						Checker:               advice.Checker,
1852
-						RecordDate:            advice.RecordDate,
1853
-						DialysisOrderId:       advice.DialysisOrderId,
1854
-						CheckTime:             advice.CheckTime,
1855
-						CheckState:            advice.CheckState,
1856
-						DrugSpec:              advice.DrugSpec,
1857
-						DrugSpecUnit:          advice.DrugSpecUnit,
1858
-						Groupno:               advice.Groupno,
1859
-						RemindType:            advice.RemindType,
1860
-						FrequencyType:         advice.FrequencyType,
1861
-						DayCount:              advice.DayCount,
1862
-						WeekDay:               advice.WeekDay,
1863
-						TemplateId:            advice.TemplateId,
1864
-						Modifier:              advice.Modifier,
1865
-						DrugId:                advice.DrugId,
1866
-						Price:                 advice.Price,
1867
-						PrescriptionId:        advice.PrescriptionId,
1868
-						MedListCodg:           advice.MedListCodg,
1869
-						FeedetlSn:             advice.FeedetlSn,
1870
-						Day:                   advice.DayCount,
1871
-						ChildDoctorAdvice:     nil,
1872
-						Drug:                  models.Drug{},
1873
-						Diagnosis:             advice.Diagnosis,
1874
-						Way:                   advice.Way,
1875
-						HospApprFlag:          advice.HospApprFlag,
1876
-						LmtUsedFlag:           advice.LmtUsedFlag,
1877
-						HisOrderInfo:          models.HisOrderInfo{},
1878
-						IsMedicine:            advice.IsMedicine,
1879
-						ExecutionFrequencyId:  advice.ExecutionFrequencyId,
1880
-						Child:                 nil,
1881
-						IsSettle:              advice.IsSettle,
1882
-						IsMobile:              advice.IsMobile,
1883
-						IsSelfDrug:            advice.IsSelfDrug,
1884
-						DrugWayCount:          advice.DrugWayCount,
1885
-					}
1886
-					outListExport, _ := service.GetWarehouseOutListExport(advice.DrugId, advice.PatientId, advice.AdviceDate, advice.ID)
1887
-
1888
-					var out_count int64
1889
-					if len(outListExport) > 0 {
1890
-						for _, item := range outListExport {
1891
-							if item.CountUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
1892
-								out_count = item.Count * medical.MinNumber
1893
-							}
1894
-							if item.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
1895
-								out_count = item.Count
1896
-							}
1897
-							if item.CountUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
1898
-								out_count = item.Count * medical.MinNumber
1899
-							}
1900
-
1901
-						}
1902
-					}
1903
-					//按最小单位出库
1904
-					var cha_count = total_count - out_count
1905
-					fmt.Println("cha_count--------------------------------------", cha_count)
1906
-					newadviceInfo.PrescribingNumber = float64(cha_count)
1907
-					newadviceInfo.PrescribingNumberUnit = medical.MinUnit
1908
-					service.NewHisDrugsDelivery(advice.UserOrgId, creater, newadviceInfo, tx)
1909
-				}
1817
+				fmt.Println("org_id =============================", adminInfo.Org.Id)
1818
+				////针对异常未出库问题的脚本
1819
+				//if adminInfo.Org.Id == 10598 {
1820
+				//
1821
+				//	newadviceInfo := &models.HisDoctorAdviceInfo{
1822
+				//		ID:                    advice.ID,
1823
+				//		UserOrgId:             advice.UserOrgId,
1824
+				//		PatientId:             advice.PatientId,
1825
+				//		HisPatientId:          advice.HisPatientId,
1826
+				//		AdviceType:            advice.AdviceType,
1827
+				//		AdviceDate:            advice.AdviceDate,
1828
+				//		StartTime:             advice.StartTime,
1829
+				//		AdviceName:            advice.AdviceName,
1830
+				//		AdviceDesc:            advice.AdviceDesc,
1831
+				//		ReminderDate:          advice.ReminderDate,
1832
+				//		SingleDose:            advice.SingleDose,
1833
+				//		SingleDoseUnit:        advice.SingleDoseUnit,
1834
+				//		PrescribingNumber:     advice.PrescribingNumber,
1835
+				//		PrescribingNumberUnit: advice.PrescribingNumberUnit,
1836
+				//		DeliveryWay:           advice.DeliveryWay,
1837
+				//		ExecutionFrequency:    advice.ExecutionFrequency,
1838
+				//		AdviceDoctor:          advice.AdviceDoctor,
1839
+				//		Status:                advice.Status,
1840
+				//		CreatedTime:           advice.CreatedTime,
1841
+				//		UpdatedTime:           advice.UpdatedTime,
1842
+				//		AdviceAffirm:          advice.AdviceAffirm,
1843
+				//		Remark:                advice.Remark,
1844
+				//		StopTime:              advice.StopTime,
1845
+				//		StopReason:            advice.StopReason,
1846
+				//		StopDoctor:            advice.StopDoctor,
1847
+				//		StopState:             advice.StopState,
1848
+				//		ParentId:              advice.ParentId,
1849
+				//		ExecutionTime:         advice.ExecutionTime,
1850
+				//		ExecutionStaff:        advice.ExecutionStaff,
1851
+				//		ExecutionState:        advice.ExecutionState,
1852
+				//		Checker:               advice.Checker,
1853
+				//		RecordDate:            advice.RecordDate,
1854
+				//		DialysisOrderId:       advice.DialysisOrderId,
1855
+				//		CheckTime:             advice.CheckTime,
1856
+				//		CheckState:            advice.CheckState,
1857
+				//		DrugSpec:              advice.DrugSpec,
1858
+				//		DrugSpecUnit:          advice.DrugSpecUnit,
1859
+				//		Groupno:               advice.Groupno,
1860
+				//		RemindType:            advice.RemindType,
1861
+				//		FrequencyType:         advice.FrequencyType,
1862
+				//		DayCount:              advice.DayCount,
1863
+				//		WeekDay:               advice.WeekDay,
1864
+				//		TemplateId:            advice.TemplateId,
1865
+				//		Modifier:              advice.Modifier,
1866
+				//		DrugId:                advice.DrugId,
1867
+				//		Price:                 advice.Price,
1868
+				//		PrescriptionId:        advice.PrescriptionId,
1869
+				//		MedListCodg:           advice.MedListCodg,
1870
+				//		FeedetlSn:             advice.FeedetlSn,
1871
+				//		Day:                   advice.DayCount,
1872
+				//		ChildDoctorAdvice:     nil,
1873
+				//		Drug:                  models.Drug{},
1874
+				//		Diagnosis:             advice.Diagnosis,
1875
+				//		Way:                   advice.Way,
1876
+				//		HospApprFlag:          advice.HospApprFlag,
1877
+				//		LmtUsedFlag:           advice.LmtUsedFlag,
1878
+				//		HisOrderInfo:          models.HisOrderInfo{},
1879
+				//		IsMedicine:            advice.IsMedicine,
1880
+				//		ExecutionFrequencyId:  advice.ExecutionFrequencyId,
1881
+				//		Child:                 nil,
1882
+				//		IsSettle:              advice.IsSettle,
1883
+				//		IsMobile:              advice.IsMobile,
1884
+				//		IsSelfDrug:            advice.IsSelfDrug,
1885
+				//		DrugWayCount:          advice.DrugWayCount,
1886
+				//	}
1887
+				//	outListExport, _ := service.GetWarehouseOutListExport(advice.DrugId, advice.PatientId, advice.AdviceDate, advice.ID)
1888
+				//
1889
+				//	var out_count int64
1890
+				//	if len(outListExport) > 0 {
1891
+				//		for _, item := range outListExport {
1892
+				//			if item.CountUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
1893
+				//				out_count = item.Count * medical.MinNumber
1894
+				//			}
1895
+				//			if item.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
1896
+				//				out_count = item.Count
1897
+				//			}
1898
+				//			if item.CountUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
1899
+				//				out_count = item.Count * medical.MinNumber
1900
+				//			}
1901
+				//
1902
+				//		}
1903
+				//	}
1904
+				//	//按最小单位出库
1905
+				//	//var cha_count = total_count - out_count
1906
+				//	fmt.Println("cha_count--------------------------------------", out_count)
1907
+				//
1908
+				//	var cha_count = 1
1909
+				//	newadviceInfo.PrescribingNumber = float64(cha_count)
1910
+				//	newadviceInfo.PrescribingNumberUnit = medical.MinUnit
1911
+				//	service.NewHisDrugsDelivery(advice.UserOrgId, creater, newadviceInfo, tx)
1912
+				//}
1910 1913
 
1911 1914
 			}
1912 1915
 		}
@@ -5048,6 +5051,8 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
5048 5051
 			"project_config":          project_config,
5049 5052
 			"lastWeight":              lastWeight,
5050 5053
 			"lastSchedule":            lastSchedule,
5054
+			"DoctorAdvice":            DoctorAdvice,
5055
+			"hisAdvice":               hisAdvice,
5051 5056
 		})
5052 5057
 	}
5053 5058
 
@@ -5072,6 +5077,8 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
5072 5077
 			"project_config":          project_config,
5073 5078
 			"lastWeight":              lastWeight,
5074 5079
 			"lastSchedule":            lastSchedule,
5080
+			"DoctorAdvice":            DoctorAdvice,
5081
+			"hisAdvice":               hisAdvice,
5075 5082
 		})
5076 5083
 	}
5077 5084
 

+ 8 - 1
controllers/new_mobile_api_controllers/new_manage_api_controller.go Bestand weergeven

@@ -149,6 +149,13 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
149 149
 	order, _ := service.GetPatientOrderInfo(scheduledate, patientid, orgid)
150 150
 	//查询病人今日透后评估数据
151 151
 	dislysis, _ := service.GetAssessmentAfterDissDataTwo(patientid, orgid, scheduledate)
152
+
153
+	assessmentBeforThrity, _ := service.GetAssessmentBeforThrity(orgid, patientid, scheduledate)
154
+
155
+	var weight_los float64
156
+
157
+	weight_los = assessmentBeforThrity.WeightBefore - dislysis.WeightAfter
158
+
152 159
 	fmt.Println("透析减少", dislysis.WeightLoss)
153 160
 	//			//根据床位号获取设备id
154 161
 	addmacher, _ := service.GetEquimentIDTwo(bedid, orgid)
@@ -187,7 +194,7 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
187 194
 			StartTime:             order.StartTime,
188 195
 			EndTime:               order.EndTime,
189 196
 			Contagion:             con,
190
-			WeightLoss:            dislysis.WeightLoss,
197
+			WeightLoss:            weight_los,
191 198
 			Hyperfiltratio:        dislysis.ActualUltrafiltration,
192 199
 			DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
193 200
 			MachineRun:            1,

+ 1 - 0
controllers/pharmacy_controller.go Bestand weergeven

@@ -757,6 +757,7 @@ func (this *PharmacyController) GetPatientsWithDrugs() {
757 757
 		return
758 758
 	}
759 759
 	listll, err := service.PartitionAndLayoutDrug(deliveryway, stime, etime, orgid, shift, partition, list)
760
+	fmt.Println("list1---------------------------", listll)
760 761
 	if err != nil {
761 762
 		utils.ErrorLog(err.Error())
762 763
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)

+ 339 - 52
controllers/self_drug_api_congtroller.go Bestand weergeven

@@ -152,6 +152,16 @@ func SelfDrugRouters() {
152 152
 	beego.Router("/api/drug/getselfdrugbatchnumber", &SelfDrugApiController{}, "Get:GetSelfDrugBatchNumber")
153 153
 
154 154
 	beego.Router("/api/drug/postsetfdrugwarehouseout", &SelfDrugApiController{}, "Post:PostSelfDrugWarehouseOut")
155
+
156
+	beego.Router("/api/drug/getallselfdrugwarehouseoutlist", &SelfDrugApiController{}, "Get:GetAllSelfDrugWarehouseOutList")
157
+
158
+	beego.Router("/api/drug/deleteselfwarehouseout", &SelfDrugApiController{}, "Get:DeleteSelfWarehouseOut")
159
+
160
+	beego.Router("/api/drug/getselfdrugwarehouseoutbyid", &SelfDrugApiController{}, "Get:GetSelfDrugWarehouseOutById")
161
+
162
+	beego.Router("/api/drug/modifyselfdrugwarehouseout", &SelfDrugApiController{}, "Post:ModifySelfDrugWarehouseOut")
163
+
164
+	beego.Router("/api/drug/getselfdrugquery", &SelfDrugApiController{}, "Get:GetSelfDrugQuery")
155 165
 }
156 166
 
157 167
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -4799,31 +4809,31 @@ func (c *SelfDrugApiController) ModifySelfDrugWarehouse() {
4799 4809
 	total, _ := service.FindSelfAllWarehouseTotal(adminUserInfo.CurrentOrgId, tx)
4800 4810
 	total = total + 1
4801 4811
 
4802
-	operation_time := time.Now().Unix()
4803
-	creater := adminUserInfo.AdminUser.Id
4812
+	//operation_time := time.Now().Unix()
4813
+	//creater := adminUserInfo.AdminUser.Id
4804 4814
 
4805 4815
 	warehousing_order := "YPRKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
4806 4816
 
4807
-	warehousing := models.XtSelfDrugWarehouse{
4808
-		ID:               warehousing_id,
4809
-		WarehousingOrder: warehousing_order,
4810
-		OperationTime:    operation_time,
4811
-		OrgId:            adminUserInfo.CurrentOrgId,
4812
-		Creater:          creater,
4813
-		Ctime:            time.Now().Unix(),
4814
-		Status:           1,
4815
-		WarehousingTime:  warehousingDate.Unix(),
4816
-		Type:             0,
4817
-		StorehouseId:     0,
4818
-		IsCheck:          2,
4819
-		PatientId:        patient_id,
4820
-	}
4821
-	if warehousing_id == 0 {
4822
-		service.AddSelfDrugWarehouse(&warehousing, tx)
4823
-	}
4824
-	if warehousing_id > 0 {
4825
-		service.UpdateSelfDrugWarehouse(&warehousing, tx)
4826
-	}
4817
+	//warehousing := models.XtSelfDrugWarehouse{
4818
+	//	ID:               warehousing_id,
4819
+	//	WarehousingOrder: warehousing_order,
4820
+	//	OperationTime:    operation_time,
4821
+	//	OrgId:            adminUserInfo.CurrentOrgId,
4822
+	//	Creater:          creater,
4823
+	//	Ctime:            time.Now().Unix(),
4824
+	//	Status:           1,
4825
+	//	WarehousingTime:  warehousingDate.Unix(),
4826
+	//	Type:             0,
4827
+	//	StorehouseId:     0,
4828
+	//	IsCheck:          2,
4829
+	//	PatientId:        patient_id,
4830
+	//}
4831
+	//if warehousing_id == 0 {
4832
+	//	service.AddSelfDrugWarehouse(&warehousing, tx)
4833
+	//}
4834
+	//if warehousing_id > 0 {
4835
+	//	service.UpdateSelfDrugWarehouse(&warehousing, tx)
4836
+	//}
4827 4837
 	info, _ := service.FindLastSelfWarehousing(adminUserInfo.CurrentOrgId, patient_id, tx)
4828 4838
 	dataBody := make(map[string]interface{}, 0)
4829 4839
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
@@ -4924,7 +4934,7 @@ func (c *SelfDrugApiController) ModifySelfDrugWarehouse() {
4924 4934
 				warehouseInfo := &models.XtSelfDrugWarehouseInfo{
4925 4935
 					ID:               id,
4926 4936
 					WarehousingOrder: warehousing_order,
4927
-					WarehousingId:    info.ID,
4937
+					WarehousingId:    warehousing_id,
4928 4938
 					DrugId:           drug_id,
4929 4939
 					Number:           number,
4930 4940
 					ProductDate:      productDates,
@@ -4966,7 +4976,7 @@ func (c *SelfDrugApiController) ModifySelfDrugWarehouse() {
4966 4976
 		}
4967 4977
 	}
4968 4978
 
4969
-	list, _ := service.FindSelfDrugWarehouseInfoListById(info.ID, adminUserInfo.CurrentOrgId, patient_id, tx)
4979
+	list, _ := service.FindSelfDrugWarehouseInfoListById(warehousing_id, adminUserInfo.CurrentOrgId, patient_id, tx)
4970 4980
 	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
4971 4981
 	dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
4972 4982
 	var drugType = "药品类型"
@@ -5005,7 +5015,7 @@ func (c *SelfDrugApiController) DeleteSelfDrugWarehouse() {
5005 5015
 
5006 5016
 func (c *SelfDrugApiController) TocheckSelfWarehouseingInfo() {
5007 5017
 
5008
-	id, _ := c.GetInt64("id")
5018
+	id, _ := c.GetInt64("warehousing_id")
5009 5019
 	patient_id, _ := c.GetInt64("patient_id")
5010 5020
 	orgId := c.GetAdminUserInfo().CurrentOrgId
5011 5021
 	info, _ := service.GetSelfWarehouseInfoByWarehouseInfo(id, patient_id, orgId)
@@ -5153,8 +5163,6 @@ func (c *SelfDrugApiController) GetSelfDrugBatchNumber() {
5153 5163
 
5154 5164
 func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5155 5165
 
5156
-	fmt.Println("开启===========================================================")
5157
-
5158 5166
 	db := service.XTWriteDB()
5159 5167
 	tx := db.Begin()
5160 5168
 	defer func() {
@@ -5166,11 +5174,14 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5166 5174
 	}()
5167 5175
 	patient_id, _ := c.GetInt64("patient_id")
5168 5176
 	warehouse_out_id, _ := c.GetInt64("warehouse_out_id")
5177
+
5169 5178
 	ctime := time.Now().Unix()
5170 5179
 	adminUserInfo := c.GetAdminUserInfo()
5171 5180
 
5172 5181
 	warehousing_out_time := c.GetString("warehousing_out_time")
5182
+
5173 5183
 	warehousingOutDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", warehousing_out_time)
5184
+
5174 5185
 	if parseDateErr != nil {
5175 5186
 		c.ErrorLog("日期(%v)解析错误:%v", warehousingOutDate, parseDateErr)
5176 5187
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -5186,7 +5197,7 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5186 5197
 	number = number + total
5187 5198
 	warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
5188 5199
 	operation_time := time.Now().Unix()
5189
-	fmt.Println("operation_time=================================", operation_time)
5200
+
5190 5201
 	creater := adminUserInfo.AdminUser.Id
5191 5202
 	//创建一个出库单
5192 5203
 	warehouseOut := models.XtSelfDrugWarehouseOut{
@@ -5240,24 +5251,304 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5240 5251
 					return
5241 5252
 				}
5242 5253
 
5243
-				if items["price"] == nil || reflect.TypeOf(items["price"]).String() != "string" {
5244
-					utils.ErrorLog("price")
5254
+				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
5255
+
5256
+				remark := items["remark"].(string)
5257
+				max_unit := items["max_unit"].(string)
5258
+				dealer := int64(items["dealer"].(float64))
5259
+
5260
+				manufacturer := int64(items["manufacturer"].(float64))
5261
+
5262
+				batch_number := items["batch_number"].(string)
5263
+
5264
+				warehouse_info_id := int64(items["warehouse_info_id"].(float64))
5265
+				var productDates int64
5266
+				var expiryDates int64
5267
+				if items["expiry_date"] == nil || reflect.TypeOf(items["expiry_date"]).String() != "string" {
5268
+					expiryDates = 0
5269
+				} else {
5270
+					if len(items["expiry_date"].(string)) == 0 {
5271
+						expiryDates = 0
5272
+
5273
+					} else {
5274
+						expiryDate, _ := items["expiry_date"].(string)
5275
+						expiry_date, _ := utils.ParseTimeStringToTime("2006-01-02", expiryDate)
5276
+						expiryDates = expiry_date.Unix()
5277
+
5278
+					}
5279
+
5280
+				}
5281
+				if items["product_date"] == nil || reflect.TypeOf(items["product_date"]).String() != "string" {
5282
+					productDates = 0
5283
+				} else {
5284
+					if len(items["product_date"].(string)) == 0 {
5285
+						productDates = 0
5286
+
5287
+					} else {
5288
+						productDate, _ := items["product_date"].(string)
5289
+						product_date, _ := utils.ParseTimeStringToTime("2006-01-02", productDate)
5290
+						productDates = product_date.Unix()
5291
+					}
5292
+				}
5293
+
5294
+				stock_count, _ := items["stock_count"].(string)
5295
+
5296
+				id := int64(items["id"].(float64))
5297
+
5298
+				class_type, _ := items["class_type"].(string)
5299
+
5300
+				warehouseOutInfo := &models.XtSelfDrugWarehouseOutInfo{
5301
+					ID:                      id,
5302
+					WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
5303
+					WarehouseOutId:          lastWarehouseOut.ID,
5304
+					DrugId:                  drug_id,
5305
+					Count:                   count,
5306
+					Price:                   0,
5307
+					TotalPrice:              0,
5308
+					Status:                  1,
5309
+					Ctime:                   warehousingOutDate.Unix(),
5310
+					Mtime:                   ctime,
5311
+					Remark:                  remark,
5312
+					OrgId:                   adminUserInfo.CurrentOrgId,
5313
+					Type:                    0,
5314
+					Manufacturer:            manufacturer,
5315
+					Dealer:                  dealer,
5316
+					RetailPrice:             0,
5317
+					RetailTotalPrice:        0,
5318
+					CountUnit:               max_unit,
5319
+					ExpiryDate:              expiryDates,
5320
+					ProductDate:             productDates,
5321
+					Number:                  "",
5322
+					BatchNumber:             batch_number,
5323
+					IsSys:                   0,
5324
+					WarehouseInfoId:         warehouse_info_id,
5325
+					AdminUserId:             0,
5326
+					StockCount:              stock_count,
5327
+					IsCheck:                 2,
5328
+					SysRecordTime:           warehousingOutDate.Unix(),
5329
+					PatientId:               patient_id,
5330
+					ClassType:               class_type,
5331
+				}
5332
+				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
5333
+
5334
+			}
5335
+		}
5336
+	}
5337
+
5338
+	//调用出库逻辑
5339
+	for _, item := range warehousingOutInfo {
5340
+		if item.ID == 0 {
5341
+			errOne := service.AddSelfSigleDrugWarehouseOutInfo(item, tx)
5342
+			fmt.Println(errOne)
5343
+		}
5344
+		if item.ID > 0 {
5345
+			service.UpdatedSelfDrugWarehouseInfo(item, item.ID, tx)
5346
+		}
5347
+
5348
+	}
5349
+
5350
+	list, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
5351
+
5352
+	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
5353
+
5354
+	warehousingOutInfoList, _ := service.GetSelfDrugWarehouseOutListById(lastWarehouseOut.ID, adminUserInfo.CurrentOrgId, tx)
5355
+
5356
+	var drugType = "药品类型"
5357
+	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
5358
+	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, adminUserInfo.CurrentOrgId)
5359
+	c.ServeSuccessJSON(map[string]interface{}{
5360
+		"msg":                "2",
5361
+		"drug_name":          "",
5362
+		"dose":               "",
5363
+		"dose_unit":          "",
5364
+		"min_number":         "",
5365
+		"min_unit":           "",
5366
+		"max_unit":           "",
5367
+		"dealerList":         list,
5368
+		"manufacturerList":   manufacturerList,
5369
+		"warehousingOutInfo": warehousingOutInfoList,
5370
+		"warehouseOut":       lastWarehouseOut,
5371
+		"drugTypeList":       drugTypeList,
5372
+	})
5373
+	return
5374
+}
5375
+
5376
+func (c *SelfDrugApiController) GetAllSelfDrugWarehouseOutList() {
5377
+
5378
+	keyword := c.GetString("keyword")
5379
+
5380
+	patient_id, _ := c.GetInt64("patient_id")
5381
+
5382
+	start_time := c.GetString("start_time")
5383
+
5384
+	end_time := c.GetString("end_time")
5385
+
5386
+	timeLayout := "2006-01-02"
5387
+	loc, _ := time.LoadLocation("Local")
5388
+	var startTime int64
5389
+	if len(start_time) > 0 {
5390
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5391
+		if err != nil {
5392
+			fmt.Println(err)
5393
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5394
+			return
5395
+		}
5396
+		startTime = theTime.Unix()
5397
+	}
5398
+	var endTime int64
5399
+	if len(end_time) > 0 {
5400
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
5401
+		if err != nil {
5402
+			utils.ErrorLog(err.Error())
5403
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5404
+			return
5405
+		}
5406
+		endTime = theTime.Unix()
5407
+	}
5408
+	orgId := c.GetAdminUserInfo().CurrentOrgId
5409
+	baseList, _ := service.GetAllBaseDrugListByKeyWord(keyword, orgId)
5410
+	var ids []int64
5411
+	for _, item := range baseList {
5412
+		ids = append(ids, item.ID)
5413
+	}
5414
+	outInfo, _ := service.GetAllSelfDrugWarehouseOutList(ids, patient_id, startTime, endTime, orgId)
5415
+
5416
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5417
+	dealerList, _ := service.GetAllDealerList(orgId)
5418
+	var drugType = "药品类型"
5419
+	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
5420
+	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
5421
+
5422
+	c.ServeSuccessJSON(map[string]interface{}{
5423
+		"outInfo":          outInfo,
5424
+		"manufacturerList": manufacturerList,
5425
+		"dealerList":       dealerList,
5426
+		"drugTypeList":     drugTypeList,
5427
+	})
5428
+}
5429
+
5430
+func (c *SelfDrugApiController) DeleteSelfWarehouseOut() {
5431
+
5432
+	id, _ := c.GetInt64("id")
5433
+
5434
+	service.DeleteSelfWarehouseOut(id)
5435
+
5436
+	c.ServeSuccessJSON(map[string]interface{}{
5437
+		"msg": "ok",
5438
+	})
5439
+
5440
+	return
5441
+}
5442
+
5443
+func (c *SelfDrugApiController) GetSelfDrugWarehouseOutById() {
5444
+
5445
+	id, _ := c.GetInt64("id")
5446
+	orgId := c.GetAdminUserInfo().CurrentOrgId
5447
+	outInfo, _ := service.GetSelfDrugWarehouseOutById(id)
5448
+
5449
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
5450
+	dealerList, _ := service.GetAllDealerList(orgId)
5451
+	var drugType = "药品类型"
5452
+	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
5453
+	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
5454
+
5455
+	c.ServeSuccessJSON(map[string]interface{}{
5456
+		"outInfo":          outInfo,
5457
+		"manufacturerList": manufacturerList,
5458
+		"dealerList":       dealerList,
5459
+		"drugTypeList":     drugTypeList,
5460
+	})
5461
+}
5462
+
5463
+func (c *SelfDrugApiController) ModifySelfDrugWarehouseOut() {
5464
+
5465
+	db := service.XTWriteDB()
5466
+	tx := db.Begin()
5467
+	defer func() {
5468
+		if r := recover(); r != nil {
5469
+			tx.Rollback()
5470
+		} else {
5471
+			tx.Commit()
5472
+		}
5473
+	}()
5474
+	patient_id, _ := c.GetInt64("patient_id")
5475
+	warehouse_out_id, _ := c.GetInt64("warehouse_out_id")
5476
+	ctime := time.Now().Unix()
5477
+	adminUserInfo := c.GetAdminUserInfo()
5478
+	warehousing_out_time := c.GetString("warehousing_out_time")
5479
+	warehousingOutDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", warehousing_out_time)
5480
+	if parseDateErr != nil {
5481
+		c.ErrorLog("日期(%v)解析错误:%v", warehousingOutDate, parseDateErr)
5482
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5483
+		return
5484
+	}
5485
+	timeStr := time.Now().Format("2006-01-02")
5486
+	timeArr := strings.Split(timeStr, "-")
5487
+	total, _ := service.FindAllSelfDrugWarehouseOut(adminUserInfo.CurrentOrgId, tx)
5488
+
5489
+	total = total + 1
5490
+	warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
5491
+	number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
5492
+	number = number + total
5493
+	warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
5494
+	operation_time := time.Now().Unix()
5495
+
5496
+	creater := adminUserInfo.AdminUser.Id
5497
+	//创建一个出库单
5498
+	warehouseOut := models.XtSelfDrugWarehouseOut{
5499
+		WarehouseOutOrderNumber: warehousing_out_order,
5500
+		OperationTime:           operation_time,
5501
+		OrgId:                   adminUserInfo.CurrentOrgId,
5502
+		Creater:                 creater,
5503
+		Ctime:                   ctime,
5504
+		Status:                  1,
5505
+		WarehouseOutTime:        warehousingOutDate.Unix(),
5506
+		Type:                    0,
5507
+		PatientId:               patient_id,
5508
+		IsCheck:                 2,
5509
+	}
5510
+
5511
+	lastWarehouseOut, _ := service.GetSelfDrugLastWarehouseOut(adminUserInfo.CurrentOrgId, tx)
5512
+
5513
+	dataBody := make(map[string]interface{}, 0)
5514
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
5515
+	if err != nil {
5516
+		utils.ErrorLog(err.Error())
5517
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5518
+		return
5519
+	}
5520
+	//出库单详情
5521
+	var warehousingOutInfo []*models.XtSelfDrugWarehouseOutInfo
5522
+	//把前端的参数加工为出库单详情
5523
+	if dataBody["stockOut"] != nil && reflect.TypeOf(dataBody["stockOut"]).String() == "[]interface {}" {
5524
+		thisStockIn, _ := dataBody["stockOut"].([]interface{})
5525
+
5526
+		if len(thisStockIn) > 0 {
5527
+			for _, item := range thisStockIn {
5528
+
5529
+				items := item.(map[string]interface{})
5530
+
5531
+				if items["drug_id"] == nil || reflect.TypeOf(items["drug_id"]).String() != "float64" {
5532
+					utils.ErrorLog("drug_id")
5533
+					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5534
+					return
5535
+				}
5536
+				drug_id := int64(items["drug_id"].(float64))
5537
+
5538
+				if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
5539
+					utils.ErrorLog("count")
5245 5540
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5246 5541
 					return
5247 5542
 				}
5248
-				price, _ := strconv.ParseFloat(items["price"].(string), 64)
5249 5543
 
5250 5544
 				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
5251 5545
 
5252
-				total := float64(count) * price
5253
-				retail_price_total := float64(count) * price
5254 5546
 				remark := items["remark"].(string)
5255 5547
 				max_unit := items["max_unit"].(string)
5256 5548
 				dealer := int64(items["dealer"].(float64))
5257 5549
 
5258 5550
 				manufacturer := int64(items["manufacturer"].(float64))
5259 5551
 
5260
-				number := items["number"].(string)
5261 5552
 				batch_number := items["batch_number"].(string)
5262 5553
 
5263 5554
 				warehouse_info_id := int64(items["warehouse_info_id"].(float64))
@@ -5290,19 +5581,8 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5290 5581
 					}
5291 5582
 				}
5292 5583
 
5293
-				admin_user_id := int64(items["admin_user_id"].(float64))
5294
-
5295
-				//if items["last_price"] == nil || reflect.TypeOf(items["last_price"]).String() != "string" {
5296
-				//  utils.ErrorLog("last_price")
5297
-				//  c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5298
-				//  return
5299
-				//}
5300
-				//last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
5301
-
5302 5584
 				stock_count, _ := items["stock_count"].(string)
5303 5585
 
5304
-				patient_id := int64(items["patient_id"].(float64))
5305
-
5306 5586
 				id := int64(items["id"].(float64))
5307 5587
 
5308 5588
 				class_type, _ := items["class_type"].(string)
@@ -5313,8 +5593,8 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5313 5593
 					WarehouseOutId:          lastWarehouseOut.ID,
5314 5594
 					DrugId:                  drug_id,
5315 5595
 					Count:                   count,
5316
-					Price:                   price,
5317
-					TotalPrice:              total,
5596
+					Price:                   0,
5597
+					TotalPrice:              0,
5318 5598
 					Status:                  1,
5319 5599
 					Ctime:                   warehousingOutDate.Unix(),
5320 5600
 					Mtime:                   ctime,
@@ -5323,16 +5603,16 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5323 5603
 					Type:                    0,
5324 5604
 					Manufacturer:            manufacturer,
5325 5605
 					Dealer:                  dealer,
5326
-					RetailPrice:             price,
5327
-					RetailTotalPrice:        retail_price_total,
5606
+					RetailPrice:             0,
5607
+					RetailTotalPrice:        0,
5328 5608
 					CountUnit:               max_unit,
5329 5609
 					ExpiryDate:              expiryDates,
5330 5610
 					ProductDate:             productDates,
5331
-					Number:                  number,
5611
+					Number:                  "",
5332 5612
 					BatchNumber:             batch_number,
5333 5613
 					IsSys:                   0,
5334 5614
 					WarehouseInfoId:         warehouse_info_id,
5335
-					AdminUserId:             admin_user_id,
5615
+					AdminUserId:             0,
5336 5616
 					StockCount:              stock_count,
5337 5617
 					IsCheck:                 2,
5338 5618
 					SysRecordTime:           warehousingOutDate.Unix(),
@@ -5361,7 +5641,7 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5361 5641
 
5362 5642
 	manufacturerList, _ := service.GetAllManufacturerList(adminUserInfo.CurrentOrgId)
5363 5643
 
5364
-	warehousingOutInfoList, _ := service.GetDrugWarehouseOutListById(lastWarehouseOut.ID, adminUserInfo.CurrentOrgId)
5644
+	warehousingOutInfoList, _ := service.GetSelfDrugWarehouseOutListById(warehouse_out_id, adminUserInfo.CurrentOrgId, tx)
5365 5645
 
5366 5646
 	var drugType = "药品类型"
5367 5647
 	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
@@ -5382,3 +5662,10 @@ func (c *SelfDrugApiController) PostSelfDrugWarehouseOut() {
5382 5662
 	})
5383 5663
 	return
5384 5664
 }
5665
+
5666
+func (c *SelfDrugApiController) GetSelfDrugQuery() {
5667
+
5668
+	orgId := c.GetAdminUserInfo().CurrentOrgId
5669
+
5670
+	service.GetSelfDrugQuery(orgId)
5671
+}

+ 45 - 44
models/drug.go Bestand weergeven

@@ -511,50 +511,51 @@ func (XtSelfDrugWarehouseOut) TableName() string {
511 511
 }
512 512
 
513 513
 type XtSelfDrugWarehouseOutInfo struct {
514
-	ID                      int64   `gorm:"column:id" json:"id" form:"id"`
515
-	WarehouseOutId          int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
516
-	DrugId                  int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
517
-	WarehousingOutTarget    int64   `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
518
-	Count                   int64   `gorm:"column:count" json:"count" form:"count"`
519
-	CountUnit               string  `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
520
-	Price                   float64 `gorm:"column:price" json:"price" form:"price"`
521
-	TotalPrice              float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
522
-	ProductDate             int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
523
-	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
524
-	Mtime                   int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
525
-	Ctime                   int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
526
-	Status                  int64   `gorm:"column:status" json:"status" form:"status"`
527
-	OrgId                   int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
528
-	Remark                  string  `gorm:"column:remark" json:"remark" form:"remark"`
529
-	IsCancel                int64   `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
530
-	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
531
-	Type                    int64   `gorm:"column:type" json:"type" form:"type"`
532
-	Dealer                  int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
533
-	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
534
-	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
535
-	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
536
-	RetailPrice             float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
537
-	RetailTotalPrice        float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
538
-	WarehouseInfoId         int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
539
-	Number                  string  `gorm:"column:number" json:"number" form:"number"`
540
-	BatchNumber             string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
541
-	PatientId               int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
542
-	AdviceId                int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
543
-	SupplyCancelOutId       int64   `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
544
-	SupplyWarehouseId       int64   `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
545
-	IsSource                int64   `gorm:"column:is_source" json:"is_source" form:"is_source"`
546
-	StorehouseId            int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
547
-	SecondWarehouseInfoId   int64   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
548
-	AdminUserId             int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
549
-	LastPrice               float64 `gorm:"column:last_price" json:"last_price" form:"last_price"`
550
-	StockCount              string  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
551
-	PharmacyId              int64   `gorm:"column:pharmacy_id" json:"pharmacy_id" form:"pharmacy_id"`
552
-	IsCheck                 int64   `gorm:"column:is_check" json:"is_check" form:"is_check"`
553
-	OverCount               int64   `gorm:"column:over_count" json:"over_count" form:"over_count"`
554
-	OrderId                 int64   `gorm:"column:order_id" json:"order_id" form:"order_id"`
555
-	ManafacturerName        string  `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
556
-	DepartmentName          string  `gorm:"column:department_name" json:"department_name" form:"department_name"`
557
-	ClassType               string  `gorm:"column:class_type" json:"class_type" form:"class_type"`
514
+	ID                      int64       `gorm:"column:id" json:"id" form:"id"`
515
+	WarehouseOutId          int64       `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
516
+	DrugId                  int64       `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
517
+	WarehousingOutTarget    int64       `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
518
+	Count                   int64       `gorm:"column:count" json:"count" form:"count"`
519
+	CountUnit               string      `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
520
+	Price                   float64     `gorm:"column:price" json:"price" form:"price"`
521
+	TotalPrice              float64     `gorm:"column:total_price" json:"total_price" form:"total_price"`
522
+	ProductDate             int64       `gorm:"column:product_date" json:"product_date" form:"product_date"`
523
+	ExpiryDate              int64       `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
524
+	Mtime                   int64       `gorm:"column:mtime" json:"mtime" form:"mtime"`
525
+	Ctime                   int64       `gorm:"column:ctime" json:"ctime" form:"ctime"`
526
+	Status                  int64       `gorm:"column:status" json:"status" form:"status"`
527
+	OrgId                   int64       `gorm:"column:org_id" json:"org_id" form:"org_id"`
528
+	Remark                  string      `gorm:"column:remark" json:"remark" form:"remark"`
529
+	IsCancel                int64       `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
530
+	WarehouseOutOrderNumber string      `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
531
+	Type                    int64       `gorm:"column:type" json:"type" form:"type"`
532
+	Dealer                  int64       `gorm:"column:dealer" json:"dealer" form:"dealer"`
533
+	Manufacturer            int64       `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
534
+	IsSys                   int64       `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
535
+	SysRecordTime           int64       `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
536
+	RetailPrice             float64     `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
537
+	RetailTotalPrice        float64     `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
538
+	WarehouseInfoId         int64       `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
539
+	Number                  string      `gorm:"column:number" json:"number" form:"number"`
540
+	BatchNumber             string      `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
541
+	PatientId               int64       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
542
+	AdviceId                int64       `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
543
+	SupplyCancelOutId       int64       `gorm:"column:supply_cancel_out_id" json:"supply_cancel_out_id" form:"supply_cancel_out_id"`
544
+	SupplyWarehouseId       int64       `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
545
+	IsSource                int64       `gorm:"column:is_source" json:"is_source" form:"is_source"`
546
+	StorehouseId            int64       `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
547
+	SecondWarehouseInfoId   int64       `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
548
+	AdminUserId             int64       `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
549
+	LastPrice               float64     `gorm:"column:last_price" json:"last_price" form:"last_price"`
550
+	StockCount              string      `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
551
+	PharmacyId              int64       `gorm:"column:pharmacy_id" json:"pharmacy_id" form:"pharmacy_id"`
552
+	IsCheck                 int64       `gorm:"column:is_check" json:"is_check" form:"is_check"`
553
+	OverCount               int64       `gorm:"column:over_count" json:"over_count" form:"over_count"`
554
+	OrderId                 int64       `gorm:"column:order_id" json:"order_id" form:"order_id"`
555
+	ManafacturerName        string      `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
556
+	DepartmentName          string      `gorm:"column:department_name" json:"department_name" form:"department_name"`
557
+	ClassType               string      `gorm:"column:class_type" json:"class_type" form:"class_type"`
558
+	BaseDrugLib             BaseDrugLib `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId"json:"drug" `
558 559
 }
559 560
 
560 561
 func (XtSelfDrugWarehouseOutInfo) TableName() string {

+ 1 - 0
models/new_monitor.go Bestand weergeven

@@ -73,6 +73,7 @@ type VMDialysisPrescription struct {
73 73
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
74 74
 	DialysisDurationHour       int64   `gorm:"column:dialysis_duration_hour" json:"dialysis_duration_hour" form:"dialysis_duration_hour"`
75 75
 	DialysisDurationMinute     int64   `gorm:"column:dialysis_duration_minute" json:"dialysis_duration_minute" form:"dialysis_duration_minute"`
76
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
76 77
 }
77 78
 
78 79
 func (VMDialysisPrescription) TableName() string {

+ 10 - 1
service/gobal_config_service.go Bestand weergeven

@@ -1149,8 +1149,17 @@ func GetPrescriptionList(patient_id int64, schedule_date int64, user_org_id int6
1149 1149
 func GetLastMonitorRecordList(patient_id int64, schedule_date int64, user_org_id int64) (models.MonitoringRecord, error) {
1150 1150
 
1151 1151
 	record := models.MonitoringRecord{}
1152
-	err := XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Order("operate_time desc").Last(&record).Error
1152
+	var err error
1153
+	if user_org_id != 10060 {
1154
+		err = XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Order("operate_time desc").Last(&record).Error
1155
+	}
1156
+
1157
+	if user_org_id == 10060 {
1158
+		err = XTReadDB().Where("patient_id =? and monitoring_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, user_org_id).Order("id desc").Last(&record).Error
1159
+	}
1160
+
1153 1161
 	return record, err
1162
+
1154 1163
 }
1155 1164
 
1156 1165
 func GetLastAfter(patient_id int64, schedule_date int64, user_org_id int64) (models.XtAssessmentAfterDislysis, error) {

+ 3 - 3
service/pharmacy_service.go Bestand weergeven

@@ -670,7 +670,7 @@ func FindMedicationList(orgid, drug_id, stime, etime, is_medicine int64) (pp []*
670 670
 	InitDrugidIsNil(orgid, stime, etime)
671 671
 	var tmp []*models.HisDoctorAdviceInfoL
672 672
 	err = XTReadDB().Model(&models.HisDoctorAdviceInfoL{}).Where(
673
-		"status = 1 and created_time >= ? and created_time <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp).Error
673
+		"status = 1 and advice_date >= ? and advice_date <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp).Error
674 674
 	if err != nil {
675 675
 		return pp, err
676 676
 	}
@@ -693,7 +693,7 @@ func FindMedicationList(orgid, drug_id, stime, etime, is_medicine int64) (pp []*
693 693
 
694 694
 	var tmp_advice []*models.XtDoctorAdviceL
695 695
 	err = XTReadDB().Model(&models.XtDoctorAdviceL{}).Where(
696
-		"status = 1 and (advice_type = 2 or advice_type = 3) and created_time >= ? and created_time <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp_advice).Error
696
+		"status = 1 and (advice_type = 2 or advice_type = 3) and advice_date >= ? and advice_date <= ? and user_org_id = ? and drug_id = ? and is_medicine = ?", stime, etime, orgid, drug_id, is_medicine).Find(&tmp_advice).Error
697 697
 	if err != nil {
698 698
 		return pp, err
699 699
 	}
@@ -2215,7 +2215,7 @@ func CalculateTheTotalAmount(tmp []*models.PatientInformation, drug_id int64) (t
2215 2215
 	minmunber := t.MinNumber                               //拆零数量
2216 2216
 	terrUnit := ""
2217 2217
 	for _, v := range tmp {
2218
-		fmt.Println("v2332233232322323", v.Quantity)
2218
+
2219 2219
 		switch v.Unit {
2220 2220
 		case t.MaxUnit:
2221 2221
 			maxunit = maxunit + v.Quantity

+ 65 - 1
service/self_drug_service.go Bestand weergeven

@@ -3660,7 +3660,7 @@ func DeleteSelfDrugWarehouse(id int64, tx *gorm.DB) error {
3660 3660
 
3661 3661
 func GetSelfWarehouseInfoByWarehouseInfo(id int64, patient_id int64, org_id int64) (info []*models.XtSelfDrugWarehouseInfo, err error) {
3662 3662
 
3663
-	err = XTReadDB().Where("id =? and patient_id =? and warehousing_id = ? and status=1 and org_id =?", id, patient_id, org_id).Find(&info).Error
3663
+	err = XTReadDB().Where("warehousing_id =? and patient_id =? and status=1 and org_id =?", id, patient_id, org_id).Find(&info).Error
3664 3664
 	return info, err
3665 3665
 }
3666 3666
 
@@ -3738,3 +3738,67 @@ func CreateSelfDrugStockSum(drug models.XtSelfDrugStockCount, tx *gorm.DB) error
3738 3738
 	}
3739 3739
 	return err
3740 3740
 }
3741
+
3742
+func GetSelfDrugWarehouseOutListById(warehouse_out_id int64, orgId int64, tx *gorm.DB) (info []*models.XtSelfDrugWarehouseOutInfo, err error) {
3743
+
3744
+	err = tx.Where("warehouse_out_id = ? and org_id  =? and status = 1", warehouse_out_id, orgId).Preload("BaseDrugLib", "status=1").Find(&info).Error
3745
+
3746
+	if err != gorm.ErrRecordNotFound {
3747
+		if err != nil {
3748
+			tx.Rollback()
3749
+			return info, err
3750
+		}
3751
+	}
3752
+	return info, err
3753
+}
3754
+
3755
+func GetAllSelfDrugWarehouseOutList(ids []int64, patient_id int64, start_time int64, end_time int64, org_id int64) (outInfo []*models.XtSelfDrugWarehouseOutInfo, err error) {
3756
+
3757
+	db := XTReadDB().Model(&outInfo).Where("status =1")
3758
+	if len(ids) > 0 {
3759
+		db = db.Where("drug_id in(?)", ids)
3760
+	}
3761
+	if patient_id > 0 {
3762
+		db = db.Where("patient_id = ?", patient_id)
3763
+	}
3764
+
3765
+	if start_time > 0 {
3766
+		db = db.Where("sys_record_time >=?", start_time)
3767
+	}
3768
+
3769
+	if end_time > 0 {
3770
+		db = db.Where("sys_record_time <=?", end_time)
3771
+	}
3772
+
3773
+	if org_id > 0 {
3774
+		db = db.Where("org_id =?", org_id)
3775
+	}
3776
+
3777
+	err = db.Preload("BaseDrugLib", "status=1 and org_id = ?", org_id).Find(&outInfo).Error
3778
+
3779
+	return outInfo, err
3780
+
3781
+}
3782
+
3783
+func DeleteSelfWarehouseOut(id int64) (models.XtSelfDrugWarehouseOutInfo, error) {
3784
+
3785
+	outInfo := models.XtSelfDrugWarehouseOutInfo{}
3786
+	err := XTWriteDB().Model(&outInfo).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
3787
+
3788
+	return outInfo, err
3789
+}
3790
+
3791
+func GetSelfDrugWarehouseOutById(id int64) (models.XtSelfDrugWarehouseOutInfo, error) {
3792
+
3793
+	outInfo := models.XtSelfDrugWarehouseOutInfo{}
3794
+	err = XTReadDB().Where("id = ? and status =1", id).Preload("BaseDrugLib", "status=1").Find(&outInfo).Error
3795
+
3796
+	return outInfo, err
3797
+}
3798
+
3799
+func GetSelfDrugQuery(user_org_id int64) (drug []*models.XtSelfDrugStockCount, err error) {
3800
+
3801
+	err = XTReadDB().Where("user_org_id = ? and status=1", user_org_id).Find(&drug).Error
3802
+
3803
+	return drug, err
3804
+}

+ 5 - 2
service/stock_service.go Bestand weergeven

@@ -8186,8 +8186,11 @@ func GetSelfDrugLastWarehouseOut(orgid int64, tx *gorm.DB) (models.XtSelfDrugWar
8186 8186
 	out := models.XtSelfDrugWarehouseOut{}
8187 8187
 	err := tx.Where("org_id = ? and status = 1", orgid).Find(&out).Error
8188 8188
 	if err != gorm.ErrRecordNotFound {
8189
-		tx.Rollback()
8190
-		return out, err
8189
+		if err != nil {
8190
+			tx.Rollback()
8191
+			return out, err
8192
+		}
8193
+
8191 8194
 	}
8192 8195
 	return out, err
8193 8196
 }