Browse Source

耗材参数

XMLWAN 3 years ago
parent
commit
5d577169c8

+ 6 - 4
controllers/doctors_api_controller.go View File

678
 func (this *DoctorsApiController) GetInspectionMajorItem() {
678
 func (this *DoctorsApiController) GetInspectionMajorItem() {
679
 
679
 
680
 	other_start_time := this.GetString("other_start_time")
680
 	other_start_time := this.GetString("other_start_time")
681
+	last_time := this.GetString("last_time")
681
 	timeLayout := "2006-01-02"
682
 	timeLayout := "2006-01-02"
682
 	loc, _ := time.LoadLocation("Local")
683
 	loc, _ := time.LoadLocation("Local")
683
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", other_start_time+" 23:59:59", loc)
684
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", other_start_time+" 23:59:59", loc)
684
-	fmt.Println("startTime2222345555533344334334433433344", startTime.Unix())
685
+	lastTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", last_time+" 00:00:00", loc)
685
 	patient_id, _ := this.GetInt64("patient_id")
686
 	patient_id, _ := this.GetInt64("patient_id")
686
 	adminUserInfo := this.GetAdminUserInfo()
687
 	adminUserInfo := this.GetAdminUserInfo()
687
 	orgId := adminUserInfo.CurrentOrgId
688
 	orgId := adminUserInfo.CurrentOrgId
688
-	list, err := service.GetInspectionMajorItem(startTime.Unix(), orgId, patient_id)
689
+	list, err := service.GetInspectionMajorItem(startTime.Unix(), lastTime.Unix(), orgId, patient_id)
689
 	if err == nil {
690
 	if err == nil {
690
 		this.ServeSuccessJSON(map[string]interface{}{
691
 		this.ServeSuccessJSON(map[string]interface{}{
691
 			"list": list,
692
 			"list": list,
794
 	record_time := this.GetString("record_time")
795
 	record_time := this.GetString("record_time")
795
 	timeLayout := "2006-01-02"
796
 	timeLayout := "2006-01-02"
796
 	loc, _ := time.LoadLocation("Local")
797
 	loc, _ := time.LoadLocation("Local")
797
-	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
798
+	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
798
 	after_pressure := this.GetString("after_pressure")
799
 	after_pressure := this.GetString("after_pressure")
799
 	template_summary_id, _ := this.GetInt64("template_summary_id")
800
 	template_summary_id, _ := this.GetInt64("template_summary_id")
800
 	template_plan_id, _ := this.GetInt64("template_plan_id")
801
 	template_plan_id, _ := this.GetInt64("template_plan_id")
863
 	orgId := this.GetAdminUserInfo().CurrentOrgId
864
 	orgId := this.GetAdminUserInfo().CurrentOrgId
864
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
865
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
865
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
866
 	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
867
+	fmt.Println("hhhhhhhhhhhhhh777777", endTime.Unix())
866
 	list, err := service.GetTemplateSummaryList(patient_id, orgId, startTime.Unix(), endTime.Unix())
868
 	list, err := service.GetTemplateSummaryList(patient_id, orgId, startTime.Unix(), endTime.Unix())
867
 	if err == nil {
869
 	if err == nil {
868
 		this.ServeSuccessJSON(map[string]interface{}{
870
 		this.ServeSuccessJSON(map[string]interface{}{
943
 	record_time := this.GetString("record_time")
945
 	record_time := this.GetString("record_time")
944
 	timeLayout := "2006-01-02"
946
 	timeLayout := "2006-01-02"
945
 	loc, _ := time.LoadLocation("Local")
947
 	loc, _ := time.LoadLocation("Local")
946
-	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
948
+	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
947
 	after_pressure := this.GetString("after_pressure")
949
 	after_pressure := this.GetString("after_pressure")
948
 	template_summary_id, _ := this.GetInt64("template_summary_id")
950
 	template_summary_id, _ := this.GetInt64("template_summary_id")
949
 	template_plan_id, _ := this.GetInt64("template_plan_id")
951
 	template_plan_id, _ := this.GetInt64("template_plan_id")

+ 10 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

2817
 }
2817
 }
2818
 
2818
 
2819
 func (this *NewDialysisApiController) GetTreateSummary() {
2819
 func (this *NewDialysisApiController) GetTreateSummary() {
2820
+	timeLayout := "2006-01-02"
2821
+	loc, _ := time.LoadLocation("Local")
2820
 
2822
 
2821
 	startTime := this.GetString("start_time")
2823
 	startTime := this.GetString("start_time")
2822
-	startTimeUnix, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", startTime)
2824
+	fmt.Println("开始烧豆腐阿方阿方阿方", startTime)
2825
+
2823
 	endTime := this.GetString("end_time")
2826
 	endTime := this.GetString("end_time")
2824
-	endTimeUnix, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endTime)
2827
+	startTimeUnix, _ := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
2828
+	endTimeUnix, _ := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
2829
+
2825
 	limit, _ := this.GetInt64("limit")
2830
 	limit, _ := this.GetInt64("limit")
2826
 	page, _ := this.GetInt64("page")
2831
 	page, _ := this.GetInt64("page")
2827
 	creater, _ := this.GetInt64("creater")
2832
 	creater, _ := this.GetInt64("creater")
2833
+
2828
 	patient_id, _ := this.GetInt64("patient_id")
2834
 	patient_id, _ := this.GetInt64("patient_id")
2835
+
2836
+	fmt.Println("hhhhhhhhhhhhhhhkaishi", startTimeUnix.Unix())
2829
 	list, total, err := service.GetTreateSummary(startTimeUnix.Unix(), endTimeUnix.Unix(), limit, page, creater, patient_id)
2837
 	list, total, err := service.GetTreateSummary(startTimeUnix.Unix(), endTimeUnix.Unix(), limit, page, creater, patient_id)
2830
 
2838
 
2831
 	//var inspectionTemplate []*models.VmInspection
2839
 	//var inspectionTemplate []*models.VmInspection

+ 3 - 1
controllers/print_data_api_controller.go View File

208
 	//出库详情
208
 	//出库详情
209
 	if types == 2 {
209
 	if types == 2 {
210
 		list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
210
 		list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
211
+		stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
211
 		if err != nil {
212
 		if err != nil {
212
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
213
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
213
 			return
214
 			return
214
 		}
215
 		}
215
 		this.ServeSuccessJSON(map[string]interface{}{
216
 		this.ServeSuccessJSON(map[string]interface{}{
216
-			"list": list,
217
+			"list":       list,
218
+			"stockTotal": stockTotal,
217
 		})
219
 		})
218
 	}
220
 	}
219
 
221
 

+ 34 - 3
controllers/stock_in_api_controller.go View File

107
 	beego.Router("/api/stock/getadjustpriceinfo", &StockManagerApiController{}, "Get:GetAdjustPriceById")
107
 	beego.Router("/api/stock/getadjustpriceinfo", &StockManagerApiController{}, "Get:GetAdjustPriceById")
108
 	beego.Router("/api/stock/savereportstock", &StockManagerApiController{}, "Post:SaveReportStock")
108
 	beego.Router("/api/stock/savereportstock", &StockManagerApiController{}, "Post:SaveReportStock")
109
 	beego.Router("/api/stock/getreportstocklist", &StockManagerApiController{}, "Get:GetReportStockList")
109
 	beego.Router("/api/stock/getreportstocklist", &StockManagerApiController{}, "Get:GetReportStockList")
110
+	beego.Router("/api/stock/savecheckdamage", &StockManagerApiController{}, "Get:SaveCheckDamage")
110
 }
111
 }
111
 
112
 
112
 func (c *StockManagerApiController) CreateWarehouse() {
113
 func (c *StockManagerApiController) CreateWarehouse() {
5129
 }
5130
 }
5130
 
5131
 
5131
 func (this *StockManagerApiController) GetReportStockList() {
5132
 func (this *StockManagerApiController) GetReportStockList() {
5132
-	fmt.Println("2323323322332323232233232322323232323")
5133
+
5133
 	timeLayout := "2006-01-02"
5134
 	timeLayout := "2006-01-02"
5134
 	loc, _ := time.LoadLocation("Local")
5135
 	loc, _ := time.LoadLocation("Local")
5135
 	start_time := this.GetString("start_time")
5136
 	start_time := this.GetString("start_time")
5155
 			return
5156
 			return
5156
 		}
5157
 		}
5157
 		endTime = theTime.Unix()
5158
 		endTime = theTime.Unix()
5158
-		fmt.Println("endtime2322332233223", endTime)
5159
+
5159
 	}
5160
 	}
5160
 
5161
 
5161
 	orgId := this.GetAdminUserInfo().CurrentOrgId
5162
 	orgId := this.GetAdminUserInfo().CurrentOrgId
5163
 	fmt.Println("startTime", startTime, "endTime", endTime)
5164
 	fmt.Println("startTime", startTime, "endTime", endTime)
5164
 	list, total, _ := service.GetReportStockList(startTime, endTime, orgId, keyword, page, limit)
5165
 	list, total, _ := service.GetReportStockList(startTime, endTime, orgId, keyword, page, limit)
5165
 	doctorlist, _ := service.GetAllDoctorThree(orgId)
5166
 	doctorlist, _ := service.GetAllDoctorThree(orgId)
5166
-	fmt.Println("list232232322332232323", list)
5167
+
5167
 	this.ServeSuccessJSON(map[string]interface{}{
5168
 	this.ServeSuccessJSON(map[string]interface{}{
5168
 		"list":       list,
5169
 		"list":       list,
5169
 		"total":      total,
5170
 		"total":      total,
5170
 		"doctorlist": doctorlist,
5171
 		"doctorlist": doctorlist,
5171
 	})
5172
 	})
5172
 }
5173
 }
5174
+
5175
+func (this *StockManagerApiController) SaveCheckDamage() {
5176
+	fmt.Println("hhhhhhhhhhhhhhhhhhhh")
5177
+	timeLayout := "2006-01-02"
5178
+	loc, _ := time.LoadLocation("Local")
5179
+	idstr := this.GetString("ids")
5180
+	ids := strings.Split(idstr, ",")
5181
+	check_time := this.GetString("check_time")
5182
+	var checkTime int64
5183
+	if len(check_time) > 0 {
5184
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", check_time+" 00:00:00", loc)
5185
+		if err != nil {
5186
+			fmt.Println(err)
5187
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5188
+			return
5189
+		}
5190
+		checkTime = theTime.Unix()
5191
+	}
5192
+	checker, _ := this.GetInt64("checker")
5193
+	reportprice := models.XtStockReportPrice{
5194
+		Checker:       checker,
5195
+		CheckerStatus: 1,
5196
+		CheckerTime:   checkTime,
5197
+	}
5198
+	err := service.UpdateCheckDamage(ids, reportprice)
5199
+	fmt.Println(err)
5200
+	this.ServeSuccessJSON(map[string]interface{}{
5201
+		"reportPrice": reportprice,
5202
+	})
5203
+}

+ 8 - 5
service/patientmanage_service.go View File

1622
 	return list, total, err
1622
 	return list, total, err
1623
 }
1623
 }
1624
 
1624
 
1625
-func GetInspectionMajorItem(startime int64, orgid int64, patientid int64) (inspection []*models.XtInspection, err error) {
1625
+func GetInspectionMajorItem(startime int64, lasttime int64, orgid int64, patientid int64) (inspection []*models.XtInspection, err error) {
1626
 
1626
 
1627
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
1627
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
1628
 	if startime > 0 {
1628
 	if startime > 0 {
1629
 		db = db.Where("x.inspect_date<=?", startime)
1629
 		db = db.Where("x.inspect_date<=?", startime)
1630
 	}
1630
 	}
1631
+	if lasttime > 0 {
1632
+		db = db.Where("x.inspect_date>=?", lasttime)
1633
+	}
1631
 	if orgid > 0 {
1634
 	if orgid > 0 {
1632
 		db = db.Where("x.org_id = ?", orgid)
1635
 		db = db.Where("x.org_id = ?", orgid)
1633
 	}
1636
 	}
1750
 func GetTemplateSummaryList(patientid int64, orgid int64, startime int64, endtime int64) (summary []*models.XtTemplateSummary, err error) {
1753
 func GetTemplateSummaryList(patientid int64, orgid int64, startime int64, endtime int64) (summary []*models.XtTemplateSummary, err error) {
1751
 	db := XTReadDB().Model(&summary).Where("status = 1")
1754
 	db := XTReadDB().Model(&summary).Where("status = 1")
1752
 	if startime > 0 {
1755
 	if startime > 0 {
1753
-		db = db.Where("ctime >=?", startime)
1756
+		db = db.Where("record_time >=?", startime)
1754
 	}
1757
 	}
1755
 	if endtime > 0 {
1758
 	if endtime > 0 {
1756
-		db = db.Where("ctime<=?", endtime)
1759
+		db = db.Where("record_time<=?", endtime)
1757
 	}
1760
 	}
1758
 	if patientid > 0 {
1761
 	if patientid > 0 {
1759
 		db = db.Where("patient_id = ?", patientid)
1762
 		db = db.Where("patient_id = ?", patientid)
1761
 	if orgid > 0 {
1764
 	if orgid > 0 {
1762
 		db = db.Where("user_org_id = ?", orgid)
1765
 		db = db.Where("user_org_id = ?", orgid)
1763
 	}
1766
 	}
1764
-	err = db.Order("ctime desc").Find(&summary).Error
1767
+	err = db.Order("record_time desc").Find(&summary).Error
1765
 	return summary, err
1768
 	return summary, err
1766
 }
1769
 }
1767
 
1770
 
1794
 	if patient_id > 0 {
1797
 	if patient_id > 0 {
1795
 		db = db.Where("patient_id = ?", patient_id)
1798
 		db = db.Where("patient_id = ?", patient_id)
1796
 	}
1799
 	}
1797
-	err = db.Count(&total).Offset(offset).Limit(limit).Find(&list).Error
1800
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("record_time desc").Find(&list).Error
1798
 	return list, total, err
1801
 	return list, total, err
1799
 }
1802
 }
1800
 
1803
 

+ 6 - 0
service/user_service.go View File

177
 	err = UserReadDB().Where("org_id = ?  AND status = 1 AND  (user_type = ? OR user_type = ?) ", orgid, 2, 1).Find(&appRole).Error
177
 	err = UserReadDB().Where("org_id = ?  AND status = 1 AND  (user_type = ? OR user_type = ?) ", orgid, 2, 1).Find(&appRole).Error
178
 	return appRole, err
178
 	return appRole, err
179
 }
179
 }
180
+
181
+func UpdateCheckDamage(ids []string, reportPrice models.XtStockReportPrice) error {
182
+
183
+	err := XTWriteDB().Model(&reportPrice).Where("id in(?) and status = 1", ids).Updates(map[string]interface{}{"checker": reportPrice.Checker, "checker_time": reportPrice.CheckerTime}).Error
184
+	return err
185
+}