Selaa lähdekoodia

11月9日库存管理

XMLWAN 2 vuotta sitten
vanhempi
commit
c617cbc64e

+ 42 - 0
controllers/dialysis_api_controller.go Näytä tiedosto

@@ -95,6 +95,8 @@ func DialysisApiRegistRouters() {
95 95
 	beego.Router("/api/patient/gethisdialysisgoodcount", &DialysisApiController{}, "Get:GetHisDialysisGoodCount")
96 96
 
97 97
 	beego.Router("/api/schedule/getpatientshedule", &DialysisApiController{}, "Get:GetPatientSchedule")
98
+
99
+	beego.Router("/api/patient/getscheduleprintlist", &DialysisApiController{}, "Get:GetSchedulePrintList")
98 100
 }
99 101
 
100 102
 func (c *DialysisApiController) GetQueueCall() {
@@ -306,6 +308,7 @@ func (c *DialysisApiController) PostPrescription() {
306 308
 	is_water, _ := c.GetInt64("is_water")
307 309
 	drhy_water := c.GetString("drhy_water")
308 310
 	dry_water_hour := c.GetString("dry_water_hour")
311
+	water_machine := c.GetString("water_machine")
309 312
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
310 313
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
311 314
 
@@ -410,6 +413,7 @@ func (c *DialysisApiController) PostPrescription() {
410 413
 		IsWater:                    is_water,
411 414
 		DrhyWater:                  drhy_water,
412 415
 		DryWaterHour:               dry_water_hour,
416
+		WaterMachine:               water_machine,
413 417
 	}
414 418
 
415 419
 	if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -638,6 +642,7 @@ func (c *DialysisApiController) PostSoulution() {
638 642
 	is_water, _ := c.GetInt64("is_water")
639 643
 	dry_water_hour := c.GetString("dry_water_hour")
640 644
 	drhy_water := c.GetString("drhy_water")
645
+	water_machine := c.GetString("water_machine")
641 646
 	var prescription_doctor int64
642 647
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentAppId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
643 648
 
@@ -754,6 +759,7 @@ func (c *DialysisApiController) PostSoulution() {
754 759
 		IsWater:                    is_water,
755 760
 		DryWaterHour:               dry_water_hour,
756 761
 		DrhyWater:                  drhy_water,
762
+		WaterMachine:               water_machine,
757 763
 	}
758 764
 
759 765
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -1525,6 +1531,8 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1525 1531
 	weight_befor_remake := c.GetString("weight_befor_remake")
1526 1532
 	height := c.GetString("height")
1527 1533
 	age := c.GetString("age")
1534
+	his_department := c.GetString("his_department")
1535
+	his_bed := c.GetString("his_bed")
1528 1536
 	assessmentBeforeDislysis := models.PredialysisEvaluation{
1529 1537
 		DialysisCount:                  dialysis_count,
1530 1538
 		EmergencyTreatment:             emergency_treatment,
@@ -1596,6 +1604,8 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
1596 1604
 		WeightBeforRemake:              weight_befor_remake,
1597 1605
 		Height:                         height,
1598 1606
 		Age:                            age,
1607
+		HisDepartment:                  his_department,
1608
+		HisBed:                         his_bed,
1599 1609
 	}
1600 1610
 
1601 1611
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -4636,3 +4646,35 @@ func (this *DialysisApiController) GetPatientSchedule() {
4636 4646
 		"schedulePatient": schedulePatient,
4637 4647
 	})
4638 4648
 }
4649
+
4650
+func (c *DialysisApiController) GetSchedulePrintList() {
4651
+	page, _ := c.GetInt64("page", 1)
4652
+	limit, _ := c.GetInt64("limit", 10)
4653
+	schedulType, _ := c.GetInt64("schedule_type", 0)
4654
+	partitionType, _ := c.GetInt64("partition_type", 0)
4655
+	keywords := c.GetString("keywords")
4656
+	schedule_date := c.GetString("schedule_date")
4657
+	timeLayout := "2006-01-02"
4658
+	loc, _ := time.LoadLocation("Local")
4659
+	var theStartTime int64
4660
+	if len(schedule_date) > 0 {
4661
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", schedule_date+" 00:00:00", loc)
4662
+		if err != nil {
4663
+			utils.ErrorLog(err.Error())
4664
+		}
4665
+		theStartTime = theTime.Unix()
4666
+	}
4667
+	adminUserInfo := c.GetAdminUserInfo()
4668
+
4669
+	list, total, _ := service.GetSchedulePrintList(page, limit, schedulType, partitionType, keywords, theStartTime, adminUserInfo.CurrentOrgId)
4670
+
4671
+	listOne, _ := service.GetSchedulePrintListOne(page, limit, schedulType, partitionType, keywords, theStartTime, adminUserInfo.CurrentOrgId)
4672
+	numberList, _ := service.GetAllBedNumberSix(adminUserInfo.CurrentOrgId)
4673
+	c.ServeSuccessJSON(map[string]interface{}{
4674
+		"list":       list,
4675
+		"total":      total,
4676
+		"numberList": numberList,
4677
+		"listOne":    listOne,
4678
+	})
4679
+
4680
+}

+ 8 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go Näytä tiedosto

@@ -886,9 +886,8 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
886 886
 	psychological_other := c.GetString("psychological_other")
887 887
 
888 888
 	admission_number := c.GetString("admission_number")
889
-
890
-	//diacrisis, _ := c.GetInt64("diacrisis")
891
-
889
+	tumble, _ := c.GetInt64("diacrisis")
890
+	diacrisis := c.GetString("diacrisis")
892 891
 	if id <= 0 {
893 892
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
894 893
 		return
@@ -942,6 +941,7 @@ func (c *DialysisAPIController) PostAcceptsAssessment() {
942 941
 		PsychologicalOther:           psychological_other,
943 942
 		AdmissionNumber:              admission_number,
944 943
 		Tumble:                       tumble,
944
+		Diacrisis:                    diacrisis,
945 945
 	}
946 946
 
947 947
 	if receiveTreatment.ID == 0 { //新增
@@ -1375,6 +1375,8 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1375 1375
 	drhy_water := c.GetString("drhy_water")
1376 1376
 
1377 1377
 	dry_water_hour := c.GetString("dry_water_hour")
1378
+
1379
+	water_machine := c.GetString("water_machine")
1378 1380
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
1379 1381
 
1380 1382
 	//template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
@@ -1484,6 +1486,7 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1484 1486
 		IsWater:                    is_war,
1485 1487
 		DrhyWater:                  drhy_water,
1486 1488
 		DryWaterHour:               dry_water_hour,
1489
+		WaterMachine:               water_machine,
1487 1490
 	}
1488 1491
 
1489 1492
 	//查询最近透析准备表里是否存在 透析器 灌流器
@@ -2599,7 +2602,7 @@ func (c *DialysisAPIController) PostSolution() {
2599 2602
 	}
2600 2603
 	drhy_water := c.GetString("drhy_water")
2601 2604
 	dry_water_hour := c.GetString("dry_water_hour")
2602
-
2605
+	water_machine := c.GetString("water_machine")
2603 2606
 	if mode_id > 0 {
2604 2607
 		service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
2605 2608
 	}
@@ -2710,6 +2713,7 @@ func (c *DialysisAPIController) PostSolution() {
2710 2713
 		IsWater:                    is_war,
2711 2714
 		DrhyWater:                  drhy_water,
2712 2715
 		DryWaterHour:               dry_water_hour,
2716
+		WaterMachine:               water_machine,
2713 2717
 	}
2714 2718
 
2715 2719
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)

+ 13 - 1
controllers/mobile_api_controllers/patient_api_controller.go Näytä tiedosto

@@ -2796,6 +2796,18 @@ func predialysisEvaluationFormData(evaluation *models.PredialysisEvaluation, dat
2796 2796
 
2797 2797
 		evaluation.Age = age
2798 2798
 	}
2799
+
2800
+	if dataBody["his_department"] != nil && reflect.TypeOf(dataBody["his_department"]).String() == "string" {
2801
+		his_department := dataBody["his_department"].(string)
2802
+
2803
+		evaluation.HisDepartment = his_department
2804
+	}
2805
+
2806
+	if dataBody["his_bed"] != nil && reflect.TypeOf(dataBody["his_bed"]).String() == "string" {
2807
+		his_bed := dataBody["his_bed"].(string)
2808
+
2809
+		evaluation.HisBed = his_bed
2810
+	}
2799 2811
 	return
2800 2812
 }
2801 2813
 
@@ -2944,7 +2956,7 @@ func adviceFormData(advice *models.DoctorAdvice, data []byte, action string) (co
2944 2956
 		if dataBody["drug_name_id"] != nil || reflect.TypeOf(dataBody["drug_name_id"]).String() == "float64" {
2945 2957
 			drug_name_id := int64(dataBody["drug_name_id"].(float64))
2946 2958
 			advice.DrugNameId = drug_name_id
2947
-			fmt.Println("0000000000", advice.DrugNameId)
2959
+
2948 2960
 		}
2949 2961
 	}
2950 2962
 

+ 29 - 0
models/dialysis.go Näytä tiedosto

@@ -323,6 +323,8 @@ type PredialysisEvaluation struct {
323 323
 	WeightBeforRemake              string  `gorm:"column:weight_befor_remake" json:"weight_befor_remake" form:"weight_befor_remake"`
324 324
 	Height                         string  `gorm:"column:height" json:"height" form:"height"`
325 325
 	Age                            string  `gorm:"column:age" json:"age" form:"age"`
326
+	HisDepartment                  string  `gorm:"column:his_department" json:"his_department" form:"his_department"`
327
+	HisBed                         string  `gorm:"column:his_bed" json:"his_bed" form:"his_bed"`
326 328
 }
327 329
 
328 330
 func (PredialysisEvaluation) TableName() string {
@@ -963,6 +965,7 @@ type ReceiveTreatmentAsses struct {
963 965
 	PsychologicalOther           string `gorm:"column:psychological_other" json:"psychological_other"`
964 966
 	IsPrecaution                 int64  `gorm:"column:is_precaution" json:"is_precaution"`
965 967
 	AdmissionNumber              string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
968
+	Diacrisis                    string `gorm:"column:diacrisis" json:"diacrisis" form:"diacrisis"`
966 969
 	Tumble                       int64  `gorm:"column:tumble" json:"tumble" form:"tumble"`
967 970
 }
968 971
 
@@ -1200,3 +1203,29 @@ type HisDoctorAdvice struct {
1200 1203
 func (HisDoctorAdvice) TableName() string {
1201 1204
 	return "his_doctor_advice_info"
1202 1205
 }
1206
+
1207
+type DialysisScheduleSix struct {
1208
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
1209
+	UserOrgId    int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1210
+	PartitionId  int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1211
+	BedId        int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
1212
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1213
+	ScheduleDate int64  `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
1214
+	ScheduleType int64  `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1215
+	ScheduleWeek int64  `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1216
+	ModeId       int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1217
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
1218
+	Name         string `gorm:"column:name" json:"name" form:"name"`
1219
+}
1220
+
1221
+type DialysisScheduleSeven struct {
1222
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
1223
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1224
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
1225
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1226
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
1227
+}
1228
+
1229
+func (DialysisScheduleSeven) TableName() string {
1230
+	return "xt_schedule"
1231
+}

+ 87 - 15
models/good_models.go Näytä tiedosto

@@ -146,21 +146,21 @@ func (GoodInfoSeven) TableName() string {
146 146
 }
147 147
 
148 148
 type GoodsTypeOne struct {
149
-	ID             int64       `gorm:"column:id" json:"id"`
150
-	TypeCode       string      `gorm:"column:type_code" json:"type_code"`
151
-	TypeName       string      `gorm:"column:type_name" json:"type_name"`
152
-	Remark         string      `gorm:"column:remark" json:"remark"`
153
-	Ctime          int64       `gorm:"column:ctime" json:"ctime"`
154
-	Mtime          int64       `gorm:"column:mtime" json:"mtime"`
155
-	Creater        int64       `gorm:"column:creater" json:"creater"`
156
-	Modifier       int64       `gorm:"column:modifier" json:"modifier"`
157
-	OrgId          int64       `gorm:"column:org_id" json:"org_id"`
158
-	Status         int64       `gorm:"column:status" json:"status"`
159
-	Type           int64       `gorm:"column:type" json:"type"`
160
-	Number         int64       `gorm:"column:number" json:"number"`
161
-	OutStock       int64       `gorm:"column:out_stock" json:"out_stock" form:"out_stock"`
162
-	StockAttribute int64       `gorm:"column:stock_attribute" json:"stock_attribute" form:"stock_attribute"`
163
-	GoodInfo       []*GoodInfo `gorm:"ForeignKey:GoodTypeId;AssociationForeignKey:ID" json:"GoodInfo"`
149
+	ID             int64                    `gorm:"column:id" json:"id"`
150
+	TypeCode       string                   `gorm:"column:type_code" json:"type_code"`
151
+	TypeName       string                   `gorm:"column:type_name" json:"type_name"`
152
+	Remark         string                   `gorm:"column:remark" json:"remark"`
153
+	Ctime          int64                    `gorm:"column:ctime" json:"ctime"`
154
+	Mtime          int64                    `gorm:"column:mtime" json:"mtime"`
155
+	Creater        int64                    `gorm:"column:creater" json:"creater"`
156
+	Modifier       int64                    `gorm:"column:modifier" json:"modifier"`
157
+	OrgId          int64                    `gorm:"column:org_id" json:"org_id"`
158
+	Status         int64                    `gorm:"column:status" json:"status"`
159
+	Type           int64                    `gorm:"column:type" json:"type"`
160
+	Number         int64                    `gorm:"column:number" json:"number"`
161
+	OutStock       int64                    `gorm:"column:out_stock" json:"out_stock" form:"out_stock"`
162
+	StockAttribute int64                    `gorm:"column:stock_attribute" json:"stock_attribute" form:"stock_attribute"`
163
+	GoodInfo       []*GoodInformationThirty `gorm:"ForeignKey:GoodTypeId;AssociationForeignKey:ID" json:"GoodInfo"`
164 164
 }
165 165
 
166 166
 func (GoodsTypeOne) TableName() string {
@@ -217,3 +217,75 @@ type BloodGoodsType struct {
217 217
 func (BloodGoodsType) TableName() string {
218 218
 	return "xt_goods_type"
219 219
 }
220
+
221
+type GoodInformationThirty struct {
222
+	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
223
+	GoodCode                    string  `gorm:"column:good_code" json:"good_code" form:"good_code"`
224
+	SpecificationName           string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
225
+	GoodTypeId                  int64   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
226
+	GoodUnit                    int64   `gorm:"column:good_unit" json:"good_unit" form:"good_unit"`
227
+	BuyPrice                    float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
228
+	SellPrice                   float64 `gorm:"column:sell_price" json:"sell_price" form:"sell_price"`
229
+	Remark                      string  `gorm:"column:remark" json:"remark" form:"remark"`
230
+	Ctime                       int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
231
+	Mtime                       int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
232
+	Manufacturer                int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
233
+	Dealer                      int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
234
+	ExpiryDateWarnDayCount      int64   `gorm:"column:expiry_date_warn_day_count" json:"expiry_date_warn_day_count" form:"expiry_date_warn_day_count"`
235
+	StockWarnCount              int64   `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
236
+	IsReuse                     int64   `gorm:"column:is_reuse" json:"is_reuse" form:"is_reuse"`
237
+	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
238
+	FilmArea                    string  `gorm:"column:film_area" json:"film_area" form:"film_area"`
239
+	IsUse                       int64   `gorm:"column:is_use" json:"is_use" form:"is_use"`
240
+	FilmMaterialQuality         string  `gorm:"column:film_material_quality" json:"film_material_quality" form:"film_material_quality"`
241
+	OrgId                       int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
242
+	Modifier                    int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
243
+	Creater                     int64   `gorm:"column:creater" json:"creater" form:"creater"`
244
+	GoodName                    string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
245
+	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
246
+	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
247
+	GoodKind                    int64   `gorm:"column:good_kind" json:"good_kind" form:"good_kind"`
248
+	MedicalInsuranceLevel       int64   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
249
+	RetailPrice                 float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
250
+	MedicalInsuranceNumber      string  `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
251
+	IsSpecialDiseases           int64   `gorm:"column:is_special_diseases" json:"is_special_diseases" form:"is_special_diseases"`
252
+	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
253
+	StatisticsCategory          int64   `gorm:"column:statistics_category" json:"statistics_category" form:"statistics_category"`
254
+	GoodStatus                  string  `gorm:"column:good_status" json:"good_status" form:"good_status"`
255
+	DefaultCount                int64   `gorm:"column:default_count" json:"default_count" form:"default_count"`
256
+	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
257
+	IsChargeUse                 int64   `gorm:"column:is_charge_use" json:"is_charge_use" form:"is_charge_use"`
258
+	IsChargePredict             int64   `gorm:"column:is_charge_predict" json:"is_charge_predict" form:"is_charge_predict"`
259
+	IsStatisticsWork            int64   `gorm:"column:is_statistics_work" json:"is_statistics_work" form:"is_statistics_work"`
260
+	Sign                        int64   `gorm:"column:sign" json:"sign" form:"sign"`
261
+	Sort                        int64   `gorm:"column:sort" json:"sort" form:"sort"`
262
+	IsDoctorUse                 int64   `gorm:"column:is_doctor_use" json:"is_doctor_use" form:"is_doctor_use"`
263
+	Agent                       string  `gorm:"column:agent" json:"agent" form:"agent"`
264
+	GoodNumber                  string  `gorm:"column:good_number" json:"good_number" form:"good_number"`
265
+	CommdityCode                string  `gorm:"column:commdity_code" json:"commdity_code" form:"commdity_code"`
266
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
267
+	ProductionType              string  `gorm:"column:production_type" json:"production_type" form:"production_type"`
268
+	SpecialMedical              string  `gorm:"column:special_medical" json:"special_medical" form:"special_medical"`
269
+	IsMark                      int64   `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
270
+	Total                       float64 `gorm:"column:total" json:"total" form:"total"`
271
+	MinNumber                   int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
272
+	PackingUnit                 string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
273
+	PackingPrice                float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
274
+	DefaultCountUnit            string  `gorm:"column:default_count_unit" json:"default_count_unit" form:"default_count_unit"`
275
+	MinUnit                     string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
276
+	RegisterNumber              string  `gorm:"column:register_number" json:"register_number" form:"register_number"`
277
+	ProvincesCode               string  `gorm:"column:provinces_code" json:"provinces_code" form:"provinces_code"`
278
+	IsUser                      int64   `gorm:"column:is_user" json:"is_user" form:"is_user"`
279
+	Number                      string  `gorm:"column:number" json:"number" form:"number"`
280
+	IsWarehouse                 string  `gorm:"column:is_warehouse" json:"is_warehouse" form:"is_warehouse"`
281
+	BatchRetaiPrice             float64 `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
282
+	SumCount                    int64   `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
283
+	SumInCount                  int64   `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
284
+	TotalCount                  int64   `gorm:"column:total_count" json:"total_count" form:"total_count"`
285
+	SumOutCount                 int64   `gorm:"column:sum_out_count" json:"sum_out_count" form:"sum_out_count"`
286
+	SumCancelCount              int64   `gorm:"column:sum_cancel_count" json:"sum_cancel_count" form:"sum_cancel_count"`
287
+}
288
+
289
+func (GoodInformationThirty) TableName() string {
290
+	return "xt_good_information"
291
+}

+ 1 - 0
models/patient_models.go Näytä tiedosto

@@ -330,6 +330,7 @@ type DialysisPrescription struct {
330 330
 	IsWater                    int64         `gorm:"column:is_water" json:"is_water" form:"is_water"`
331 331
 	DrhyWater                  string        `gorm:"column:drhy_water" json:"drhy_water" form:"drhy_water"`
332 332
 	DryWaterHour               string        `gorm:"column:dry_water_hour" json:"dry_water_hour" form:"dry_water_hour"`
333
+	WaterMachine               string        `gorm:"column:water_machine" json:"water_machine" form:"water_machine"`
333 334
 }
334 335
 
335 336
 func (DialysisPrescription) TableName() string {

+ 43 - 0
service/dialysis_service.go Näytä tiedosto

@@ -1812,3 +1812,46 @@ func GetScheduleByPatient(patient_id int64, schedule_date int64, orgid int64) (m
1812 1812
 	err := XTReadDB().Where("patient_id = ? and schedule_date = ? and user_org_id = ? and status = 1", patient_id, schedule_date, orgid).Find(&schedule).Error
1813 1813
 	return schedule, err
1814 1814
 }
1815
+
1816
+func GetSchedulePrintList(page int64, limit int64, schedulType int64, partitionType int64, keywords string, schedule_date int64, orgID int64) (list []*models.DialysisScheduleSix, total int64, err error) {
1817
+
1818
+	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
1819
+	table := XTReadDB().Table("xt_patients as p").Where("p.status = 1")
1820
+	fmt.Println("table", table)
1821
+	if schedulType > 0 {
1822
+		db = db.Where("x.schedule_type = ?", schedulType)
1823
+	}
1824
+	if partitionType > 0 {
1825
+		db = db.Where("x.partition_id = ?", partitionType)
1826
+	}
1827
+	if orgID > 0 {
1828
+		db = db.Where("x.user_org_id = ?", orgID)
1829
+	}
1830
+	if schedule_date > 0 {
1831
+		db = db.Where("x.schedule_date = ?", schedule_date)
1832
+	}
1833
+	db = db.Joins("left join xt_patients as p on p.id = x.patient_id")
1834
+	likeKey := "%" + keywords + "%"
1835
+	if len(keywords) > 0 {
1836
+		db = db.Where("p.name like ?", likeKey)
1837
+	}
1838
+	err = db.Count(&total).Select("x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.status,p.name").Offset(limit * (page - 1)).Limit(limit).Order("x.schedule_date desc").Find(&list).Error
1839
+
1840
+	return list, total, err
1841
+}
1842
+
1843
+func GetSchedulePrintListOne(page int64, limit int64, schedulType int64, partitionType int64, keywords string, schedule_date int64, orgID int64) (list []*models.DialysisScheduleSeven, err error) {
1844
+
1845
+	db := XTReadDB().Model(&list).Where("status = 1")
1846
+	if orgID > 0 {
1847
+		db = db.Where("user_org_id = ?", orgID)
1848
+	}
1849
+	if schedulType > 0 {
1850
+		db = db.Where("schedule_type = ?", schedulType)
1851
+	}
1852
+	if partitionType > 0 {
1853
+		db = db.Where("partition_id = ?", partitionType)
1854
+	}
1855
+	err = db.Group("schedule_type,partition_id").Find(&list).Error
1856
+	return list, err
1857
+}