Browse Source

11月9日库存管理

XMLWAN 1 year ago
parent
commit
0bf73a3295

+ 1 - 1
conf/app.conf View File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode =dev
4 4
 #dev/prod
5 5
 

+ 3 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -665,6 +665,9 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
665 665
 				if adminUserInfo.Org.Id == 10340 {
666 666
 					evaluation.BreathingRate = "20"
667 667
 				}
668
+				if adminUserInfo.Org.Id == 10445 {
669
+					evaluation.VenousCatheterization = lastPredialysisEvaluation.VenousCatheterization
670
+				}
668 671
 			}
669 672
 		} else {
670 673
 			evaluation.UpdatedTime = time.Now().Unix()

+ 1 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -531,6 +531,7 @@ func (this *DialysisAPIController) DialysisRecord() {
531 531
 	temp_team_projects, _ := service.GetHisPrescriptionTeamProjects(adminInfo.Org.Id, patientID, date.Unix())
532 532
 
533 533
 	prescriptionConfig, _ := service.FindPrescriptionConfigById(adminInfo.Org.Id)
534
+
534 535
 	var team_projects []*models.HisPrescriptionProject
535 536
 	//var index int64 = 0
536 537
 	for _, item := range temp_team_projects {

+ 64 - 4
controllers/stock_in_api_controller.go View File

@@ -155,6 +155,7 @@ func StockManagerApiRegistRouters() {
155 155
 	beego.Router("/api/settle/cancelstock", &StockManagerApiController{}, "Get:HandleRefundStock")
156 156
 
157 157
 	beego.Router("/api/stock/getnewgoodwarehouseinfo", &StockManagerApiController{}, "Get:GetNewGoodWarehouseInfo")
158
+	beego.Router("/api/stock/getnewwarehouseoutinfolist", &StockManagerApiController{}, "Get:GetNewWarehouseOutInfoList")
158 159
 
159 160
 }
160 161
 func (c *StockManagerApiController) HandleRefundStock() {
@@ -7826,7 +7827,7 @@ func (this *StockManagerApiController) GetNewGoodWarehouseInfo() {
7826 7827
 	}
7827 7828
 	var endTime int64
7828 7829
 	if len(end_time) > 0 {
7829
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
7830
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
7830 7831
 		if err != nil {
7831 7832
 			utils.ErrorLog(err.Error())
7832 7833
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -7852,9 +7853,68 @@ func (this *StockManagerApiController) GetNewGoodWarehouseInfo() {
7852 7853
 	}
7853 7854
 
7854 7855
 	list, _ := service.GetNewGoodWarehouseInfo(startTime, endTime, orgId, goodids, storehouse_id)
7856
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
7857
+	dealerList, _ := service.GetAllDealerList(orgId)
7858
+	storeHouseList, _ := service.GetAllStoreHouseList(orgId)
7855 7859
 	this.ServeSuccessJSON(map[string]interface{}{
7856
-		"list": list,
7857
-		//"manufacturerList": manufacturerList,
7858
-		//"dealerList":       dealerList,
7860
+		"list":             list,
7861
+		"manufacturerList": manufacturerList,
7862
+		"dealerList":       dealerList,
7863
+		"storeHouseList":   storeHouseList,
7864
+	})
7865
+}
7866
+
7867
+func (this *StockManagerApiController) GetNewWarehouseOutInfoList() {
7868
+
7869
+	timeLayout := "2006-01-02"
7870
+	loc, _ := time.LoadLocation("Local")
7871
+	start_time := this.GetString("start_time")
7872
+	end_time := this.GetString("end_time")
7873
+	var startTime int64
7874
+	if len(start_time) > 0 {
7875
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
7876
+		if err != nil {
7877
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7878
+			return
7879
+		}
7880
+		startTime = theTime.Unix()
7881
+
7882
+	}
7883
+	var endTime int64
7884
+	if len(end_time) > 0 {
7885
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
7886
+		if err != nil {
7887
+			utils.ErrorLog(err.Error())
7888
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
7889
+			return
7890
+		}
7891
+		endTime = theTime.Unix()
7892
+	}
7893
+	storehouse_id, _ := this.GetInt64("storehouse_id")
7894
+
7895
+	keywords := this.GetString("keyword")
7896
+
7897
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7898
+	var goodids []int64
7899
+	//查询商品名称
7900
+	if len(keywords) > 0 {
7901
+		//查询商品名称
7902
+		list, _ := service.GetGoodInforByGoodName(keywords, orgId)
7903
+		for _, item := range list {
7904
+			goodids = append(goodids, item.ID)
7905
+			//入库详情但里面查询
7906
+		}
7907
+	}
7908
+
7909
+	list, _ := service.GetNewWarehouseOutInfoList(startTime, endTime, orgId, goodids, storehouse_id)
7910
+
7911
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
7912
+	dealerList, _ := service.GetAllDealerList(orgId)
7913
+	storeHouseList, _ := service.GetAllStoreHouseList(orgId)
7914
+	this.ServeSuccessJSON(map[string]interface{}{
7915
+		"list":             list,
7916
+		"manufacturerList": manufacturerList,
7917
+		"dealerList":       dealerList,
7918
+		"storeHouseList":   storeHouseList,
7859 7919
 	})
7860 7920
 }

+ 53 - 51
models/stock_models.go View File

@@ -279,26 +279,27 @@ func (WarehouseOutInfo) TableName() string {
279 279
 }
280 280
 
281 281
 type WarehouseOutInfoNight struct {
282
-	ID                      int64   `gorm:"column:id" json:"id"`
283
-	Count                   int64   `gorm:"column:count" json:"count"`
284
-	GoodId                  int64   `gorm:"column:good_id" json:"good_id"`
285
-	SysRecordTime           int64   `gorm:"column:sys_record_time" json:"sys_record_time"`
286
-	PatientId               int64   `gorm:"column:patient_id" json:"patient_id"`
287
-	ProjectId               int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
288
-	WarehouseInfotId        int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
289
-	IsSys                   int64   `gorm:"column:is_sys" json:"is_sys"`
290
-	Status                  int64   `gorm:"column:status" json:"status"`
291
-	OrgId                   int64   `gorm:"column:org_id" json:"org_id"`
292
-	WarehouseOutOrderNumber string  `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
293
-	StorehouseId            int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
294
-	Price                   float64 `gorm:"column:price" json:"price" form:"price"`
295
-	Dealer                  int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
296
-	Manufacturer            int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
297
-	GoodTypeId              int64   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
298
-	ProductDate             int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
299
-	ExpiryDate              int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
300
-	Number                  string  `gorm:"column:number" json:"number" form:"number"`
301
-	LicenseNumber           string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
282
+	ID                      int64                 `gorm:"column:id" json:"id"`
283
+	Count                   int64                 `gorm:"column:count" json:"count"`
284
+	GoodId                  int64                 `gorm:"column:good_id" json:"good_id"`
285
+	SysRecordTime           int64                 `gorm:"column:sys_record_time" json:"sys_record_time"`
286
+	PatientId               int64                 `gorm:"column:patient_id" json:"patient_id"`
287
+	ProjectId               int64                 `gorm:"column:project_id" json:"project_id" form:"project_id"`
288
+	WarehouseInfotId        int64                 `gorm:"column:warehouse_info_id" json:"warehouse_info_id"`
289
+	IsSys                   int64                 `gorm:"column:is_sys" json:"is_sys"`
290
+	Status                  int64                 `gorm:"column:status" json:"status"`
291
+	OrgId                   int64                 `gorm:"column:org_id" json:"org_id"`
292
+	WarehouseOutOrderNumber string                `gorm:"column:warehouse_out_order_number" json:"warehouse_out_order_number" form:"warehouse_out_order_number"`
293
+	StorehouseId            int64                 `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
294
+	Price                   float64               `gorm:"column:price" json:"price" form:"price"`
295
+	Dealer                  int64                 `gorm:"column:dealer" json:"dealer" form:"dealer"`
296
+	Manufacturer            int64                 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
297
+	GoodTypeId              int64                 `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
298
+	ProductDate             int64                 `gorm:"column:product_date" json:"product_date" form:"product_date"`
299
+	ExpiryDate              int64                 `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
300
+	Number                  string                `gorm:"column:number" json:"number" form:"number"`
301
+	LicenseNumber           string                `gorm:"column:license_number" json:"license_number" form:"license_number"`
302
+	GoodInfo                GoodInformationThirty `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
302 303
 }
303 304
 
304 305
 func (WarehouseOutInfoNight) TableName() string {
@@ -1574,37 +1575,38 @@ func (StartDrugWarehouseInfo) TableName() string {
1574 1575
 }
1575 1576
 
1576 1577
 type GoodWarehousingInfo struct {
1577
-	ID                        int64   `gorm:"column:id" json:"id"`
1578
-	WarehousingId             int64   `gorm:"column:warehousing_id" json:"warehousing_id"`
1579
-	GoodId                    int64   `gorm:"column:good_id" json:"good_id"`
1580
-	GoodTypeId                int64   `gorm:"column:good_type_id" json:"good_type_id"`
1581
-	Number                    string  `gorm:"column:number" json:"number"`
1582
-	ProductDate               int64   `gorm:"column:product_date" json:"product_date"`
1583
-	ExpiryDate                int64   `gorm:"column:expiry_date" json:"expiry_date"`
1584
-	WarehousingCount          int64   `gorm:"column:warehousing_count" json:"warehousing_count"`
1585
-	WarehousingUnit           string  `gorm:"column:warehousing_unit" json:"warehousing_unit"`
1586
-	Price                     float64 `gorm:"column:price" json:"price"`
1587
-	TotalPrice                float64 `gorm:"column:total_price" json:"total_price"`
1588
-	Dealer                    int64   `gorm:"column:dealer" json:"dealer"`
1589
-	Manufacturer              int64   `gorm:"column:manufacturer" json:"manufacturer"`
1590
-	Remark                    string  `gorm:"column:remark" json:"remark"`
1591
-	Ctime                     int64   `gorm:"column:ctime" json:"ctime"`
1592
-	Mtime                     int64   `gorm:"column:mtime" json:"mtime"`
1593
-	Status                    int64   `gorm:"column:status" json:"status"`
1594
-	OrgId                     int64   `gorm:"column:org_id" json:"org_id"`
1595
-	IsReturn                  int64   `gorm:"column:is_return" json:"is_return"`
1596
-	StockCount                int64   `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1597
-	WarehousingOrder          string  `gorm:"column:warehousing_order" json:"warehousing_order"`
1598
-	Type                      int64   `gorm:"column:type" json:"type"`
1599
-	LicenseNumber             string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
1600
-	WarehouseInfoId           int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1601
-	PackingPrice              float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
1602
-	SupplyWarehouseId         int64   `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
1603
-	SupplyWarehouseDetailInfo int64   `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
1604
-	StorehouseId              int64   `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
1605
-	SecondWarehouseInfoId     int64   `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
1606
-	IsCheck                   int64   `gorm:"column:is_check" json:"is_check" form:"is_check"`
1607
-	RegisterNumber            string  `gorm:"column:register_number" json:"register_number" form:"register_number"`
1578
+	ID                        int64                 `gorm:"column:id" json:"id"`
1579
+	WarehousingId             int64                 `gorm:"column:warehousing_id" json:"warehousing_id"`
1580
+	GoodId                    int64                 `gorm:"column:good_id" json:"good_id"`
1581
+	GoodTypeId                int64                 `gorm:"column:good_type_id" json:"good_type_id"`
1582
+	Number                    string                `gorm:"column:number" json:"number"`
1583
+	ProductDate               int64                 `gorm:"column:product_date" json:"product_date"`
1584
+	ExpiryDate                int64                 `gorm:"column:expiry_date" json:"expiry_date"`
1585
+	WarehousingCount          int64                 `gorm:"column:warehousing_count" json:"warehousing_count"`
1586
+	WarehousingUnit           string                `gorm:"column:warehousing_unit" json:"warehousing_unit"`
1587
+	Price                     float64               `gorm:"column:price" json:"price"`
1588
+	TotalPrice                float64               `gorm:"column:total_price" json:"total_price"`
1589
+	Dealer                    int64                 `gorm:"column:dealer" json:"dealer"`
1590
+	Manufacturer              int64                 `gorm:"column:manufacturer" json:"manufacturer"`
1591
+	Remark                    string                `gorm:"column:remark" json:"remark"`
1592
+	Ctime                     int64                 `gorm:"column:ctime" json:"ctime"`
1593
+	Mtime                     int64                 `gorm:"column:mtime" json:"mtime"`
1594
+	Status                    int64                 `gorm:"column:status" json:"status"`
1595
+	OrgId                     int64                 `gorm:"column:org_id" json:"org_id"`
1596
+	IsReturn                  int64                 `gorm:"column:is_return" json:"is_return"`
1597
+	StockCount                int64                 `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1598
+	WarehousingOrder          string                `gorm:"column:warehousing_order" json:"warehousing_order"`
1599
+	Type                      int64                 `gorm:"column:type" json:"type"`
1600
+	LicenseNumber             string                `gorm:"column:license_number" json:"license_number" form:"license_number"`
1601
+	WarehouseInfoId           int64                 `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1602
+	PackingPrice              float64               `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
1603
+	SupplyWarehouseId         int64                 `gorm:"column:supply_warehouse_id" json:"supply_warehouse_id" form:"supply_warehouse_id"`
1604
+	SupplyWarehouseDetailInfo int64                 `gorm:"column:supply_warehouse_detail_info" json:"supply_warehouse_detail_info" form:"supply_warehouse_detail_info"`
1605
+	StorehouseId              int64                 `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
1606
+	SecondWarehouseInfoId     int64                 `gorm:"column:second_warehouse_info_id" json:"second_warehouse_info_id" form:"second_warehouse_info_id"`
1607
+	IsCheck                   int64                 `gorm:"column:is_check" json:"is_check" form:"is_check"`
1608
+	RegisterNumber            string                `gorm:"column:register_number" json:"register_number" form:"register_number"`
1609
+	GoodInfo                  GoodInformationThirty `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
1608 1610
 }
1609 1611
 
1610 1612
 func (GoodWarehousingInfo) TableName() string {

+ 9 - 1
service/patient_service.go View File

@@ -66,9 +66,17 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
66 66
 	}
67 67
 
68 68
 	offset := (page - 1) * limit
69
+	if lapseto == 2 || lapseto == 3 {
70
+		err = db.Order("p.death_time desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
71
+
72
+	}
73
+	if lapseto != 2 && lapseto != 3 {
74
+		err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
75
+
76
+	}
69 77
 
70
-	err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
71 78
 	return
79
+
72 80
 }
73 81
 
74 82
 //GetAllPatientList 返回全部患者的列表

+ 26 - 2
service/stock_service.go View File

@@ -8381,7 +8381,7 @@ func GetWarehouseOutInfoIsExistSix(good_id int64, patient_id int64, record_time
8381 8381
 	return &info, nil
8382 8382
 }
8383 8383
 
8384
-func GetNewGoodWarehouseInfo(startime int64, endtime int64, orgid int64, good_id []int64, storehouse_id int64) (info []*models.WarehousingInfo, err error) {
8384
+func GetNewGoodWarehouseInfo(startime int64, endtime int64, orgid int64, good_id []int64, storehouse_id int64) (info []*models.GoodWarehousingInfo, err error) {
8385 8385
 
8386 8386
 	db := XTReadDB().Model(&info).Where("status = 1")
8387 8387
 
@@ -8400,6 +8400,30 @@ func GetNewGoodWarehouseInfo(startime int64, endtime int64, orgid int64, good_id
8400 8400
 	if storehouse_id > 0 {
8401 8401
 		db = db.Where("storehouse_id = ?", storehouse_id)
8402 8402
 	}
8403
-	err = db.Find(&info).Error
8403
+	err = db.Preload("GoodInfo", "org_id = ? and status= 1", orgid).Find(&info).Error
8404
+	return info, err
8405
+}
8406
+
8407
+func GetNewWarehouseOutInfoList(start_time int64, end_time int64, orgid int64, good_id []int64, storehouse_id int64) (info []*models.WarehouseOutInfoNight, err error) {
8408
+
8409
+	db := XTReadDB().Model(&info).Where("status= 1")
8410
+
8411
+	if start_time > 0 {
8412
+		db = db.Where("ctime>=?", start_time)
8413
+	}
8414
+	if end_time > 0 {
8415
+		db = db.Where("ctime <=?", end_time)
8416
+	}
8417
+
8418
+	if orgid > 0 {
8419
+		db = db.Where("org_id = ?", orgid)
8420
+	}
8421
+	if len(good_id) > 0 {
8422
+		db = db.Where("good_id in(?)", good_id)
8423
+	}
8424
+	if storehouse_id > 0 {
8425
+		db = db.Where("storehouse_id = ?", storehouse_id)
8426
+	}
8427
+	err = db.Preload("GoodInfo", "org_id = ? and status = 1", orgid).Find(&info).Error
8404 8428
 	return info, err
8405 8429
 }