Pārlūkot izejas kodu

11月9日库存管理

XMLWAN 2 gadus atpakaļ
vecāks
revīzija
8c705b39c2

+ 1 - 1
conf/app.conf Parādīt failu

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

+ 27 - 2
controllers/dialysis_api_controller.go Parādīt failu

90
 
90
 
91
 	beego.Router("/api/patient/getdialysisparametergoodlist", &DialysisApiController{}, "Get:GetDialysisParameterGoodList")
91
 	beego.Router("/api/patient/getdialysisparametergoodlist", &DialysisApiController{}, "Get:GetDialysisParameterGoodList")
92
 
92
 
93
-	beego.Router("/api/patinet/savehisdialysis", &DialysisApiController{}, "Get:SaveHisDialysis")
93
+	beego.Router("/api/patient/savehisdialysis", &DialysisApiController{}, "Get:SaveHisDialysis")
94
+
95
+	beego.Router("/api/patient/gethisdialysisgoodcount", &DialysisApiController{}, "Get:GetHisDialysisGoodCount")
94
 }
96
 }
95
 
97
 
96
 func (c *DialysisApiController) GetQueueCall() {
98
 func (c *DialysisApiController) GetQueueCall() {
4276
 
4278
 
4277
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4279
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4278
 	_, config := service.FindXTHisRecordByOrgId(orgId)
4280
 	_, config := service.FindXTHisRecordByOrgId(orgId)
4281
+
4279
 	goodType, _ := service.GetAllGoodType(orgId)
4282
 	goodType, _ := service.GetAllGoodType(orgId)
4280
-	if config.IsOpen == 0 {
4283
+	if config.IsOpen != 1 {
4281
 		list, total, err := service.GetPatientDialysisSolutionGroupList(keyword, limit, page, partition_id, schedule_type, startTime.Unix(), orgId)
4284
 		list, total, err := service.GetPatientDialysisSolutionGroupList(keyword, limit, page, partition_id, schedule_type, startTime.Unix(), orgId)
4285
+		fmt.Println("list2232323223332323232", list)
4282
 		if err == nil {
4286
 		if err == nil {
4283
 			this.ServeSuccessJSON(map[string]interface{}{
4287
 			this.ServeSuccessJSON(map[string]interface{}{
4284
 				"list":     list,
4288
 				"list":     list,
4583
 	this.ServeSuccessJSON(returnData)
4587
 	this.ServeSuccessJSON(returnData)
4584
 	return
4588
 	return
4585
 }
4589
 }
4590
+
4591
+func (this *DialysisApiController) GetHisDialysisGoodCount() {
4592
+
4593
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4594
+
4595
+	schedule_type, _ := this.GetInt64("schedule_type")
4596
+
4597
+	partion_type, _ := this.GetInt64("partion_type")
4598
+
4599
+	start_time := this.GetString("selected_date")
4600
+	timeLayout := "2006-01-02"
4601
+	loc, _ := time.LoadLocation("Local")
4602
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
4603
+
4604
+	list, _ := service.GetHisDialysisGoodCount(orgId, schedule_type, partion_type, startTime.Unix())
4605
+
4606
+	this.ServeSuccessJSON(map[string]interface{}{
4607
+		"list": list,
4608
+	})
4609
+	return
4610
+}

+ 4 - 1
controllers/dialysis_record_api_controller.go Parādīt failu

1163
 	internal_fistula := this.GetString("internal_fistula")
1163
 	internal_fistula := this.GetString("internal_fistula")
1164
 	catheter := this.GetString("catheter")
1164
 	catheter := this.GetString("catheter")
1165
 	cruor := this.GetString("cruor")
1165
 	cruor := this.GetString("cruor")
1166
+	mission := this.GetString("mission")
1166
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 {
1167
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 {
1167
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1168
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1168
 		return
1169
 		return
1457
 	}()
1458
 	}()
1458
 
1459
 
1459
 	//执行下机
1460
 	//执行下机
1460
-	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor)
1461
+	updateErr := service.ModifyDialysisRecord(dialysisRecord.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
1461
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1462
 	key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
1462
 	redis := service.RedisClient()
1463
 	redis := service.RedisClient()
1463
 	defer redis.Close()
1464
 	defer redis.Close()
1736
 	internal_fistula := c.GetString("internal_fistula")
1737
 	internal_fistula := c.GetString("internal_fistula")
1737
 	catheter := c.GetString("catheter")
1738
 	catheter := c.GetString("catheter")
1738
 	cruor := c.GetString("cruor")
1739
 	cruor := c.GetString("cruor")
1740
+	mission := c.GetString("mission")
1739
 	if record_id <= 0 || nurseID <= 0 {
1741
 	if record_id <= 0 || nurseID <= 0 {
1740
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1742
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1741
 		return
1743
 		return
1782
 		BloodAccessInternalFistula: internal_fistula,
1784
 		BloodAccessInternalFistula: internal_fistula,
1783
 		Catheter:                   catheter,
1785
 		Catheter:                   catheter,
1784
 		Cruor:                      cruor,
1786
 		Cruor:                      cruor,
1787
+		Mission:                    mission,
1785
 	}
1788
 	}
1786
 
1789
 
1787
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)
1790
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)

+ 9 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go Parādīt failu

574
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
574
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
575
 	}
575
 	}
576
 	fmt.Println("doctorAdvices23344334344433434334343434wode", doctorAdvices)
576
 	fmt.Println("doctorAdvices23344334344433434334343434wode", doctorAdvices)
577
+
578
+	lastOrder, _ := service.GetLastDilysisOrder(adminInfo.Org.Id, patientID, date.Unix())
577
 	returnData := map[string]interface{}{
579
 	returnData := map[string]interface{}{
578
 		"patient":                        patient,
580
 		"patient":                        patient,
579
 		"schedual":                       schedual,
581
 		"schedual":                       schedual,
606
 		"team_projects":                  team_projects,
608
 		"team_projects":                  team_projects,
607
 		"is_advice_open":                 is_advice_open,
609
 		"is_advice_open":                 is_advice_open,
608
 		"prescription_open":              prescriptionConfig.IsOpen,
610
 		"prescription_open":              prescriptionConfig.IsOpen,
611
+		"lastOrder":                      lastOrder,
609
 	}
612
 	}
610
 	this.ServeSuccessJSON(returnData)
613
 	this.ServeSuccessJSON(returnData)
611
 }
614
 }
1683
 	internal_fistula := c.GetString("blood_access_internal_fistula")
1686
 	internal_fistula := c.GetString("blood_access_internal_fistula")
1684
 	catheter := c.GetString("catheter")
1687
 	catheter := c.GetString("catheter")
1685
 	cruor := c.GetString("cruor")
1688
 	cruor := c.GetString("cruor")
1689
+	mission := c.GetString("mission")
1686
 	if id <= 0 || nurseID <= 0 {
1690
 	if id <= 0 || nurseID <= 0 {
1687
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1691
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1688
 		return
1692
 		return
1994
 		return
1998
 		return
1995
 	}
1999
 	}
1996
 	if dialysisOrder.Stage == 1 {
2000
 	if dialysisOrder.Stage == 1 {
1997
-		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor)
2001
+		err := service.ModifyDialysisRecord(dialysisOrder.ID, nurseID, endDate.Unix(), adminUserInfo.AdminUser.Id, puncture_point_haematoma, internal_fistula, catheter, cruor, mission)
1998
 
2002
 
1999
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
2003
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":dialysis_order"
2000
 		redis := service.RedisClient()
2004
 		redis := service.RedisClient()
2090
 	dialysis_irrigation := this.GetString("dialysis_irrigation")
2094
 	dialysis_irrigation := this.GetString("dialysis_irrigation")
2091
 	blood_access_id, _ := this.GetInt64("blood_access_id")
2095
 	blood_access_id, _ := this.GetInt64("blood_access_id")
2092
 	zone_id, _ := this.GetInt64("zone_id")
2096
 	zone_id, _ := this.GetInt64("zone_id")
2093
-
2097
+	elecsign := this.GetString("url")
2094
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
2098
 	if patientID <= 0 || len(recordDateStr) == 0 || nurseID <= 0 || bedID <= 0 {
2095
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2099
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
2096
 		return
2100
 		return
2279
 		DialysisIrrigation:     dialysis_irrigation,
2283
 		DialysisIrrigation:     dialysis_irrigation,
2280
 		DialysisDialyszers:     dialysis_dialyszers,
2284
 		DialysisDialyszers:     dialysis_dialyszers,
2281
 		BloodAccessId:          blood_access_id,
2285
 		BloodAccessId:          blood_access_id,
2286
+		Url:                    elecsign,
2282
 	}
2287
 	}
2283
 	//查询该床位是否有人用了
2288
 	//查询该床位是否有人用了
2284
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
2289
 	_, errorscode := service.GetDialysisOrderByBedId(adminUserInfo.Org.Id, schedulestartTime, bedID, schedual_type)
3278
 	blood_access_internal_fistula := c.GetString("blood_access_internal_fistula")
3283
 	blood_access_internal_fistula := c.GetString("blood_access_internal_fistula")
3279
 	catheter := c.GetString("catheter")
3284
 	catheter := c.GetString("catheter")
3280
 	cruor := c.GetString("cruor")
3285
 	cruor := c.GetString("cruor")
3286
+	mission := c.GetString("mission")
3281
 	if record_id <= 0 || nurseID <= 0 {
3287
 	if record_id <= 0 || nurseID <= 0 {
3282
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3288
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3283
 		return
3289
 		return
3324
 		BloodAccessInternalFistula: blood_access_internal_fistula,
3330
 		BloodAccessInternalFistula: blood_access_internal_fistula,
3325
 		Catheter:                   catheter,
3331
 		Catheter:                   catheter,
3326
 		Cruor:                      cruor,
3332
 		Cruor:                      cruor,
3333
+		Mission:                    mission,
3327
 	}
3334
 	}
3328
 
3335
 
3329
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)
3336
 	updateErr := service.ModifyFinishDialysisOrder(dialysisRecord)

+ 1 - 0
models/dialysis.go Parādīt failu

842
 	DialysisDialyszers         string        `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
842
 	DialysisDialyszers         string        `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
843
 	DialysisIrrigation         string        `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
843
 	DialysisIrrigation         string        `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
844
 	BloodAccessId              int64         `gorm:"column:blood_access_id" json:"blood_access_id" form:"blood_access_id"`
844
 	BloodAccessId              int64         `gorm:"column:blood_access_id" json:"blood_access_id" form:"blood_access_id"`
845
+	Mission                    string        `gorm:"column:mission" json:"mission" form:"mission"`
845
 }
846
 }
846
 
847
 
847
 func (DialysisOrder) TableName() string {
848
 func (DialysisOrder) TableName() string {

+ 97 - 16
models/schedule_models.go Parādīt failu

351
 }
351
 }
352
 
352
 
353
 type VmBloodScheduleTwo struct {
353
 type VmBloodScheduleTwo struct {
354
-	ID                          int64                       `gorm:"column:id" json:"id" form:"id"`
355
-	UserOrgId                   int64                       `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
356
-	PartitionId                 int64                       `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
357
-	BedId                       int64                       `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
358
-	PatientId                   int64                       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
359
-	ScheduleDate                int64                       `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
360
-	ScheduleType                int64                       `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
361
-	ScheduleWeek                int64                       `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
362
-	ModeId                      int64                       `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
363
-	Status                      int64                       `gorm:"column:status" json:"status" form:"status"`
364
-	CreatedTime                 int64                       `gorm:"column:created_time" json:"created_time" form:"created_time"`
365
-	UpdatedTime                 int64                       `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
366
-	IsExport                    int64                       `gorm:"column:is_export" json:"is_export" form:"is_export"`
367
-	DeviceNumber                *NewMDeviceNumberVM         `gorm:"ForeignKey:BedId" json:"device_number"`
368
-	SchedualPatient             *NewMSchedualPatientVMList  `gorm:"ForeignKey:PatientId" json:"patient"`
369
-	HisPrescriptionInfoTemplate HisPrescriptionInfoTemplate `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"his_prescription_template"`
354
+	ID                         int64                      `gorm:"column:id" json:"id" form:"id"`
355
+	UserOrgId                  int64                      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
356
+	PartitionId                int64                      `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
357
+	BedId                      int64                      `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
358
+	PatientId                  int64                      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
359
+	ScheduleDate               int64                      `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
360
+	ScheduleType               int64                      `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
361
+	ScheduleWeek               int64                      `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
362
+	ModeId                     int64                      `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
363
+	Status                     int64                      `gorm:"column:status" json:"status" form:"status"`
364
+	CreatedTime                int64                      `gorm:"column:created_time" json:"created_time" form:"created_time"`
365
+	UpdatedTime                int64                      `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
366
+	IsExport                   int64                      `gorm:"column:is_export" json:"is_export" form:"is_export"`
367
+	DeviceNumber               *NewMDeviceNumberVM        `gorm:"ForeignKey:BedId" json:"device_number"`
368
+	SchedualPatient            *NewMSchedualPatientVMList `gorm:"ForeignKey:PatientId" json:"patient"`
369
+	HisPrescriptionTemplateSix HisPrescriptionTemplateSix `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"his_prescription_template"`
370
 }
370
 }
371
 
371
 
372
 func (VmBloodScheduleTwo) TableName() string {
372
 func (VmBloodScheduleTwo) TableName() string {
373
 	return "xt_schedule"
373
 	return "xt_schedule"
374
 }
374
 }
375
+
376
+type HisPrescriptionTemplateSix struct {
377
+	ID                             int64                             `gorm:"column:id" json:"id" form:"id"`
378
+	UserOrgId                      int64                             `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
379
+	PatientId                      int64                             `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
380
+	Type                           int64                             `gorm:"column:type" json:"type" form:"type"`
381
+	Status                         int64                             `gorm:"column:status" json:"status" form:"status"`
382
+	Ctime                          int64                             `gorm:"column:ctime" json:"ctime" form:"ctime"`
383
+	Mtime                          int64                             `gorm:"column:mtime" json:"mtime" form:"mtime"`
384
+	Name                           string                            `gorm:"column:name" json:"name" form:"name"`
385
+	Mode                           int64                             `gorm:"column:mode" json:"mode" form:"mode"`
386
+	HisPrescriptionInfoTemplateSix []*HisPrescriptionInfoTemplateSix `gorm:"ForeignKey:PTemplateId;AssociationForeignKey:ID" json:"his_prescription_info"`
387
+}
388
+
389
+func (HisPrescriptionTemplateSix) TableName() string {
390
+	return "his_prescription_template"
391
+}
392
+
393
+type HisPrescriptionInfoTemplateSix struct {
394
+	ID                                  int64                                  `gorm:"column:id" json:"id" form:"id"`
395
+	UserOrgId                           int64                                  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
396
+	RecordDate                          int64                                  `gorm:"column:record_date" json:"record_date" form:"record_date"`
397
+	PatientId                           int64                                  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
398
+	Status                              int64                                  `gorm:"column:status" json:"status" form:"status"`
399
+	Ctime                               int64                                  `gorm:"column:ctime" json:"ctime" form:"ctime"`
400
+	Mtime                               int64                                  `gorm:"column:mtime" json:"mtime" form:"mtime"`
401
+	Type                                int64                                  `gorm:"column:type" json:"type" form:"type"`
402
+	Creator                             int64                                  `gorm:"column:creator" json:"creator" form:"creator"`
403
+	Modifier                            int64                                  `gorm:"column:modifier" json:"modifier" form:"modifier"`
404
+	PType                               int64                                  `gorm:"column:p_type" json:"p_type" form:"p_type"`
405
+	PTemplateId                         int64                                  `gorm:"column:p_template_id" json:"p_template_id" form:"p_template_id"`
406
+	HisPrescriptionProjectTemplateSeven []*HisPrescriptionProjectTemplateSeven `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
407
+	MedType                             string                                 `gorm:"column:med_type" json:"med_type" form:"med_type"`
408
+}
409
+
410
+func (HisPrescriptionInfoTemplateSix) TableName() string {
411
+	return "his_prescription_info_template"
412
+}
413
+
414
+type HisPrescriptionProjectTemplateSeven struct {
415
+	ID                 int64         `gorm:"column:id" json:"id" form:"id"`
416
+	ProjectId          int64         `gorm:"column:project_id" json:"project_id" form:"project_id"`
417
+	Price              float64       `gorm:"column:price" json:"price" form:"price"`
418
+	UserOrgId          int64         `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
419
+	Status             int64         `gorm:"column:status" json:"status" form:"status"`
420
+	Ctime              int64         `gorm:"column:ctime" json:"ctime" form:"ctime"`
421
+	Mtime              int64         `gorm:"column:mtime" json:"mtime" form:"mtime"`
422
+	PatientId          int64         `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
423
+	HisPatientId       int64         `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
424
+	RecordDate         int64         `gorm:"column:record_date" json:"record_date" form:"record_date"`
425
+	Count              string        `gorm:"column:count" json:"count" form:"count"`
426
+	FeedetlSn          string        `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
427
+	MedListCodg        string        `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
428
+	SingleDose         string        `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
429
+	DeliveryWay        string        `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
430
+	ExecutionFrequency string        `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
431
+	Day                string        `gorm:"column:day" json:"day" form:"day"`
432
+	Remark             string        `gorm:"column:remark" json:"remark" form:"remark"`
433
+	Unit               string        `gorm:"column:unit" json:"unit" form:"unit"`
434
+	Type               int64         `gorm:"column:type" json:"type" form:"type"`
435
+	PrescriptionId     int64         `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
436
+	GoodInfo           GoodInfoNight `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"good_info"`
437
+	FrequencyType      int64         `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
438
+	DayCount           int64         `gorm:"column:day_count" json:"day_count" form:"day_count"`
439
+	WeekDay            string        `gorm:"column:week_day" json:"week_day" form:"week_day"`
440
+}
441
+
442
+func (HisPrescriptionProjectTemplateSeven) TableName() string {
443
+	return "his_prescription_project_template"
444
+}
445
+
446
+type GoodInfoNight struct {
447
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
448
+	GoodName          string `gorm:"column:good_name" json:"good_name" form:"good_name"`
449
+	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
450
+	GoodTypeId        int64  `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
451
+}
452
+
453
+func (GoodInfoNight) TableName() string {
454
+	return "xt_good_information"
455
+}

+ 2 - 2
service/dialysis_service.go Parādīt failu

553
 	return nil
553
 	return nil
554
 }
554
 }
555
 
555
 
556
-func ModifyDialysisRecord(id int64, finishNurse int64, end_time int64, admin_user_id int64, puncture_point_haematoma int64, internal_fistula string, catheter string, cruor string) error {
557
-	err := writeDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1 ", id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "stage": 2, "finish_nurse": finishNurse, "end_time": end_time, "finish_creator": admin_user_id, "finish_modifier": admin_user_id, "puncture_point_haematoma": puncture_point_haematoma, "blood_access_internal_fistula": internal_fistula, "catheter": catheter, "cruor": cruor}).Error
556
+func ModifyDialysisRecord(id int64, finishNurse int64, end_time int64, admin_user_id int64, puncture_point_haematoma int64, internal_fistula string, catheter string, cruor string, mission string) error {
557
+	err := writeDb.Model(&models.DialysisOrder{}).Where("id = ? AND status = 1 ", id).Updates(map[string]interface{}{"updated_time": time.Now().Unix(), "stage": 2, "finish_nurse": finishNurse, "end_time": end_time, "finish_creator": admin_user_id, "finish_modifier": admin_user_id, "puncture_point_haematoma": puncture_point_haematoma, "blood_access_internal_fistula": internal_fistula, "catheter": catheter, "cruor": cruor, "mission": mission}).Error
558
 	return err
558
 	return err
559
 
559
 
560
 }
560
 }

+ 41 - 6
service/dialysis_solution_service.go Parādīt failu

294
 		db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
294
 		db = db.Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
295
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
295
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
296
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
296
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
297
-			Preload("HisPrescriptionInfoTemplate", func(db *gorm.DB) *gorm.DB {
298
-				return db.Where("user_org_id = ? and status = 1", orgID).Preload("HisPrescriptionProjectTemplate", func(db *gorm.DB) *gorm.DB {
299
-					return db.Where("user_org_id = ? and status = 1 and type =3 ", orgID).Preload("GoodInfo", "org_id = ? and status = 1", orgID)
297
+			Preload("HisPrescriptionTemplateSix", func(db *gorm.DB) *gorm.DB {
298
+				return db.Where("user_org_id = ? and status = 1", orgID).Preload("HisPrescriptionInfoTemplateSix", func(db *gorm.DB) *gorm.DB {
299
+					return db.Where("user_org_id = ? and status = 1 and type = 2", orgID).Preload("HisPrescriptionProjectTemplateSeven", func(db *gorm.DB) *gorm.DB {
300
+						return db.Where("user_org_id = ? and status = 1 and type = 3", orgID).Preload("GoodInfo", "org_id =? and status = 1", orgID)
301
+					})
300
 				})
302
 				})
301
 			})
303
 			})
302
 		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
304
 		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
306
 			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
308
 			Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
307
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
309
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
308
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
310
 			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
309
-			Preload("HisPrescriptionInfoTemplate", func(db *gorm.DB) *gorm.DB {
310
-				return db.Where("user_org_id = ? and status = 1", orgID).Preload("HisPrescriptionProjectTemplate", func(db *gorm.DB) *gorm.DB {
311
-					return db.Where("user_org_id = ? and status = 1 and type =3 ", orgID).Preload("GoodInfo", "org_id = ? and status = 1", orgID)
311
+			Preload("HisPrescriptionTemplateSix", func(db *gorm.DB) *gorm.DB {
312
+				return db.Where("user_org_id = ? and status = 1", orgID).Preload("HisPrescriptionInfoTemplateSix", func(db *gorm.DB) *gorm.DB {
313
+					return db.Where("user_org_id = ? and status = 1 and type = 2", orgID).Preload("HisPrescriptionProjectTemplateSeven", func(db *gorm.DB) *gorm.DB {
314
+						return db.Where("user_org_id = ? and status = 1 and type = 3", orgID).Preload("GoodInfo", "org_id =? and status = 1", orgID)
315
+					})
312
 				})
316
 				})
313
 			}).Find(&schedule).Error
317
 			}).Find(&schedule).Error
314
 	}
318
 	}
315
 
319
 
316
 	return schedule, total, err
320
 	return schedule, total, err
317
 }
321
 }
322
+
323
+func GetHisDialysisGoodCount(orgID int64, schedule_type int64, partition_id int64, scheduleDate int64) (schedule []*models.VmBloodScheduleTwo, err error) {
324
+
325
+	db := XTReadDB().Model(&models.VmBloodScheduleTwo{}).Where("xt_schedule.status = 1")
326
+	if scheduleDate > 0 {
327
+		db = db.Where("xt_schedule.schedule_date = ?", scheduleDate)
328
+	}
329
+	if schedule_type > 0 {
330
+		db = db.Where("xt_schedule.schedule_type = ?", schedule_type)
331
+	}
332
+	if partition_id > 0 {
333
+		db = db.Where("xt_schedule.partition_id = ?", partition_id)
334
+	}
335
+	if orgID > 0 {
336
+		db = db.Where("xt_schedule.user_org_id  = ?", orgID)
337
+	}
338
+
339
+	err = db.
340
+		Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
341
+		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
342
+		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
343
+		Preload("HisPrescriptionTemplateSix", func(db *gorm.DB) *gorm.DB {
344
+			return db.Where("user_org_id = ? and status = 1", orgID).Preload("HisPrescriptionInfoTemplateSix", func(db *gorm.DB) *gorm.DB {
345
+				return db.Where("user_org_id = ? and status = 1 and type = 2", orgID).Preload("HisPrescriptionProjectTemplateSeven", func(db *gorm.DB) *gorm.DB {
346
+					return db.Where("user_org_id = ? and status = 1 and type = 3", orgID).Preload("GoodInfo", "org_id =? and status = 1", orgID)
347
+				})
348
+			})
349
+		}).Find(&schedule).Error
350
+
351
+	return schedule, err
352
+}

+ 10 - 1
service/mobile_dialysis_service.go Parādīt failu

2033
 func ModifyFinishDialysisOrder(order *models.DialysisOrder) error {
2033
 func ModifyFinishDialysisOrder(order *models.DialysisOrder) error {
2034
 	tx := writeDb.Begin()
2034
 	tx := writeDb.Begin()
2035
 	updateTime := time.Now().Unix()
2035
 	updateTime := time.Now().Unix()
2036
-	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"finish_nurse": order.FinishNurse, "updated_time": updateTime, "end_time": order.EndTime, "finish_modifier": order.FinishModifier, "puncture_point_haematoma": order.PuncturePointHaematoma, "blood_access_internal_fistula": order.BloodAccessInternalFistula, "catheter": order.Catheter, "cruor": order.Cruor}).Error
2036
+	err := tx.Model(&models.DialysisOrder{}).Where("user_org_id = ? AND id = ? AND status = 1 ", order.UserOrgId, order.ID).Updates(map[string]interface{}{"finish_nurse": order.FinishNurse, "updated_time": updateTime, "end_time": order.EndTime, "finish_modifier": order.FinishModifier, "puncture_point_haematoma": order.PuncturePointHaematoma, "blood_access_internal_fistula": order.BloodAccessInternalFistula, "catheter": order.Catheter, "cruor": order.Cruor, "mission": order.Mission}).Error
2037
 	if err != nil {
2037
 	if err != nil {
2038
 		tx.Rollback()
2038
 		tx.Rollback()
2039
 		return err
2039
 		return err
4109
 	err = readDb.Where("org_id = ? and patient_id = ? and sys_record_time = ? and status = 1", orgId, patient_id, sys_record_time).Find(&outifno).Error
4109
 	err = readDb.Where("org_id = ? and patient_id = ? and sys_record_time = ? and status = 1", orgId, patient_id, sys_record_time).Find(&outifno).Error
4110
 	return outifno, err
4110
 	return outifno, err
4111
 }
4111
 }
4112
+
4113
+func GetLastDilysisOrder(orgid int64, patient_id int64, dialysis_date int64) (models.DialysisOrder, error) {
4114
+
4115
+	order := models.DialysisOrder{}
4116
+
4117
+	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and dialysis_date < ? and status= 1", orgid, patient_id, dialysis_date).Last(&order).Error
4118
+
4119
+	return order, err
4120
+}