XMLWAN 3 anni fa
parent
commit
43b284dbcf

+ 33 - 1
controllers/doctors_api_controller.go Vedi File

@@ -9,6 +9,7 @@ import (
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/jinzhu/gorm"
11 11
 	"strconv"
12
+	"strings"
12 13
 	"time"
13 14
 )
14 15
 
@@ -43,7 +44,8 @@ func DoctorApiRegistRouters() {
43 44
 	//阶段小结路由
44 45
 	beego.Router("/api/patient/getinspectionmajoritem", &DoctorsApiController{}, "Get:GetInspectionMajorItem")
45 46
 	beego.Router("/api/patient/getinspectiondetail", &DoctorsApiController{}, "Get:GetInspectionDetailByProject")
46
-
47
+	beego.Router("/api/patient/getinspectionitemlist", &DoctorsApiController{}, "Get:GetInspectionItemlist")
48
+	beego.Router("/api/patient/getinitdatelist", &DoctorsApiController{}, "Get:GetInitDateList")
47 49
 }
48 50
 
49 51
 func (c *DoctorsApiController) ScheduleAdvices() {
@@ -700,3 +702,33 @@ func (this *DoctorsApiController) GetInspectionDetailByProject() {
700 702
 		return
701 703
 	}
702 704
 }
705
+
706
+func (this *DoctorsApiController) GetInspectionItemlist() {
707
+	patient_id, _ := this.GetInt64("patient_id")
708
+	ids := this.GetString("ids")
709
+	inspect_date := this.GetString("inspect_date")
710
+	idSplit := strings.Split(ids, ",")
711
+	indateSplit := strings.Split(inspect_date, ",")
712
+	list, err := service.GetInspectionItemlist(patient_id, indateSplit, idSplit)
713
+	if err == nil {
714
+		this.ServeSuccessJSON(map[string]interface{}{
715
+			"list": list,
716
+		})
717
+		return
718
+	}
719
+}
720
+
721
+func (this *DoctorsApiController) GetInitDateList() {
722
+	patient_id, _ := this.GetInt64("patient_id")
723
+
724
+	prescription_list, _ := service.GetDialysisPrescriptionDataList(patient_id)
725
+	befor_list, err := service.GetDialysisBeforInitDateList(patient_id)
726
+
727
+	if err == nil {
728
+		this.ServeSuccessJSON(map[string]interface{}{
729
+			"beforlist":         befor_list,
730
+			"prescription_list": prescription_list,
731
+		})
732
+		return
733
+	}
734
+}

+ 86 - 0
controllers/drug_stock_api_contorller.go Vedi File

@@ -68,6 +68,8 @@ func DrugStockManagerApiRegistRouters() {
68 68
 
69 69
 	beego.Router("/api/drug/getcanceldrugorderprint", &StockDrugApiController{}, "get:GetCancelDrugOrderPrint")
70 70
 	beego.Router("/api/drug/drugcancelexportlist", &StockDrugApiController{}, "get:GetDrugCancelExportList")
71
+	beego.Router("/api/drug/getdrugwarehouseinfoprint", &StockDrugApiController{}, "get:GetDrugWarehouseInfoPrint")
72
+	beego.Router("/api/drug/getdrugoutorderprint", &StockDrugApiController{}, "get:GetDrugOutOrderPrint")
71 73
 }
72 74
 
73 75
 func (c *StockDrugApiController) CreateDrugWarehouse() {
@@ -2945,3 +2947,87 @@ func (this *StockDrugApiController) GetDrugCancelExportList() {
2945 2947
 		"list": list,
2946 2948
 	})
2947 2949
 }
2950
+
2951
+func (c *StockDrugApiController) GetDrugWarehouseInfoPrint() {
2952
+
2953
+	start_time := c.GetString("start_time")
2954
+	end_time := c.GetString("end_time")
2955
+	order_type, _ := c.GetInt64("order_type")
2956
+	timeLayout := "2006-01-02"
2957
+	loc, _ := time.LoadLocation("Local")
2958
+
2959
+	var startTime int64
2960
+	if len(start_time) > 0 {
2961
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
2962
+		if err != nil {
2963
+			fmt.Println(err)
2964
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2965
+			return
2966
+		}
2967
+		startTime = theTime.Unix()
2968
+	}
2969
+	var endTime int64
2970
+	if len(end_time) > 0 {
2971
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
2972
+		if err != nil {
2973
+			utils.ErrorLog(err.Error())
2974
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2975
+			return
2976
+		}
2977
+		endTime = theTime.Unix()
2978
+	}
2979
+	adminUserInfo := c.GetAdminUserInfo()
2980
+	orgId := adminUserInfo.CurrentOrgId
2981
+	if order_type == 1 {
2982
+		list, err := service.GetDrugWarehouseInfoPrint(startTime, endTime, orgId)
2983
+		if err == nil {
2984
+			c.ServeSuccessJSON(map[string]interface{}{
2985
+				"list": list,
2986
+			})
2987
+			return
2988
+		}
2989
+	}
2990
+}
2991
+
2992
+func (c *StockDrugApiController) GetDrugOutOrderPrint() {
2993
+
2994
+	start_time := c.GetString("start_time")
2995
+	end_time := c.GetString("end_time")
2996
+	order_type, _ := c.GetInt64("order_type")
2997
+	timeLayout := "2006-01-02"
2998
+	loc, _ := time.LoadLocation("Local")
2999
+
3000
+	var startTime int64
3001
+	if len(start_time) > 0 {
3002
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
3003
+		if err != nil {
3004
+			fmt.Println(err)
3005
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3006
+			return
3007
+		}
3008
+		startTime = theTime.Unix()
3009
+	}
3010
+	var endTime int64
3011
+	if len(end_time) > 0 {
3012
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
3013
+		if err != nil {
3014
+			utils.ErrorLog(err.Error())
3015
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3016
+			return
3017
+		}
3018
+		endTime = theTime.Unix()
3019
+	}
3020
+	adminUserInfo := c.GetAdminUserInfo()
3021
+	orgId := adminUserInfo.CurrentOrgId
3022
+	if order_type == 2 {
3023
+		//list, err := service.GetDrugOutOrderPrint(startTime, endTime, orgId)
3024
+		list, err := service.GetDrugOutOrderPrintList(startTime, endTime, orgId)
3025
+		if err == nil {
3026
+			c.ServeSuccessJSON(map[string]interface{}{
3027
+				"list": list,
3028
+			})
3029
+			return
3030
+		}
3031
+	}
3032
+
3033
+}

+ 4 - 14
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Vedi File

@@ -334,22 +334,12 @@ func (this *StaffScheduleApiController) UpdatePatientScheduleById() {
334 334
 		for index, _ := range list {
335 335
 			fmt.Println("index2322332", index)
336 336
 			schedule := models.XtSchedule{
337
-				PartitionId:  list[0].PartitionId,
338
-				BedId:        list[0].BedId,
339
-				PatientId:    list[0].PatientId,
340
-				ScheduleDate: list[0].ScheduleDate,
341
-				ScheduleType: list[0].ScheduleType,
342
-				ScheduleWeek: list[0].ScheduleWeek,
343
-				ModeId:       list[0].ModeId,
337
+				PatientId: list[0].PatientId,
338
+				ModeId:    list[0].ModeId,
344 339
 			}
345 340
 			xtSchedule := models.WeekSchedule{
346
-				PartitionId:  list[1].PartitionId,
347
-				BedId:        list[1].BedId,
348
-				PatientId:    list[1].PatientId,
349
-				ScheduleDate: list[1].ScheduleDate,
350
-				ScheduleType: list[1].ScheduleType,
351
-				ScheduleWeek: list[1].ScheduleWeek,
352
-				ModeId:       list[1].ModeId,
341
+				PatientId: list[1].PatientId,
342
+				ModeId:    list[1].ModeId,
353 343
 			}
354 344
 			err = service.UpdateStaffSchedule(list[1].ID, schedule)
355 345
 			fmt.Println("errrrrrrr2323323232323", err)

+ 12 - 0
controllers/print_data_api_controller.go Vedi File

@@ -204,4 +204,16 @@ func (this *PrintDataAPIController) GetGoodDetailPrintList() {
204 204
 		})
205 205
 	}
206 206
 
207
+	//出库详情
208
+	if types == 2 {
209
+		list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
210
+		if err != nil {
211
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
212
+			return
213
+		}
214
+		this.ServeSuccessJSON(map[string]interface{}{
215
+			"list": list,
216
+		})
217
+	}
218
+
207 219
 }

+ 71 - 64
models/self_drug_models.go Vedi File

@@ -68,6 +68,10 @@ type XtBaseDrug struct {
68 68
 	Total                  float64 `gorm:"column:total" json:"total" form:"total"`
69 69
 	PrescribingNumberUnit  string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
70 70
 	MinNumber              int64   `gorm:"column:min_number" json:"min_number" form:"min_number"`
71
+	Dose                   float64 `gorm:"column:dose" json:"dose" form:"dose"`
72
+	DoseUnit               string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
73
+	DrugDay                string  `gorm:"column:drug_day" json:"drug_day" form:"drug_day"`
74
+	MinPrice               float64 `gorm:"column:min_price" json:"min_price" form:"min_price"`
71 75
 }
72 76
 
73 77
 func (XtBaseDrug) TableName() string {
@@ -322,33 +326,34 @@ func (XtDrugWarehouseOut) TableName() string {
322 326
 }
323 327
 
324 328
 type XtDrugWarehouseOutInfo struct {
325
-	ID                      int64   `gorm:"column:id" json:"id" form:"id"`
326
-	WarehouseOutId          int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
327
-	DrugId                  int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
328
-	WarehousingOutTarget    int64   `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
329
-	Count                   int64   `gorm:"column:count" json:"count" form:"count"`
330
-	Price                   float64 `gorm:"column:price" json:"price" form:"price"`
331
-	TotalPrice              float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
332
-	ProductDate             int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
333
-	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
334
-	Mtime                   int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
335
-	Ctime                   int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
336
-	Status                  int64   `gorm:"column:status" json:"status" form:"status"`
337
-	OrgId                   int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
338
-	Remark                  string  `gorm:"column:remark" json:"remark" form:"remark"`
339
-	IsCancel                int64   `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
340
-	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
341
-	Type                    int64   `gorm:"column:type" json:"type" form:"type"`
342
-	Dealer                  int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
343
-	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
344
-	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
345
-	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
346
-	RetailPrice             float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
347
-	RetailTotalPrice        float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
348
-	CountUnit               string  `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
349
-	WarehouseInfoId         int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
350
-	Number                  string  `gorm:"column:number" json:"number" form:"number"`
351
-	BatchNumber             string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
329
+	ID                      int64      `gorm:"column:id" json:"id" form:"id"`
330
+	WarehouseOutId          int64      `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
331
+	DrugId                  int64      `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
332
+	WarehousingOutTarget    int64      `gorm:"column:warehousing_out_target" json:"warehousing_out_target" form:"warehousing_out_target"`
333
+	Count                   int64      `gorm:"column:count" json:"count" form:"count"`
334
+	Price                   float64    `gorm:"column:price" json:"price" form:"price"`
335
+	TotalPrice              float64    `gorm:"column:total_price" json:"total_price" form:"total_price"`
336
+	ProductDate             int64      `gorm:"column:product_date" json:"product_date" form:"product_date"`
337
+	ExpiryDate              int64      `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
338
+	Mtime                   int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
339
+	Ctime                   int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
340
+	Status                  int64      `gorm:"column:status" json:"status" form:"status"`
341
+	OrgId                   int64      `gorm:"column:org_id" json:"org_id" form:"org_id"`
342
+	Remark                  string     `gorm:"column:remark" json:"remark" form:"remark"`
343
+	IsCancel                int64      `gorm:"column:is_cancel" json:"is_cancel" form:"is_cancel"`
344
+	WarehouseOutOrderNumber string     `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
345
+	Type                    int64      `gorm:"column:type" json:"type" form:"type"`
346
+	Dealer                  int64      `gorm:"column:dealer" json:"dealer" form:"dealer"`
347
+	Manufacturer            int64      `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
348
+	IsSys                   int64      `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
349
+	SysRecordTime           int64      `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
350
+	RetailPrice             float64    `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
351
+	RetailTotalPrice        float64    `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
352
+	CountUnit               string     `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
353
+	WarehouseInfoId         int64      `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
354
+	Number                  string     `gorm:"column:number" json:"number" form:"number"`
355
+	BatchNumber             string     `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
356
+	XtBaseDrug              XtBaseDrug `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" `
352 357
 }
353 358
 
354 359
 func (XtDrugWarehouseOutInfo) TableName() string {
@@ -356,18 +361,19 @@ func (XtDrugWarehouseOutInfo) TableName() string {
356 361
 }
357 362
 
358 363
 type XtDrugAutomaticReduceDetail struct {
359
-	ID                      int64  `gorm:"column:id" json:"id" form:"id"`
360
-	WarehouseOutId          int64  `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
361
-	WarehouseOutOrderNumber string `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
362
-	PatientId               int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
363
-	Ctime                   int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
364
-	Mtime                   int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
365
-	Status                  int64  `gorm:"column:status" json:"status" form:"status"`
366
-	RecordTime              int64  `gorm:"column:record_time" json:"record_time" form:"record_time"`
367
-	OrgId                   int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
368
-	DrugId                  int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
369
-	Count                   int64  `gorm:"column:count" json:"count" form:"count"`
370
-	CountUnit               string `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
364
+	ID                      int64      `gorm:"column:id" json:"id" form:"id"`
365
+	WarehouseOutId          int64      `gorm:"column:warehouse_out_id" json:"warehouse_out_id" form:"warehouse_out_id"`
366
+	WarehouseOutOrderNumber string     `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
367
+	PatientId               int64      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
368
+	Ctime                   int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
369
+	Mtime                   int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
370
+	Status                  int64      `gorm:"column:status" json:"status" form:"status"`
371
+	RecordTime              int64      `gorm:"column:record_time" json:"record_time" form:"record_time"`
372
+	OrgId                   int64      `gorm:"column:org_id" json:"org_id" form:"org_id"`
373
+	DrugId                  int64      `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
374
+	Count                   int64      `gorm:"column:count" json:"count" form:"count"`
375
+	CountUnit               string     `gorm:"column:count_unit" json:"count_unit" form:"count_unit"`
376
+	XtBaseDrug              XtBaseDrug `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" `
371 377
 }
372 378
 
373 379
 func (XtDrugAutomaticReduceDetail) TableName() string {
@@ -375,31 +381,32 @@ func (XtDrugAutomaticReduceDetail) TableName() string {
375 381
 }
376 382
 
377 383
 type XtDrugWarehouseInfo struct {
378
-	ID               int64   `gorm:"column:id" json:"id" form:"id"`
379
-	WarehousingId    int64   `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
380
-	DrugId           int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
381
-	Number           string  `gorm:"column:number" json:"number" form:"number"`
382
-	ProductDate      int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
383
-	ExpiryDate       int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
384
-	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
385
-	Price            float64 `gorm:"column:price" json:"price" form:"price"`
386
-	TotalPrice       float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
387
-	Dealer           int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
388
-	Manufacturer     int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
389
-	Remark           string  `gorm:"column:remark" json:"remark" form:"remark"`
390
-	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
391
-	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
392
-	Status           int64   `gorm:"column:status" json:"status" form:"status"`
393
-	OrgId            int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
394
-	IsReturn         int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
395
-	WarehousingOrder string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
396
-	Type             int64   `gorm:"column:type" json:"type" form:"type"`
397
-	RetailPrice      float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
398
-	RetailTotalPrice float64 `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
399
-	StockMaxNumber   int64   `gorm:"column:stock_max_number" json:"stock_max_number"`
400
-	StockMinNumber   int64   `gorm:"column:stock_min_number" json:"stock_min_number"`
401
-	BatchNumber      string  `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
402
-	MaxUnit          string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
384
+	ID               int64      `gorm:"column:id" json:"id" form:"id"`
385
+	WarehousingId    int64      `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
386
+	DrugId           int64      `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
387
+	Number           string     `gorm:"column:number" json:"number" form:"number"`
388
+	ProductDate      int64      `gorm:"column:product_date" json:"product_date" form:"product_date"`
389
+	ExpiryDate       int64      `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
390
+	WarehousingCount int64      `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
391
+	Price            float64    `gorm:"column:price" json:"price" form:"price"`
392
+	TotalPrice       float64    `gorm:"column:total_price" json:"total_price" form:"total_price"`
393
+	Dealer           int64      `gorm:"column:dealer" json:"dealer" form:"dealer"`
394
+	Manufacturer     int64      `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
395
+	Remark           string     `gorm:"column:remark" json:"remark" form:"remark"`
396
+	Ctime            int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
397
+	Mtime            int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
398
+	Status           int64      `gorm:"column:status" json:"status" form:"status"`
399
+	OrgId            int64      `gorm:"column:org_id" json:"org_id" form:"org_id"`
400
+	IsReturn         int64      `gorm:"column:is_return" json:"is_return" form:"is_return"`
401
+	WarehousingOrder string     `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
402
+	Type             int64      `gorm:"column:type" json:"type" form:"type"`
403
+	RetailPrice      float64    `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
404
+	RetailTotalPrice float64    `gorm:"column:retail_total_price" json:"retail_total_price" form:"retail_total_price"`
405
+	StockMaxNumber   int64      `gorm:"column:stock_max_number" json:"stock_max_number"`
406
+	StockMinNumber   int64      `gorm:"column:stock_min_number" json:"stock_min_number"`
407
+	BatchNumber      string     `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
408
+	MaxUnit          string     `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
409
+	XtBaseDrug       XtBaseDrug `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" `
403 410
 }
404 411
 
405 412
 func (XtDrugWarehouseInfo) TableName() string {

+ 21 - 0
models/stock_models.go Vedi File

@@ -368,6 +368,27 @@ func (AutomaticReduceDetail) TableName() string {
368 368
 	return "xt_automatic_reduce_detail"
369 369
 }
370 370
 
371
+type SgjAutomaticReduceDetail struct {
372
+	ID                      int64   `gorm:"column:id" json:"id"`
373
+	WarehouseOutId          int64   `gorm:"column:warehouse_out_id" json:"warehouse_out_id"`
374
+	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number"`
375
+	PatientId               int64   `gorm:"column:patient_id" json:"patient_id"`
376
+	Ctime                   int64   `gorm:"column:ctime" json:"ctime"`
377
+	Mtime                   int64   `gorm:"column:mtime" json:"mtime"`
378
+	Status                  int64   `gorm:"column:status" json:"status"`
379
+	RecordTime              int64   `gorm:"column:record_time" json:"record_time"`
380
+	OrgId                   int64   `gorm:"column:org_id" json:"org_id"`
381
+	GoodId                  int64   `gorm:"column:good_id" json:"good_id"`
382
+	GoodTypeId              int64   `gorm:"column:good_type_id" json:"good_type_id"`
383
+	Count                   int64   `gorm:"column:count" json:"count"`
384
+	Type                    int64   `gorm:"column:type" json:"type"`
385
+	GoodName                string  `gorm:"column:good_name" json:"good_name"`
386
+	SpecificationName       string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
387
+	PackingUnit             string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
388
+	RetailPrice             float64 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
389
+	PackingPrice            float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
390
+}
391
+
371 392
 type VmWarehouseOutInfo struct {
372 393
 	GoodId int64   `gorm:"column:good_id" json:"good_id"`
373 394
 	Count  int64   `gorm:"column:count" json:"count"`

+ 5 - 4
service/doctor_schedule_service.go Vedi File

@@ -591,8 +591,9 @@ func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int
591 591
 	if classtype > 0 {
592 592
 		db = db.Where("s.schedule_type = ?", classtype)
593 593
 	}
594
-	err = db.Preload("DeviceZone", " status= 1").Preload("DeviceNumber", "status= 1").
595
-		Preload("DialysisOrder", "status =1").Joins("JOIN xt_patients as p ON p.id = s.patient_id and p.lapseto = 1 and p.user_org_id =?", orgid).Where("s.user_org_id = ? and s.schedule_date = ? and s.status =1", orgid, startime).
594
+	err = db.Preload("DeviceZone", " status= 1").Preload("DeviceNumber", func(db *gorm.DB) *gorm.DB {
595
+		return XTReadDB().Model(&models.DeviceNumber{}).Where("status = 1 AND org_id = ?", orgid).Order("sort asc")
596
+	}).Preload("DialysisOrder", "status =1").Joins("JOIN xt_patients as p ON p.id = s.patient_id and p.lapseto = 1 and p.user_org_id =?", orgid).Where("s.user_org_id = ? and s.schedule_date = ? and s.status =1", orgid, startime).
596 597
 		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id,p.name as patient").Find(&schedule).Error
597 598
 	return schedule, err
598 599
 }
@@ -625,12 +626,12 @@ func GetStaffScheduleById(ids []string) (schedule []*models.XtSchedule, err erro
625 626
 
626 627
 func UpdateStaffSchedule(nextid int64, schedule models.XtSchedule) error {
627 628
 
628
-	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"partition_id": schedule.PartitionId, "bed_id": schedule.BedId, "patient_id": schedule.PatientId, "schedule_type": schedule.ScheduleType, "schedule_week": schedule.ScheduleWeek, "mode_id": schedule.ModeId}).Error
629
+	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId}).Error
629 630
 	return err
630 631
 }
631 632
 
632 633
 func UpdateStaffScheduleOne(nextid int64, schedule models.WeekSchedule) error {
633 634
 
634
-	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"partition_id": schedule.PartitionId, "bed_id": schedule.BedId, "patient_id": schedule.PatientId, "schedule_type": schedule.ScheduleType, "schedule_week": schedule.ScheduleWeek, "mode_id": schedule.ModeId}).Error
635
+	err := XTWriteDB().Model(&schedule).Where("id = ?", nextid).Updates(map[string]interface{}{"patient_id": schedule.PatientId, "mode_id": schedule.ModeId}).Error
635 636
 	return err
636 637
 }

+ 67 - 0
service/drug_stock_service.go Vedi File

@@ -193,3 +193,70 @@ func GetDrugCancelExportList(orderid []string, orgid int64) (info []*models.Drug
193 193
 	err = db.Find(&info).Error
194 194
 	return info, err
195 195
 }
196
+
197
+func GetDrugWarehouseInfoPrint(startime int64, endtime int64, orgid int64) (info []*models.XtDrugWarehouseInfo, err error) {
198
+
199
+	db := XTReadDB().Table("xt_drug_warehouse_info").Where("status = 1")
200
+	if startime > 0 {
201
+		db = db.Where("ctime >=?", startime)
202
+	}
203
+	if endtime > 0 {
204
+		db = db.Where("ctime<=?", endtime)
205
+	}
206
+	if orgid > 0 {
207
+		db = db.Where("org_id = ?", orgid)
208
+	}
209
+	err = db.Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Group("drug_id").Find(&info).Error
210
+
211
+	//err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.price,x.total_price,x.dealer,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.batch_number").Group("x.drug_id").Find(&DrugWarehouseInfo{}).Error
212
+	return info, err
213
+}
214
+
215
+//func GetDrugWarehouseInfoList(startime int64,endtime int64,orgid int64)(info []*models.BloodAutomaticReduceDetail,err error)  {
216
+//
217
+//
218
+//  db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")
219
+//  if startime > 0 {
220
+//    db = db.Where("x.ctime >=?", startime)
221
+//  }
222
+//  if endtime>0{
223
+//    db = db.Where("x.ctime<=?", endtime)
224
+//  }
225
+//  if orgid > 0{
226
+//    db = db.Where("x.org_id = ?", orgid)
227
+//  }
228
+//
229
+//
230
+//}
231
+
232
+func GetDrugOutOrderPrint(startime int64, endtime int64, orgid int64) (info []*models.XtDrugWarehouseOutInfo, err error) {
233
+
234
+	db := XTReadDB().Table("xt_drug_warehouse_out_info").Where("status = 1")
235
+	if startime > 0 {
236
+		db = db.Where("ctime >=?", startime)
237
+	}
238
+	if endtime > 0 {
239
+		db = db.Where("ctime<=?", endtime)
240
+	}
241
+	if orgid > 0 {
242
+		db = db.Where("org_id = ?", orgid)
243
+	}
244
+	err = db.Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Group("drug_id").Find(&info).Error
245
+	return info, err
246
+}
247
+
248
+func GetDrugOutOrderPrintList(startime int64, endtime int64, orgid int64) (list []*models.XtDrugAutomaticReduceDetail, err error) {
249
+
250
+	db := XTReadDB().Table("xt_drug_automatic_reduce_detail").Where("status = 1")
251
+	if startime > 0 {
252
+		db = db.Where("ctime >=?", startime)
253
+	}
254
+	if endtime > 0 {
255
+		db = db.Where("ctime<=?", endtime)
256
+	}
257
+	if orgid > 0 {
258
+		db = db.Where("org_id = ?", orgid)
259
+	}
260
+	err = db.Preload("XtBaseDrug", "status = 1 and org_id = ?", orgid).Find(&list).Error
261
+	return list, err
262
+}

+ 40 - 0
service/patientmanage_service.go Vedi File

@@ -1658,3 +1658,43 @@ func GetInspectionDetailByProject(project_id int64, patientid int64, inspect_dat
1658 1658
 	err = db.Select("x.id,x.patient_id,x.org_id,x.project_id,x.item_id,x.item_name,x.project_name,x.inspect_type,x.inspect_value,x.inspect_date,t.range_max,t.range_min,t.range_value,t.unit").Joins("left join xt_inspection_reference as t on t.id = x.item_id").Scan(&inspection).Error
1659 1659
 	return inspection, err
1660 1660
 }
1661
+
1662
+func GetInspectionItemlist(patientid int64, inspect_date []string, projectid []string) (inspection []*models.XtInspection, err error) {
1663
+
1664
+	db := XTReadDB().Model(&inspection).Where("status = 1")
1665
+	if patientid > 0 {
1666
+		db = db.Where("patient_id = ?", patientid)
1667
+	}
1668
+	if len(inspect_date) > 0 {
1669
+		db = db.Where("inspect_date in(?)", inspect_date)
1670
+	}
1671
+
1672
+	if len(projectid) > 0 {
1673
+		db = db.Where("project_id in(?)", projectid)
1674
+	}
1675
+
1676
+	err = db.Find(&inspection).Error
1677
+	return inspection, err
1678
+}
1679
+
1680
+func GetDialysisBeforInitDateList(patient_id int64) (models.DialysisAssesmentBefor, error) {
1681
+	befor := models.DialysisAssesmentBefor{}
1682
+	db := XTReadDB().Model(&befor).Where("status = 1")
1683
+	if patient_id > 0 {
1684
+		db = db.Where("patient_id = ? and assessment_date>=1627747200 and assessment_date<=1630339200 ", patient_id)
1685
+	}
1686
+
1687
+	err = db.Last(&befor).Error
1688
+	return befor, err
1689
+}
1690
+
1691
+func GetDialysisPrescriptionDataList(patient_id int64) (models.DialysisPrescription, error) {
1692
+
1693
+	prescription := models.DialysisPrescription{}
1694
+	db := XTReadDB().Model(&prescription).Where("status = 1")
1695
+	if patient_id > 0 {
1696
+		db = db.Where("patient_id = ? and record_date>=1627747200 and record_date<=1630339200", patient_id)
1697
+	}
1698
+	err = db.Last(&prescription).Error
1699
+	return prescription, err
1700
+}

+ 21 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Vedi File

@@ -216,7 +216,7 @@ func GetGoodInfomationList(orgid int64) (goodInfo []*models.GoodInfo, err error)
216 216
 }
217 217
 
218 218
 func GetWarehouseInfoGoodDetailPrintList(orgid int64, startime int64, endtime int64, limit int64, page int64) (info []*models.VmWarehousingInfo, err error) {
219
-	offset := (page - 1) * limit
219
+	//offset := (page - 1) * limit
220 220
 	db := p_service.XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1")
221 221
 	table := p_service.XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
222 222
 	fmt.Println(table)
@@ -231,6 +231,25 @@ func GetWarehouseInfoGoodDetailPrintList(orgid int64, startime int64, endtime in
231 231
 		db = db.Where("x.ctime<=?", endtime)
232 232
 	}
233 233
 
234
-	err = db.Select("x.id,x.warehousing_id,x.good_id,x.good_type_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.warehousing_unit,x.stock_count,x.price,x.total_price,x.dealer,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.license_number,t.good_name,t.specification_name,t.min_number,t.packing_unit").Joins("left join xt_good_information as t on t.id = x.good_id").Offset(offset).Limit(limit).Scan(&info).Error
234
+	err = db.Select("x.id,x.warehousing_id,x.good_id,x.good_type_id,x.number,x.product_date,x.expiry_date,sum(x.warehousing_count) as warehousing_count,x.warehousing_unit,x.stock_count,x.price,x.total_price,x.dealer,x.manufacturer,x.remark,x.is_return,x.warehousing_order,x.type,x.license_number,t.good_name,t.specification_name,t.min_number,t.packing_unit").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id").Scan(&info).Error
235 235
 	return info, err
236 236
 }
237
+
238
+func GetWarehouseOutInfoGoodDetailPrintList(orgid int64, startime int64, endtime int64, limit int64, page int64) (auto []*models.SgjAutomaticReduceDetail, err error) {
239
+
240
+	db := p_service.XTReadDB().Table("xt_automatic_reduce_detail as x").Where("x.status = 1")
241
+	table := p_service.XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
242
+	fmt.Println(table)
243
+	if orgid > 0 {
244
+		db = db.Where("x.org_id = ?", orgid)
245
+	}
246
+	if startime > 0 {
247
+		db = db.Where("x.ctime >= ?", startime)
248
+	}
249
+	if endtime > 0 {
250
+		db = db.Where("x.ctime<=?", endtime)
251
+	}
252
+	err = db.Select("x.patient_id,x.record_time,x.good_id,sum(x.count) as count,t.good_name,t.specification_name,t.packing_unit,t.retail_price,t.packing_price").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id").Scan(&auto).Error
253
+	return auto, err
254
+
255
+}