XMLWAN il y a 3 ans
Parent
révision
a624b91173

+ 14 - 1
controllers/doctors_api_controller.go Voir le fichier

@@ -51,6 +51,7 @@ func DoctorApiRegistRouters() {
51 51
 	beego.Router("/api/patient/gettemplatesummarydetail", &DoctorsApiController{}, "Get:GetTemplateSummaryDetail")
52 52
 	beego.Router("/api/patient/gettemplatesummaryprintdetail", &DoctorsApiController{}, "Get:GetTemplateSummaryPrintDetail")
53 53
 	beego.Router("/api/patient/updatetemplatesummary", &DoctorsApiController{}, "Get:UpdateTempalteSummary")
54
+	beego.Router("/api/patient/deletesummary", &DoctorsApiController{}, "Get:DeleteSummary")
54 55
 }
55 56
 
56 57
 func (c *DoctorsApiController) ScheduleAdvices() {
@@ -731,7 +732,7 @@ func (this *DoctorsApiController) GetInitDateList() {
731 732
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
732 733
 	end_time := this.GetString("end_time")
733 734
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
734
-
735
+	fmt.Println("endtime2323232233223232332", endTime)
735 736
 	prescription_list, _ := service.GetDialysisPrescriptionDataList(patient_id, startTime.Unix(), endTime.Unix())
736 737
 	befor_list, err := service.GetDialysisBeforInitDateList(patient_id, startTime.Unix(), endTime.Unix())
737 738
 	after_list, err := service.GetDialysisAssementAfter(patient_id, startTime.Unix(), endTime.Unix())
@@ -1000,3 +1001,15 @@ func (this *DoctorsApiController) UpdateTempalteSummary() {
1000 1001
 		return
1001 1002
 	}
1002 1003
 }
1004
+
1005
+func (this *DoctorsApiController) DeleteSummary() {
1006
+
1007
+	ids := this.GetString("ids")
1008
+	idsplit := strings.Split(ids, ",")
1009
+	err := service.DeleteSummary(idsplit)
1010
+	fmt.Println(err)
1011
+	returnData := make(map[string]interface{}, 0)
1012
+	returnData["msg"] = "ok"
1013
+	this.ServeSuccessJSON(returnData)
1014
+	return
1015
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Voir le fichier

@@ -2827,6 +2827,7 @@ func (this *NewDialysisApiController) GetTreateSummary() {
2827 2827
 	creater, _ := this.GetInt64("creater")
2828 2828
 	patient_id, _ := this.GetInt64("patient_id")
2829 2829
 	list, total, err := service.GetTreateSummary(startTimeUnix.Unix(), endTimeUnix.Unix(), limit, page, creater, patient_id)
2830
+
2830 2831
 	//var inspectionTemplate []*models.VmInspection
2831 2832
 	for _, item := range list {
2832 2833
 		ids := strings.Split(item.ProjectId, ",")

+ 254 - 0
controllers/stock_in_api_controller.go Voir le fichier

@@ -103,6 +103,10 @@ func StockManagerApiRegistRouters() {
103 103
 	beego.Router("/api/stock/postsearchgoodwarehouselist", &StockManagerApiController{}, "Get:GetSearchGoodWarehouseList")
104 104
 	beego.Router("/api/stock/saveadjustprice", &StockManagerApiController{}, "Post:SaveAdjuestPrice")
105 105
 	beego.Router("/api/stock/getallstockprice", &StockManagerApiController{}, "Get:GetAllStockPrice")
106
+	beego.Router("/api/stock/savecheckedprice", &StockManagerApiController{}, "Get:SaveCheckPrice")
107
+	beego.Router("/api/stock/getadjustpriceinfo", &StockManagerApiController{}, "Get:GetAdjustPriceById")
108
+	beego.Router("/api/stock/savereportstock", &StockManagerApiController{}, "Post:SaveReportStock")
109
+	beego.Router("/api/stock/getreportstocklist", &StockManagerApiController{}, "Get:GetReportStockList")
106 110
 }
107 111
 
108 112
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -4916,3 +4920,253 @@ func (this *StockManagerApiController) GetAllStockPrice() {
4916 4920
 		"doctor": doctor,
4917 4921
 	})
4918 4922
 }
4923
+
4924
+func (this *StockManagerApiController) SaveCheckPrice() {
4925
+	timeLayout := "2006-01-02"
4926
+	loc, _ := time.LoadLocation("Local")
4927
+	dataBody := make(map[string]interface{}, 0)
4928
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4929
+	fmt.Println(err)
4930
+	idstr := this.GetString("ids")
4931
+	ids := strings.Split(idstr, ",")
4932
+	check_time := this.GetString("check_time")
4933
+	var checkTime int64
4934
+	if len(check_time) > 0 {
4935
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", check_time+" 00:00:00", loc)
4936
+		if err != nil {
4937
+			fmt.Println(err)
4938
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4939
+			return
4940
+		}
4941
+		checkTime = theTime.Unix()
4942
+	}
4943
+	checker, _ := this.GetInt64("checker")
4944
+	adjustPrice := models.XtStockAdjustPrice{
4945
+		Checker:       checker,
4946
+		CheckerStatus: 1,
4947
+		CheckerTime:   checkTime,
4948
+	}
4949
+	err = service.UpdateAdjustPrice(ids, adjustPrice)
4950
+	fmt.Println(err)
4951
+	this.ServeSuccessJSON(map[string]interface{}{
4952
+		"adjustPrice": adjustPrice,
4953
+	})
4954
+}
4955
+
4956
+func (this *StockManagerApiController) GetAdjustPriceById() {
4957
+
4958
+	ids := this.GetString("ids")
4959
+	fmt.Println("ids23232233223233232", ids)
4960
+	splitIds := strings.Split(ids, ",")
4961
+	list, _ := service.GetAdjustPricebyIdOne(splitIds)
4962
+	fmt.Println("list2322322323", list)
4963
+	this.ServeSuccessJSON(map[string]interface{}{
4964
+		"list": list,
4965
+	})
4966
+}
4967
+
4968
+func (this *StockManagerApiController) SaveReportStock() {
4969
+	timeLayout := "2006-01-02"
4970
+	loc, _ := time.LoadLocation("Local")
4971
+	dataBody := make(map[string]interface{}, 0)
4972
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
4973
+	if err != nil {
4974
+		utils.ErrorLog(err.Error())
4975
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4976
+		return
4977
+	}
4978
+	tableData, _ := dataBody["tableData"].([]interface{})
4979
+	if len(tableData) > 0 {
4980
+		for _, item := range tableData {
4981
+			items := item.(map[string]interface{})
4982
+
4983
+			if items["good_name"] == nil || reflect.TypeOf(items["good_name"]).String() != "string" {
4984
+				utils.ErrorLog("good_name")
4985
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4986
+				return
4987
+			}
4988
+			good_name := items["good_name"].(string)
4989
+
4990
+			if items["good_name"] == nil || reflect.TypeOf(items["good_name"]).String() != "string" {
4991
+				utils.ErrorLog("good_name")
4992
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4993
+				return
4994
+			}
4995
+
4996
+			if items["packing_price"] == nil || reflect.TypeOf(items["packing_price"]).String() != "string" {
4997
+				utils.ErrorLog("packing_price")
4998
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4999
+				return
5000
+			}
5001
+			packing_price, _ := strconv.ParseFloat(items["packing_price"].(string), 64)
5002
+
5003
+			if items["warehousing_order"] == nil || reflect.TypeOf(items["warehousing_order"]).String() != "string" {
5004
+				utils.ErrorLog("warehousing_order")
5005
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5006
+				return
5007
+			}
5008
+			warehousing_order := items["warehousing_order"].(string)
5009
+
5010
+			if items["license_number"] == nil || reflect.TypeOf(items["license_number"]).String() != "string" {
5011
+				utils.ErrorLog("license_number")
5012
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5013
+				return
5014
+			}
5015
+			license_number := items["license_number"].(string)
5016
+
5017
+			if items["dealer"] == nil || reflect.TypeOf(items["dealer"]).String() != "string" {
5018
+				utils.ErrorLog("dealer")
5019
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5020
+				return
5021
+			}
5022
+			dealer := items["dealer"].(string)
5023
+
5024
+			if items["manufacturer"] == nil || reflect.TypeOf(items["manufacturer"]).String() != "string" {
5025
+				utils.ErrorLog("manufacturer")
5026
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5027
+				return
5028
+			}
5029
+			manufacturer := items["manufacturer"].(string)
5030
+
5031
+			if items["specification_name"] == nil || reflect.TypeOf(items["specification_name"]).String() != "string" {
5032
+				utils.ErrorLog("specification_name")
5033
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5034
+				return
5035
+			}
5036
+			specification_name := items["specification_name"].(string)
5037
+
5038
+			if items["remark"] == nil || reflect.TypeOf(items["remark"]).String() != "string" {
5039
+				utils.ErrorLog("remark")
5040
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5041
+				return
5042
+			}
5043
+			remark := items["remark"].(string)
5044
+
5045
+			if items["warehousing_unit"] == nil || reflect.TypeOf(items["warehousing_unit"]).String() != "string" {
5046
+				utils.ErrorLog("warehousing_unit")
5047
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5048
+				return
5049
+			}
5050
+			warehousing_unit := items["warehousing_unit"].(string)
5051
+
5052
+			if items["buy_price"] == nil || reflect.TypeOf(items["buy_price"]).String() != "string" {
5053
+				utils.ErrorLog("buy_price")
5054
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5055
+				return
5056
+			}
5057
+			buy_price, _ := strconv.ParseFloat(items["buy_price"].(string), 64)
5058
+
5059
+			if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
5060
+				utils.ErrorLog("count")
5061
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5062
+				return
5063
+			}
5064
+			count := int64(items["count"].(float64))
5065
+
5066
+			if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
5067
+				utils.ErrorLog("new_price")
5068
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5069
+				return
5070
+			}
5071
+			new_price, _ := strconv.ParseFloat(items["new_price"].(string), 64)
5072
+
5073
+			if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
5074
+				utils.ErrorLog("good_id")
5075
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5076
+				return
5077
+			}
5078
+			good_id := int64(items["good_id"].(float64))
5079
+
5080
+			if items["start_time"] == nil || reflect.TypeOf(items["start_time"]).String() != "string" {
5081
+				utils.ErrorLog("start_time")
5082
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5083
+				return
5084
+			}
5085
+			var startTime int64
5086
+			start_time := items["start_time"].(string)
5087
+			if len(start_time) > 0 {
5088
+				theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5089
+				if err != nil {
5090
+					fmt.Println(err)
5091
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5092
+					return
5093
+				}
5094
+				startTime = theTime.Unix()
5095
+			}
5096
+			orgId := this.GetAdminUserInfo().CurrentOrgId
5097
+			Creater := this.GetAdminUserInfo().AdminUser.Id
5098
+			reportPrice := models.XtStockReportPrice{
5099
+				GoodName:          good_name,
5100
+				SpecificationName: specification_name,
5101
+				WarehousingUnit:   warehousing_unit,
5102
+				Count:             count,
5103
+				BuyPrice:          buy_price,
5104
+				PackingPrice:      packing_price,
5105
+				NewPrice:          new_price,
5106
+				Manufacturer:      manufacturer,
5107
+				Dealer:            dealer,
5108
+				Remark:            remark,
5109
+				GoodId:            good_id,
5110
+				UserOrgId:         orgId,
5111
+				Ctime:             time.Now().Unix(),
5112
+				Mtime:             0,
5113
+				Status:            1,
5114
+				WarehousingOrder:  warehousing_order,
5115
+				LicenseNumber:     license_number,
5116
+				StartTime:         startTime,
5117
+				Creater:           Creater,
5118
+				Checker:           0,
5119
+				CheckerStatus:     2,
5120
+				CheckerTime:       0,
5121
+			}
5122
+			err := service.CreateReportPrice(&reportPrice)
5123
+			fmt.Println(err)
5124
+		}
5125
+	}
5126
+	this.ServeSuccessJSON(map[string]interface{}{
5127
+		"msg": "保存成功!",
5128
+	})
5129
+}
5130
+
5131
+func (this *StockManagerApiController) GetReportStockList() {
5132
+	fmt.Println("2323323322332323232233232322323232323")
5133
+	timeLayout := "2006-01-02"
5134
+	loc, _ := time.LoadLocation("Local")
5135
+	start_time := this.GetString("start_time")
5136
+	end_time := this.GetString("end_time")
5137
+	page, _ := this.GetInt64("page")
5138
+	limit, _ := this.GetInt64("limit")
5139
+	var startTime int64
5140
+	if len(start_time) > 0 {
5141
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5142
+		if err != nil {
5143
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5144
+			return
5145
+		}
5146
+		startTime = theTime.Unix()
5147
+		fmt.Println("开始时间", startTime)
5148
+	}
5149
+	var endTime int64
5150
+	if len(end_time) > 0 {
5151
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
5152
+		if err != nil {
5153
+			utils.ErrorLog(err.Error())
5154
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5155
+			return
5156
+		}
5157
+		endTime = theTime.Unix()
5158
+		fmt.Println("endtime2322332233223", endTime)
5159
+	}
5160
+
5161
+	orgId := this.GetAdminUserInfo().CurrentOrgId
5162
+	keyword := this.GetString("keyword")
5163
+	fmt.Println("startTime", startTime, "endTime", endTime)
5164
+	list, total, _ := service.GetReportStockList(startTime, endTime, orgId, keyword, page, limit)
5165
+	doctorlist, _ := service.GetAllDoctorThree(orgId)
5166
+	fmt.Println("list232232322332232323", list)
5167
+	this.ServeSuccessJSON(map[string]interface{}{
5168
+		"list":       list,
5169
+		"total":      total,
5170
+		"doctorlist": doctorlist,
5171
+	})
5172
+}

+ 55 - 27
models/stock_models.go Voir le fichier

@@ -1,7 +1,5 @@
1 1
 package models
2 2
 
3
-import "XT/models"
4
-
5 3
 type Manufacturer struct {
6 4
 	ID               int64  `gorm:"column:id" json:"id"`
7 5
 	ManufacturerName string `gorm:"column:manufacturer_name" json:"manufacturer_name"`
@@ -804,31 +802,31 @@ type BloodWarehouseInfo struct {
804 802
 }
805 803
 
806 804
 type XtStockAdjustPrice struct {
807
-	ID                int64                  `gorm:"column:id" json:"id" form:"id"`
808
-	GoodName          string                 `gorm:"column:good_name" json:"good_name" form:"good_name"`
809
-	SpecificationName string                 `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
810
-	WarehousingUnit   string                 `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
811
-	Count             int64                  `gorm:"column:count" json:"count" form:"count"`
812
-	BuyPrice          float64                `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
813
-	PackingPrice      float64                `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
814
-	NewPrice          float64                `gorm:"column:new_price" json:"new_price" form:"new_price"`
815
-	Manufacturer      string                 `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
816
-	Dealer            string                 `gorm:"column:dealer" json:"dealer" form:"dealer"`
817
-	Remark            string                 `gorm:"column:remark" json:"remark" form:"remark"`
818
-	GoodId            int64                  `gorm:"column:good_id" json:"good_id" form:"good_id"`
819
-	UserOrgId         int64                  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
820
-	Ctime             int64                  `gorm:"column:ctime" json:"ctime" form:"ctime"`
821
-	Mtime             int64                  `gorm:"column:mtime" json:"mtime" form:"mtime"`
822
-	Status            int64                  `gorm:"column:status" json:"status" form:"status"`
823
-	WarehousingOrder  string                 `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
824
-	LicenseNumber     string                 `gorm:"column:license_number" json:"license_number" form:"license_number"`
825
-	StartTime         int64                  `gorm:"column:start_time" json:"start_time" form:"start_time"`
826
-	Creater           int64                  `gorm:"column:creater" json:"creater" form:"creater"`
827
-	Checker           int64                  `gorm:"column:checker" json:"checker" form:"checker"`
828
-	CheckerStatus     int64                  `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
829
-	CheckerTime       int64                  `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
830
-	GoodInfo          models.GoodInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
831
-	AdminRole         models.VMUserAdminRole `gorm:"ForeignKey:ID;AssociationForeignKey:Creater" `
805
+	ID                int64           `gorm:"column:id" json:"id" form:"id"`
806
+	GoodName          string          `gorm:"column:good_name" json:"good_name" form:"good_name"`
807
+	SpecificationName string          `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
808
+	WarehousingUnit   string          `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
809
+	Count             int64           `gorm:"column:count" json:"count" form:"count"`
810
+	BuyPrice          float64         `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
811
+	PackingPrice      float64         `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
812
+	NewPrice          float64         `gorm:"column:new_price" json:"new_price" form:"new_price"`
813
+	Manufacturer      string          `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
814
+	Dealer            string          `gorm:"column:dealer" json:"dealer" form:"dealer"`
815
+	Remark            string          `gorm:"column:remark" json:"remark" form:"remark"`
816
+	GoodId            int64           `gorm:"column:good_id" json:"good_id" form:"good_id"`
817
+	UserOrgId         int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
818
+	Ctime             int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
819
+	Mtime             int64           `gorm:"column:mtime" json:"mtime" form:"mtime"`
820
+	Status            int64           `gorm:"column:status" json:"status" form:"status"`
821
+	WarehousingOrder  string          `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
822
+	LicenseNumber     string          `gorm:"column:license_number" json:"license_number" form:"license_number"`
823
+	StartTime         int64           `gorm:"column:start_time" json:"start_time" form:"start_time"`
824
+	Creater           int64           `gorm:"column:creater" json:"creater" form:"creater"`
825
+	Checker           int64           `gorm:"column:checker" json:"checker" form:"checker"`
826
+	CheckerStatus     int64           `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
827
+	CheckerTime       int64           `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
828
+	GoodInfo          GoodInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:GoodId" `
829
+	AdminRole         VMUserAdminRole `gorm:"ForeignKey:ID;AssociationForeignKey:Creater" `
832 830
 }
833 831
 
834 832
 func (XtStockAdjustPrice) TableName() string {
@@ -918,3 +916,33 @@ type VmStockAdjustPrice struct {
918 916
 	PackingUnit       string  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
919 917
 	UserName          string  `gorm:"column:user_name" json:"user_name" form:"user_name"`
920 918
 }
919
+
920
+type XtStockReportPrice struct {
921
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
922
+	GoodName          string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
923
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
924
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
925
+	Count             int64   `gorm:"column:count" json:"count" form:"count"`
926
+	BuyPrice          float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
927
+	PackingPrice      float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
928
+	NewPrice          float64 `gorm:"column:new_price" json:"new_price" form:"new_price"`
929
+	Manufacturer      string  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
930
+	Dealer            string  `gorm:"column:dealer" json:"dealer" form:"dealer"`
931
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
932
+	GoodId            int64   `gorm:"column:good_id" json:"good_id" form:"good_id"`
933
+	UserOrgId         int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
934
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
935
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
936
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
937
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
938
+	LicenseNumber     string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
939
+	StartTime         int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
940
+	Creater           int64   `gorm:"column:creater" json:"creater" form:"creater"`
941
+	Checker           int64   `gorm:"column:checker" json:"checker" form:"checker"`
942
+	CheckerStatus     int64   `gorm:"column:checker_status" json:"checker_status" form:"checker_status"`
943
+	CheckerTime       int64   `gorm:"column:checker_time" json:"checker_time" form:"checker_time"`
944
+}
945
+
946
+func (XtStockReportPrice) TableName() string {
947
+	return "xt_stock_report_price"
948
+}

+ 9 - 2
service/patientmanage_service.go Voir le fichier

@@ -1726,12 +1726,12 @@ func GetDialysisDialysisMode(patient_id int64, startime int64, endtime int64, or
1726 1726
 		db = db.Where("o.dialysis_date<=?", endtime)
1727 1727
 	}
1728 1728
 	if orgid > 0 {
1729
-		db = db.Where("o.user_org_id = ?", orgid)
1729
+		db = db.Where("o.user_org_id = ? and o.stage = 2", orgid)
1730 1730
 	}
1731 1731
 	if patient_id > 0 {
1732 1732
 		db = db.Where("o.patient_id = ?", patient_id)
1733 1733
 	}
1734
-	err = db.Where("o.dialysis_date >=1627747200 and o.dialysis_date<=1630339200").Select("s.mode_id,count(s.mode_id) as count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id and s.schedule_date = o.dialysis_date and s.status= 1").Joins("left join xt_patients as  p on o.patient_id = p.id").Group("s.mode_id").Scan(&counts).Error
1734
+	err = db.Select("s.mode_id,count(s.mode_id) as count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id and s.schedule_date = o.dialysis_date and s.status= 1").Joins("left join xt_patients as  p on o.patient_id = p.id").Group("s.mode_id").Scan(&counts).Error
1735 1735
 	return counts, err
1736 1736
 }
1737 1737
 
@@ -1797,3 +1797,10 @@ func GetTreateSummary(startime int64, endtime int64, limit int64, page int64, cr
1797 1797
 	err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
1798 1798
 	return list, total, err
1799 1799
 }
1800
+
1801
+func DeleteSummary(ids []string) error {
1802
+
1803
+	summary := models.XtTemplateSummary{}
1804
+	err := XTWriteDB().Model(&summary).Where("id in(?)", ids).Updates(map[string]interface{}{"status": 0}).Error
1805
+	return err
1806
+}

+ 41 - 0
service/stock_service.go Voir le fichier

@@ -4325,3 +4325,44 @@ func GetAllStockPrice(orgid int64, startime int64, endtime int64, keyword string
4325 4325
 	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit").Joins("left join sgj_users.sgj_user_admin_role as r on r.id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Scan(&list).Error
4326 4326
 	return list, err
4327 4327
 }
4328
+
4329
+func UpdateAdjustPrice(ids []string, info models.XtStockAdjustPrice) error {
4330
+
4331
+	err := XTWriteDB().Model(&info).Where("id in(?)", ids).Updates(map[string]interface{}{"checker": info.Checker, "checker_status": info.CheckerStatus, "checker_time": info.CheckerTime}).Error
4332
+	return err
4333
+}
4334
+
4335
+func GetAdjustPricebyIdOne(ids []string) (adjust []*models.XtStockAdjustPrice, err error) {
4336
+
4337
+	err = XTReadDB().Where("id in(?) and status = 1", ids).Find(&adjust).Error
4338
+	return adjust, err
4339
+}
4340
+
4341
+func CreateReportPrice(price *models.XtStockReportPrice) error {
4342
+
4343
+	err := XTWriteDB().Create(&price).Error
4344
+	return err
4345
+}
4346
+
4347
+func GetReportStockList(startime int64, endtime int64, orgid int64, keyword string, page int64, limit int64) (adjust []*models.VmStockAdjustPrice, total int64, err error) {
4348
+	likeKey := "%" + keyword + "%"
4349
+	offset := (page - 1) * limit
4350
+	db := XTReadDB().Table("xt_stock_report_price as x").Where("x.status = 1")
4351
+	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
4352
+	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
4353
+	fmt.Println(table, tab)
4354
+	if startime > 0 {
4355
+		db = db.Where("x.start_time>=?", startime)
4356
+	}
4357
+	if endtime > 0 {
4358
+		db = db.Where("x.end_time<=?", endtime)
4359
+	}
4360
+	if len(keyword) > 0 {
4361
+		db = db.Where("x.warehousing_order like ?", likeKey)
4362
+	}
4363
+	if orgid > 0 {
4364
+		db = db.Where("x.user_org_id = ?", orgid)
4365
+	}
4366
+	err = db.Select("x.id,x.good_name,x.specification_name,x.warehousing_unit,x.count,x.buy_price,x.packing_price,x.new_price,x.manufacturer,x.dealer,x.remark,x.good_id,x.warehousing_order,x.license_number,x.start_time,x.creater,x.checker,x.checker_status,x.checker_time,t.packing_unit,r.user_name").Joins("left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.creater").Joins("left join xt_good_information as t on t.id =x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&adjust).Error
4367
+	return adjust, total, err
4368
+}