陈少旭 10 mesi fa
parent
commit
a883e07822

+ 10 - 8
controllers/his_api_controller.go Vedi File

5248
 	new_prescription, p_err := service.GetPrescriptionById(prescription_id, c.GetAdminUserInfo().CurrentOrgId)
5248
 	new_prescription, p_err := service.GetPrescriptionById(prescription_id, c.GetAdminUserInfo().CurrentOrgId)
5249
 	new_prescriptions, _ := service.GetHisPrescription(c.GetAdminUserInfo().CurrentOrgId, new_prescription.PatientId, new_prescription.RecordDate, new_prescription.PType)
5249
 	new_prescriptions, _ := service.GetHisPrescription(c.GetAdminUserInfo().CurrentOrgId, new_prescription.PatientId, new_prescription.RecordDate, new_prescription.PType)
5250
 
5250
 
5251
-	for _, item := range new_prescriptions {
5252
-		if item.IsMedicine == 1 {
5253
-			isMedicine = true
5254
-		}
5251
+	//for _, item := range new_prescriptions {
5252
+	if new_prescription.IsMedicine == 1 {
5253
+		isMedicine = true
5255
 	}
5254
 	}
5255
+	//}
5256
 
5256
 
5257
 	for _, item := range new_prescriptions {
5257
 	for _, item := range new_prescriptions {
5258
 		if item.OrderStatus == 4 {
5258
 		if item.OrderStatus == 4 {
5802
 
5802
 
5803
 	//获取今天该患者所有处方,判断是否发药或者收费
5803
 	//获取今天该患者所有处方,判断是否发药或者收费
5804
 	new_prescriptions, _ := service.GetHisPrescription(c.GetAdminUserInfo().CurrentOrgId, new_prescription.PatientId, new_prescription.RecordDate, new_prescription.PType)
5804
 	new_prescriptions, _ := service.GetHisPrescription(c.GetAdminUserInfo().CurrentOrgId, new_prescription.PatientId, new_prescription.RecordDate, new_prescription.PType)
5805
-	for _, item := range new_prescriptions {
5806
-		if item.IsMedicine == 1 {
5807
-			isMedicine = true
5808
-		}
5805
+	//for _, item := range new_prescriptions {
5806
+	if new_prescription.IsMedicine == 1 {
5807
+		isMedicine = true
5809
 	}
5808
 	}
5809
+	//}
5810
 	for _, item := range new_prescriptions {
5810
 	for _, item := range new_prescriptions {
5811
 		if item.OrderStatus == 4 {
5811
 		if item.OrderStatus == 4 {
5812
 			isCharge = true
5812
 			isCharge = true
7629
 					}
7629
 					}
7630
 					//advice.Groupno = hisAdvice.Groupno
7630
 					//advice.Groupno = hisAdvice.Groupno
7631
 				} else {
7631
 				} else {
7632
+					advice.IsMedicine = 0
7632
 					ctime := time.Now().Unix()
7633
 					ctime := time.Now().Unix()
7633
 					advice.CreatedTime = ctime
7634
 					advice.CreatedTime = ctime
7634
 					advice.UpdatedTime = ctime
7635
 					advice.UpdatedTime = ctime
7636
 				}
7637
 				}
7637
 			}
7638
 			}
7638
 		} else {
7639
 		} else {
7640
+			advice.IsMedicine = 0
7639
 			ctime := time.Now().Unix()
7641
 			ctime := time.Now().Unix()
7640
 			advice.CreatedTime = ctime
7642
 			advice.CreatedTime = ctime
7641
 			advice.UpdatedTime = ctime
7643
 			advice.UpdatedTime = ctime

+ 4 - 1
controllers/new_stock_api_controller.go Vedi File

73
 	start_time := c.GetString("start_time")
73
 	start_time := c.GetString("start_time")
74
 	end_time := c.GetString("end_time")
74
 	end_time := c.GetString("end_time")
75
 
75
 
76
+	is_sale, _ := c.GetInt64("is_sale")
77
+	is_bg, _ := c.GetInt64("is_bg")
78
+
76
 	timeLayout := "2006-01-02"
79
 	timeLayout := "2006-01-02"
77
 	loc, _ := time.LoadLocation("Local")
80
 	loc, _ := time.LoadLocation("Local")
78
 	var startTime int64
81
 	var startTime int64
98
 	orgId := c.GetAdminUserInfo().CurrentOrgId
101
 	orgId := c.GetAdminUserInfo().CurrentOrgId
99
 	page, _ := c.GetInt64("page")
102
 	page, _ := c.GetInt64("page")
100
 	limit, _ := c.GetInt64("limit")
103
 	limit, _ := c.GetInt64("limit")
101
-	list, total, _ := service.GetNewDrugFlow(orgId, limit, page, startTime, endTime)
104
+	list, total, _ := service.GetNewDrugFlow(orgId, limit, page, startTime, endTime, is_sale, is_bg)
102
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
105
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
103
 	dealerList, _ := service.GetAllDealerList(orgId)
106
 	dealerList, _ := service.GetAllDealerList(orgId)
104
 	houseList, _ := service.GetAllStoreHouseList(orgId)
107
 	houseList, _ := service.GetAllStoreHouseList(orgId)

+ 1 - 0
models/his_charge_models.go Vedi File

371
 	PType             string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
371
 	PType             string  `gorm:"column:p_type" json:"p_type" form:"p_type"`
372
 	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
372
 	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
373
 	ItemId            int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
373
 	ItemId            int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
374
+	Pdate             string  `gorm:"column:pdate" json:"pdate" form:"pdate"`
374
 }
375
 }
375
 
376
 
376
 type NewHisChargeOrder struct {
377
 type NewHisChargeOrder struct {

+ 9 - 4
models/new_drug_stock.go Vedi File

60
 	Remark                    string                 `gorm:"column:remark" json:"remark" form:"remark"`
60
 	Remark                    string                 `gorm:"column:remark" json:"remark" form:"remark"`
61
 	OperateTime               int64                  `gorm:"column:operate_time" json:"operate_time" form:"operate_time"`
61
 	OperateTime               int64                  `gorm:"column:operate_time" json:"operate_time" form:"operate_time"`
62
 	SaleDate                  string                 `gorm:"column:sale_date" json:"sale_date" form:"sale_date"`
62
 	SaleDate                  string                 `gorm:"column:sale_date" json:"sale_date" form:"sale_date"`
63
-	PCount                    float64
64
-	SDate                     string
65
-	PDate                     int64
66
-	Unit                      string
63
+	IsSale                    int64                  `gorm:"column:is_sale" json:"is_sale" form:"is_sale"`
64
+	IsChange                  int64                  `gorm:"column:is_change" json:"is_change" form:"is_change"`
65
+	Bchno                     string                 `gorm:"column:bchno" json:"bchno" form:"bchno"`
66
+	BgBchno                   string                 `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
67
+
68
+	PCount float64
69
+	SDate  string
70
+	PDate  int64
71
+	Unit   string
67
 }
72
 }
68
 
73
 
69
 func (NewDrugFlow) TableName() string {
74
 func (NewDrugFlow) TableName() string {

+ 1 - 0
models/new_stock.go Vedi File

33
 	PcDate                    int64       `gorm:"column:pc_date" json:"pc_date" form:"pc_date"`
33
 	PcDate                    int64       `gorm:"column:pc_date" json:"pc_date" form:"pc_date"`
34
 	IsPc                      int64       `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
34
 	IsPc                      int64       `gorm:"column:is_pc" json:"is_pc" form:"is_pc"`
35
 	IsBg                      int64       `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
35
 	IsBg                      int64       `gorm:"column:is_bg" json:"is_bg" form:"is_bg"`
36
+	BgBchno                   string      `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
36
 }
37
 }
37
 
38
 
38
 func (DrugWarehouseInfoTenOne) TableName() string {
39
 func (DrugWarehouseInfoTenOne) TableName() string {

+ 8 - 1
service/new_stock_medical_insurance_service.go Vedi File

30
 	return list, err
30
 	return list, err
31
 }
31
 }
32
 
32
 
33
-func GetNewDrugFlow(orgid int64, limit int64, page int64, startTime int64, endTime int64) (drug_flow []*models.NewDrugFlow, total int64, err error) {
33
+func GetNewDrugFlow(orgid int64, limit int64, page int64, startTime int64, endTime int64, is_sale int64, is_bg int64) (drug_flow []*models.NewDrugFlow, total int64, err error) {
34
 
34
 
35
 	offset := (page - 1) * limit
35
 	offset := (page - 1) * limit
36
 	db := XTReadDB().Model(drug_flow).Where("status = 1")
36
 	db := XTReadDB().Model(drug_flow).Where("status = 1")
43
 	if endTime > 0 {
43
 	if endTime > 0 {
44
 		db = db.Where("ctime<=?", endTime)
44
 		db = db.Where("ctime<=?", endTime)
45
 	}
45
 	}
46
+	if is_sale != 3 {
47
+		db = db.Where("is_sale = ?", is_sale)
48
+	}
49
+	if is_bg != 3 {
50
+		db = db.Where("is_change = ?", is_bg)
51
+	}
52
+
46
 	//if stock_type > 0 {
53
 	//if stock_type > 0 {
47
 
54
 
48
 	//手动入库
55
 	//手动入库