Browse Source

历史排班

28169 1 year ago
parent
commit
ad1e4c07eb

+ 8 - 8
controllers/base_api_controller.go View File

@@ -71,9 +71,9 @@ func (this *BaseAuthAPIController) Prepare() {
71 71
 	this.BaseAPIController.Prepare()
72 72
 	if this.GetAdminUserInfo() == nil {
73 73
 		var userAdmin models.AdminUser
74
-		userAdmin.Id = 841
74
+		userAdmin.Id = 796
75 75
 		userAdmin.Mobile = "15717313968"
76
-		userAdmin.Id = 841 //4,809
76
+		userAdmin.Id = 796 //4,809
77 77
 		userAdmin.Mobile = "12222222222"
78 78
 		userAdmin.IsSuperAdmin = true
79 79
 		userAdmin.Status = 1
@@ -81,7 +81,7 @@ func (this *BaseAuthAPIController) Prepare() {
81 81
 		userAdmin.ModifyTime = 1530786071
82 82
 		var subscibe models.ServeSubscibe
83 83
 		subscibe.ID = 11
84
-		subscibe.OrgId = 10537 //机构id 10344
84
+		subscibe.OrgId = 10138 //机构id 10344
85 85
 		subscibe.PeriodStart = 1547447814
86 86
 		subscibe.PeriodEnd = 1550039814
87 87
 		subscibe.State = 1
@@ -91,7 +91,7 @@ func (this *BaseAuthAPIController) Prepare() {
91 91
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
92 92
 		subscibes[4] = &subscibe
93 93
 		var adminUserInfo service.AdminUserInfo
94
-		adminUserInfo.CurrentOrgId = 10537 //机构id小英9675或4
94
+		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
95 95
 		adminUserInfo.CurrentAppId = 3244  //4
96 96
 		adminUserInfo.AdminUser = &userAdmin
97 97
 		adminUserInfo.Subscibes = subscibes
@@ -316,9 +316,9 @@ func (this *BaseServeAPIController) Prepare() {
316 316
 	this.BaseAPIController.Prepare()
317 317
 	if this.GetAdminUserInfo() == nil {
318 318
 		var userAdmin models.AdminUser
319
-		userAdmin.Id = 841
319
+		userAdmin.Id = 796
320 320
 		userAdmin.Mobile = "15717313968"
321
-		userAdmin.Id = 841 //4,809
321
+		userAdmin.Id = 796 //4,809
322 322
 		userAdmin.Mobile = "12222222222"
323 323
 		userAdmin.IsSuperAdmin = false
324 324
 		userAdmin.Status = 1
@@ -326,7 +326,7 @@ func (this *BaseServeAPIController) Prepare() {
326 326
 		userAdmin.ModifyTime = 1530786071
327 327
 		var subscibe models.ServeSubscibe
328 328
 		subscibe.ID = 11
329
-		subscibe.OrgId = 10537 //机构id小英10344或4
329
+		subscibe.OrgId = 10138 //机构id小英10344或4
330 330
 		subscibe.PeriodStart = 1538035409
331 331
 		subscibe.PeriodEnd = 1569571409
332 332
 		subscibe.State = 1
@@ -336,7 +336,7 @@ func (this *BaseServeAPIController) Prepare() {
336 336
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
337 337
 		subscibes[4] = &subscibe
338 338
 		var adminUserInfo service.AdminUserInfo
339
-		adminUserInfo.CurrentOrgId = 10537 //机构id小英9675或4
339
+		adminUserInfo.CurrentOrgId = 10138 //机构id小英9675或4
340 340
 		adminUserInfo.CurrentAppId = 3244  //4
341 341
 		adminUserInfo.AdminUser = &userAdmin
342 342
 		adminUserInfo.Subscibes = subscibes

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

@@ -8087,6 +8087,42 @@ func (c *DialysisAPIController) GetMobilePrintStockGood() {
8087 8087
 	}
8088 8088
 }
8089 8089
 
8090
+func (c *DialysisAPIController) GetPrescriptionList() {
8091
+
8092
+	start_time := c.GetString("start_time")
8093
+	end_time := c.GetString("end_time")
8094
+	orgId := c.GetMobileAdminUserInfo().Org.Id
8095
+	timeLayout := "2006-01-02"
8096
+	loc, _ := time.LoadLocation("Local")
8097
+	var startTime int64
8098
+	if len(start_time) > 0 {
8099
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
8100
+		if err != nil {
8101
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8102
+			return
8103
+		}
8104
+		startTime = theTime.Unix()
8105
+	}
8106
+	var endTime int64
8107
+	if len(end_time) > 0 {
8108
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
8109
+		if err != nil {
8110
+			utils.ErrorLog(err.Error())
8111
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
8112
+			return
8113
+		}
8114
+		endTime = theTime.Unix()
8115
+	}
8116
+	schedulelist, _ := service.GetMobileScheduleListOne(startTime, endTime, orgId)
8117
+
8118
+	fmt.Println("schedulelist22222222", schedulelist)
8119
+	c.ServeSuccessJSON(map[string]interface{}{
8120
+		"list": schedulelist,
8121
+	})
8122
+	return
8123
+
8124
+}
8125
+
8090 8126
 func (c *DialysisAPIController) BatchDeleteMonitor() {
8091 8127
 
8092 8128
 	ids := c.GetString("ids")

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go View File

@@ -145,6 +145,8 @@ func MobileAPIControllersRegisterRouters() {
145 145
 
146 146
 	beego.Router("/m/api/getmobileprintstockgood", &DialysisAPIController{}, "Get:GetMobilePrintStockGood")
147 147
 
148
+	beego.Router("/m/api/getprescriptionlist", &DialysisAPIController{}, "Get:GetPrescriptionList")
149
+
148 150
 	//批量删除监测
149 151
 	beego.Router("/m/api/batchdeletemonitor", &DialysisAPIController{}, "Get:BatchDeleteMonitor")
150 152
 	//获取单个患者1年的透析日期

+ 4 - 4
controllers/new_mobile_api_controllers/new_common_api_controller.go View File

@@ -195,7 +195,7 @@ func (this *NewCommonApiController) GetMobilePatientList() {
195 195
 	})
196 196
 }
197 197
 
198
-func (this *NewCommonApiController) GetPrescriptionlist() {
198
+func (this *NewCommonApiController) GetPrescriptionlistOne() {
199 199
 
200 200
 	startime := this.GetString("startime")
201 201
 
@@ -243,20 +243,20 @@ func (this *NewCommonApiController) GetMobilePatientDetail() {
243 243
 	startime := this.GetString("startime")
244 244
 
245 245
 	endtime := this.GetString("endtime")
246
-	startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
247
-	fmt.Println("parseDateErr", parseDateErr)
246
+	startDate, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
247
+
248 248
 	statime := startDate.Unix()
249 249
 
250 250
 	endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
251 251
 
252 252
 	entime := endDate.Unix()
253 253
 
254
-	fmt.Println(endtime)
255 254
 	limit, _ := this.GetInt64("limit")
256 255
 
257 256
 	page, _ := this.GetInt64("page")
258 257
 
259 258
 	patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
259
+
260 260
 	if err != nil {
261 261
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
262 262
 		return

+ 1 - 1
controllers/new_mobile_api_controllers/new_common_api_router.go View File

@@ -11,7 +11,7 @@ func NewCommonApiControllersRegisterRouters() {
11 11
 	beego.Router("/m/api/getmobiletotalagecount", &NewCommonApiController{}, "Get:GetMobileTotalAgeCount")
12 12
 	beego.Router("/m/api/getmobiletotaldialysiscount", &NewCommonApiController{}, "Get:GetMobileTotalDialysisCount")
13 13
 	beego.Router("/m/api/gemobilepatientlist", &NewCommonApiController{}, "Get:GetMobilePatientList")
14
-	beego.Router("/m/api/getprescriptionlist", &NewCommonApiController{}, "Get:GetPrescriptionlist")
14
+	beego.Router("/m/api/getprescriptionlist/one", &NewCommonApiController{}, "Get:GetPrescriptionlistOne")
15 15
 	beego.Router("/m/api/getmobilepatientdetail", &NewCommonApiController{}, "Get:GetMobilePatientDetail")
16 16
 	beego.Router("/m/api/tosearchpatient", &NewCommonApiController{}, "Get:ToSearchPatient")
17 17
 	beego.Router("/m/api/getallpatientsmode", &NewCommonApiController{}, "Get:GetAllPatientsMode")

+ 1 - 0
models/device_models.go View File

@@ -1024,6 +1024,7 @@ type VmSchedule struct {
1024 1024
 	Number              string `gorm:"column:number" json:"number" form:"number"`
1025 1025
 	ZoneName            string `gorm:"column:name" json:"zon_name" form:"name"`
1026 1026
 	DialysisMachineName string `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
1027
+	ModeId              int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1027 1028
 }
1028 1029
 
1029 1030
 type XtDeviceOxygenates struct {

+ 17 - 0
models/patient_models.go View File

@@ -493,6 +493,22 @@ func (DialysisPrescriptionList) TableName() string {
493 493
 	return "xt_dialysis_prescription"
494 494
 }
495 495
 
496
+type DialysisPrescriptionListSix struct {
497
+	ID                         int64  `gorm:"column:id" json:"id" form:"id"`
498
+	UserOrgId                  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
499
+	PatientId                  int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
500
+	DialysisDialyszers         string `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
501
+	DialysisIrrigation         string `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
502
+	DialysisStrainer           string `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
503
+	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
504
+	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
505
+	SolutionStatus             int64  `gorm:"column:solution_status" json:"solution_status" form:"solution_status"`
506
+}
507
+
508
+func (DialysisPrescriptionListSix) TableName() string {
509
+	return "xt_dialysis_solution"
510
+}
511
+
496 512
 type DialysisAssesmentBefor struct {
497 513
 	ID                     int64 `gorm:"column:id" json:"id"`
498 514
 	UserOrgId              int64 `gorm:"column:user_org_id" json:"user_org_id"`
@@ -1608,6 +1624,7 @@ func (XtHospitalSummary) TableName() string {
1608 1624
 type VmDialysisSolution struct {
1609 1625
 	UserOrgId                  int64                 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1610 1626
 	PatientId                  int64                 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1627
+	DialysisStrainer           string                `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
1611 1628
 	DialysisDialyszers         string                `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
1612 1629
 	DialysisIrrigation         string                `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
1613 1630
 	DialyzerPerfusionApparatus string                `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`

+ 29 - 0
service/gobal_config_service.go View File

@@ -510,6 +510,35 @@ func FindPrintStockGoodInfoByType(types int, startTime int64, end_time int64, or
510 510
 	return
511 511
 }
512 512
 
513
+func GetMobileScheduleListOne(start_time int64, end_time int64, org_id int64) (schedulelist []*models.XtScheduleList, err error) {
514
+
515
+	db := XTReadDB().Model(&schedulelist).Where("status =1 and user_org_id =?", org_id)
516
+	if start_time > 0 {
517
+		db = db.Where("schedule_date>=?", start_time)
518
+	}
519
+	if end_time > 0 {
520
+		db = db.Where("schedule_date<=?", end_time)
521
+	}
522
+	err = db.Preload("DialysisSolution", "status=1 and user_org_id =?", org_id).Find(&schedulelist).Error
523
+
524
+	return schedulelist, err
525
+
526
+}
527
+
528
+func GetMobileDialysisPrescriptionList(start_time int64, end_time int64, org_id int64) (prescription []*models.DialysisPrescription, err error) {
529
+
530
+	db := XTReadDB().Model(&prescription).Where("status =1 and user_org_id =?", org_id)
531
+
532
+	if start_time > 0 {
533
+		db = db.Where("record_date>=?", start_time)
534
+	}
535
+	if end_time > 0 {
536
+		db = db.Where("record_date<=?", end_time)
537
+	}
538
+	err = db.Find(&prescription).Error
539
+	return prescription, err
540
+}
541
+
513 542
 func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
514 543
 
515 544
 	err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error

+ 2 - 2
service/inspection_service.go View File

@@ -38,7 +38,7 @@ func GetPatientInspectionProjectCount(orgId, patientId int64) (projectCounts []*
38 38
 }
39 39
 
40 40
 func GetPatientInspectionByDate(orgId, patientId, date, projectId int64) (inspections []*models.Inspection, err error) {
41
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id =? and inspect_date =? and status=1", patientId, orgId, projectId, date).Find(&inspections).Error
41
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id =? and inspect_date =? and status=1", patientId, orgId, projectId, date).Order("created_time desc").Find(&inspections).Error
42 42
 	return
43 43
 }
44 44
 
@@ -169,7 +169,7 @@ func DeletePatientInspection(orgId, patientId, projectId, date int64) (err error
169 169
 func GetPatientInspections(orgId, patientId, projectId, page int64) (inspections []*models.Inspection, total int64, date int64, err error) {
170 170
 
171 171
 	var projectCount models.UserInspectionProjectCount
172
-	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Scan(&projectCount).Error
172
+	err = readDb.Model(&models.Inspection{}).Where("patient_id=? and org_id=? and project_id=? and status=1", patientId, orgId, projectId).Select("count(distinct inspect_date) as count, project_id, patient_id").Order("created_time desc").Scan(&projectCount).Error
173 173
 
174 174
 	if err != nil {
175 175
 		return

+ 2 - 0
service/mobile_dialysis_service.go View File

@@ -2941,6 +2941,7 @@ type MDialysisGoodsVM struct {
2941 2941
 	LastDialysisBeforePrepare []*DialysisBeforePrepare         `gorm:"-" json:"last_good_user_detail"`
2942 2942
 	Project                   []*models.HisPrescriptionProject `gorm:"-" json:"project"`
2943 2943
 	//WarehouseOutInfo          []*models.WarehouseOutInfoSeven   `gorm:"ForeignKey:PatientId,ScheduleDate;AssociationForeignKey:PatientId,SysRecordTime" json:"ware_house_out_info"`
2944
+	DialysisPrescription models.DialysisPrescriptionListSix `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"prescription"`
2944 2945
 }
2945 2946
 
2946 2947
 func (MDialysisGoodsVM) TableName() string {
@@ -2984,6 +2985,7 @@ func MobileGetDialysisGoods(orgID int64, scheduleDate int64, schedule_type int64
2984 2985
 
2985 2986
 	db := readDb.
2986 2987
 		Table("xt_schedule as sch").
2988
+		Preload("DialysisPrescription", "status=1 and user_org_id =? and solution_status = 1", orgID).
2987 2989
 		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
2988 2990
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
2989 2991
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).

+ 3 - 0
service/pharmacy_service.go View File

@@ -1437,10 +1437,13 @@ func ReplacementDrugs(orgid int64, special bool) (list []*models.ReplacementDrug
1437 1437
 	var g errgroup.Group
1438 1438
 	var lib []*models.BaseDrugLib
1439 1439
 	var lock sync.Mutex
1440
+
1440 1441
 	if special {
1441 1442
 		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ? and drug_status not like '%停用%' AND status = 1 and is_special_diseases = 1", orgid).Find(&lib).Error
1443
+
1442 1444
 	} else {
1443 1445
 		err = readDb.Model(&models.BaseDrugLib{}).Where("org_id = ? and drug_status not like '%停用%'  AND status = 1 ", orgid).Find(&lib).Error
1446
+
1444 1447
 	}
1445 1448
 	if err != nil {
1446 1449
 		return

+ 1 - 1
service/schedule_service.go View File

@@ -1174,7 +1174,7 @@ func GetThreeWeekList(startime int64, endtime int64, orgid int64, scheduletype i
1174 1174
 	if partionid > 0 {
1175 1175
 		db = db.Where("x.partition_id = ?", partionid)
1176 1176
 	}
1177
-	err = db.Select("x.schedule_date,x.schedule_type,x.schedule_week,x.bed_id,x.partition_id,t.name,n.number,z.name,x.dialysis_machine_name").Joins("left join xt_patients as t on t.id = x.patient_id and t.user_org_id = ? and t.status = 1", orgid).Joins("left join xt_device_zone as z on z.id = x.partition_id and z.org_id = ? and z.status =1", orgid).Joins("left join xt_device_number as n on n.id = x.bed_id and n.org_id = ? and n.status =1", orgid).Scan(&schedule).Error
1177
+	err = db.Select("x.schedule_date,x.schedule_type,x.schedule_week,x.bed_id,x.partition_id,t.name,n.number,z.name,x.dialysis_machine_name,x.mode_id").Joins("left join xt_patients as t on t.id = x.patient_id and t.user_org_id = ? and t.status = 1", orgid).Joins("left join xt_device_zone as z on z.id = x.partition_id and z.org_id = ? and z.status =1", orgid).Joins("left join xt_device_number as n on n.id = x.bed_id and n.org_id = ? and n.status =1", orgid).Scan(&schedule).Error
1178 1178
 
1179 1179
 	return schedule, err
1180 1180
 }