Browse Source

耗材参数

XMLWAN 4 years ago
parent
commit
b33ed8d587

+ 21 - 20
controllers/dialysis_record_api_controller.go View File

@@ -591,16 +591,17 @@ func (this *DialysisRecordAPIController) StartDialysis() {
591 591
 		return
592 592
 	}
593 593
 
594
-	nurse, getNurseErr = service.GetAdminUserByUserID(punctureNurseId)
595
-	if getNurseErr != nil {
596
-		this.ErrorLog("获取护士失败:%v", getNurseErr)
597
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
598
-		return
599
-	} else if nurse == nil {
600
-		this.ErrorLog("护士不存在")
601
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
602
-		return
603
-	}
594
+	//nurse, getNurseErr = service.GetAdminUserByUserID(punctureNurseId)
595
+	//
596
+	//if getNurseErr != nil {
597
+	//	this.ErrorLog("获取护士失败:%v", getNurseErr)
598
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
599
+	//	return
600
+	//} else if nurse == nil {
601
+	//	this.ErrorLog("护士不存在")
602
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
603
+	//	return
604
+	//}
604 605
 
605 606
 	deviceNumber, getDeviceNumberErr := service.GetDeviceNumberByID(adminUserInfo.CurrentOrgId, bedID)
606 607
 	if getDeviceNumberErr != nil {
@@ -1077,16 +1078,16 @@ func (this *DialysisRecordAPIController) ModifyStartDialysis() {
1077 1078
 		return
1078 1079
 	}
1079 1080
 
1080
-	nurse, getNurseErr = service.GetAdminUserByUserID(puncture_nurse)
1081
-	if getNurseErr != nil {
1082
-		this.ErrorLog("获取护士失败:%v", getNurseErr)
1083
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1084
-		return
1085
-	} else if nurse == nil {
1086
-		this.ErrorLog("护士不存在")
1087
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1088
-		return
1089
-	}
1081
+	//nurse, getNurseErr = service.GetAdminUserByUserID(puncture_nurse)
1082
+	//if getNurseErr != nil {
1083
+	//	this.ErrorLog("获取护士失败:%v", getNurseErr)
1084
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1085
+	//	return
1086
+	//} else if nurse == nil {
1087
+	//	this.ErrorLog("护士不存在")
1088
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1089
+	//	return
1090
+	//}
1090 1091
 
1091 1092
 	deviceNumber, getDeviceNumberErr := service.GetDeviceNumberByID(adminUserInfo.CurrentOrgId, bedID)
1092 1093
 	if getDeviceNumberErr != nil {

+ 1 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -640,6 +640,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
640 640
 				evaluation.IsInfect = lastPredialysisEvaluation.IsInfect                       //感染
641 641
 				evaluation.Exposed = lastPredialysisEvaluation.Exposed                         // 外漏
642 642
 				evaluation.DialysisCount = lastPredialysisEvaluation.DialysisCount             //呼吸频次
643
+				evaluation.Phinholing = lastPredialysisEvaluation.Phinholing                   //针眼
643 644
 
644 645
 			}
645 646
 		} else {

+ 12 - 1
controllers/patient_api_controller.go View File

@@ -631,6 +631,7 @@ func (c *PatientApiController) EditPatient() {
631 631
 
632 632
 func (c *PatientApiController) EditLapseto() {
633 633
 	id, _ := c.GetInt64("id", 0)
634
+
634 635
 	if id <= 0 {
635 636
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
636 637
 		return
@@ -680,6 +681,15 @@ func (c *PatientApiController) EditLapseto() {
680 681
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotSelectLapsetoTime)
681 682
 		return
682 683
 	}
684
+
685
+	out_reason, _ := patientBody["out_reason"].(string)
686
+
687
+	if len(out_reason) == 0 {
688
+		utils.ErrorLog("len(out_reason) == 0")
689
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotSelectLapsetoTime)
690
+		return
691
+	}
692
+
683 693
 	lapsetoTimeUnix, err := time.ParseInLocation(timeLayout, lapsetoTime, loc)
684 694
 	if err != nil {
685 695
 		utils.ErrorLog("lapsetoTimeUnix")
@@ -691,7 +701,8 @@ func (c *PatientApiController) EditLapseto() {
691 701
 	lapseto.CreatedTime = time.Now().Unix()
692 702
 	lapseto.Status = 1
693 703
 	patient.Lapseto = lapseto.LapsetoType
694
-
704
+	patient.OutReason = out_reason
705
+	patient.DeathTime = lapsetoTimeUnix.Unix()
695 706
 	//if patient.Lapseto == 1 {
696 707
 	//	patientTotal := service.GetLapsetoPatientCount(adminUserInfo.CurrentOrgId, 1)
697 708
 	//	subscibes := adminUserInfo.Subscibes[adminUserInfo.CurrentOrgId]

+ 29 - 16
models/patient_models.go View File

@@ -102,22 +102,23 @@ type Patients struct {
102 102
 	Contagions                   []InfectiousDiseases `json:"contagions" gorm:"foreignkey:PatientId"`
103 103
 	Diseases                     []ChronicDiseases    `json:"diseases" gorm:"foreignkey:PatientId"`
104 104
 
105
-	InfectiousNextRecordTime int64  `gorm:"column:infectious_next_record_time" json:"infectious_next_record_time"`
106
-	IsInfectious             int64  `gorm:"column:is_infectious" json:"is_infectious"`
107
-	RemindCycle              int64  `gorm:"column:remind_cycle" json:"remind_cycle"`
108
-	ResponseResult           string `gorm:"column:response_result" json:"response_result"`
109
-	IsOpenRemind             int64  `gorm:"column:is_open_remind" json:"is_open_remind"`
110
-	DialysisAge              int64  `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
111
-	ExpenseKind              int64  `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
112
-	TellPhone                string `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
113
-	FirstTreatmentDate       int64  `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
114
-	ContactName              string `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
115
-	UserSysBeforeCount       int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
116
-	IsExcelExport            int64  `gorm:"column:is_excel_export" json:"is_excel_export" form:"is_excel_export"`
117
-	SchRemark                string `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
118
-
119
-	ContagionIds []int64 `gorm:"-"`
120
-	DryWeight    float64 `gorm:"-"`
105
+	InfectiousNextRecordTime int64   `gorm:"column:infectious_next_record_time" json:"infectious_next_record_time"`
106
+	IsInfectious             int64   `gorm:"column:is_infectious" json:"is_infectious"`
107
+	RemindCycle              int64   `gorm:"column:remind_cycle" json:"remind_cycle"`
108
+	ResponseResult           string  `gorm:"column:response_result" json:"response_result"`
109
+	IsOpenRemind             int64   `gorm:"column:is_open_remind" json:"is_open_remind"`
110
+	DialysisAge              int64   `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
111
+	ExpenseKind              int64   `gorm:"column:expense_kind" json:"expense_kind" form:"expense_kind"`
112
+	TellPhone                string  `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
113
+	FirstTreatmentDate       int64   `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
114
+	ContactName              string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
115
+	UserSysBeforeCount       int64   `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
116
+	IsExcelExport            int64   `gorm:"column:is_excel_export" json:"is_excel_export" form:"is_excel_export"`
117
+	SchRemark                string  `gorm:"column:sch_remark" json:"sch_remark" form:"sch_remark"`
118
+	OutReason                string  `gorm:"column:out_reason" json:"out_reason" form:"out_reason"`
119
+	DeathTime                int64   `gorm:"column:death_time" json:"death_time" form:"death_time"`
120
+	ContagionIds             []int64 `gorm:"-"`
121
+	DryWeight                float64 `gorm:"-"`
121 122
 }
122 123
 
123 124
 func (Patients) TableName() string {
@@ -250,6 +251,18 @@ func (DialysisPrescriptionList) TableName() string {
250 251
 	return "xt_dialysis_prescription"
251 252
 }
252 253
 
254
+type DialysisAssesmentBefor struct {
255
+	ID                     int64 `gorm:"column:id" json:"id"`
256
+	UserOrgId              int64 `gorm:"column:user_org_id" json:"user_org_id"`
257
+	PatientId              int64 `gorm:"column:patient_id" json:"patient_id"`
258
+	AssessmentDate         int64 `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
259
+	BloodAccessPartOperaId int64 `gorm:"column:blood_access_part_opera_id" json:"blood_access_part_opera_id" form:"blood_access_part_opera_id"`
260
+}
261
+
262
+func (DialysisAssesmentBefor) TableName() string {
263
+	return "xt_assessment_before_dislysis"
264
+}
265
+
253 266
 type DialysisSolution struct {
254 267
 	ID                         int64   `gorm:"column:id" json:"id" form:"id"`
255 268
 	Name                       string  `gorm:"column:name" json:"name" form:"name"`

+ 16 - 14
service/mobile_dialysis_service.go View File

@@ -707,20 +707,21 @@ func GetMonitor(orgID int64, patientID int64, id int64) (*models.MonitoringRecor
707 707
 }
708 708
 
709 709
 type MScheduleDoctorAdviceVM struct {
710
-	ID              int64                            `gorm:"column:id" json:"id"`
711
-	UserOrgId       int64                            `gorm:"column:user_org_id" json:"user_org_id"`
712
-	PartitionId     int64                            `gorm:"column:partition_id" json:"partition_id"`
713
-	BedId           int64                            `gorm:"column:bed_id" json:"bed_id"`
714
-	PatientId       int64                            `gorm:"column:patient_id" json:"patient_id"`
715
-	ScheduleDate    int64                            `gorm:"column:schedule_date" json:"schedule_date"`
716
-	ScheduleType    int64                            `gorm:"column:schedule_type" json:"schedule_type"`
717
-	ModeId          int64                            `gorm:"column:mode_id" json:"mode_id"`
718
-	Status          int64                            `gorm:"column:status" json:"status"`
719
-	DialysisOrder   *MDialysisOrderVM                `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
720
-	SchedualPatient *MSchedualPatientVM              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
721
-	DeviceNumber    *MDeviceNumberVM                 `gorm:"ForeignKey:BedId" json:"device_number"`
722
-	DoctorAdvices   []*MDoctorAdviceVM               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
723
-	Prescription    *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
710
+	ID                     int64                            `gorm:"column:id" json:"id"`
711
+	UserOrgId              int64                            `gorm:"column:user_org_id" json:"user_org_id"`
712
+	PartitionId            int64                            `gorm:"column:partition_id" json:"partition_id"`
713
+	BedId                  int64                            `gorm:"column:bed_id" json:"bed_id"`
714
+	PatientId              int64                            `gorm:"column:patient_id" json:"patient_id"`
715
+	ScheduleDate           int64                            `gorm:"column:schedule_date" json:"schedule_date"`
716
+	ScheduleType           int64                            `gorm:"column:schedule_type" json:"schedule_type"`
717
+	ModeId                 int64                            `gorm:"column:mode_id" json:"mode_id"`
718
+	Status                 int64                            `gorm:"column:status" json:"status"`
719
+	DialysisOrder          *MDialysisOrderVM                `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
720
+	SchedualPatient        *MSchedualPatientVM              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
721
+	DeviceNumber           *MDeviceNumberVM                 `gorm:"ForeignKey:BedId" json:"device_number"`
722
+	DoctorAdvices          []*MDoctorAdviceVM               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
723
+	Prescription           *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
724
+	DialysisAssesmentBefor *models.DialysisAssesmentBefor   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assesmentbefor"`
724 725
 }
725 726
 
726 727
 func (MScheduleDoctorAdviceVM) TableName() string {
@@ -863,6 +864,7 @@ func MobileGetScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType
863 864
 		Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
864 865
 		Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
865 866
 		Preload("Prescription", "status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).
867
+		Preload("DialysisAssesmentBefor", "status =1 AND user_org_id = ? and assessment_date =?", orgID, scheduleDate).
866 868
 		Preload("DoctorAdvices", adviceCondition...).
867 869
 		Where("status = 1 AND user_org_id = ?", orgID)
868 870
 	if scheduleDate != 0 {

+ 2 - 2
service/patient_service.go View File

@@ -67,7 +67,7 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
67 67
 
68 68
 	offset := (page - 1) * limit
69 69
 
70
-	err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
70
+	err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
71 71
 	return
72 72
 }
73 73
 
@@ -303,7 +303,7 @@ func CreatePatientsNew(patientsNew *models.XtPatientsNew) error {
303 303
 
304 304
 func EditPatientLapseto(patient *models.Patients, lapseto *models.PatientLapseto) (err error) {
305 305
 	utx := writeDb.Begin()
306
-	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto": patient.Lapseto}).Error
306
+	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto": patient.Lapseto, "out_reason": patient.OutReason, "death_time": patient.DeathTime}).Error
307 307
 	//err = utx.Model(&models.PatientLapseto{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto_type": patient.Lapseto, "lapseto_time": time.Now().Unix(), "updated_time": time.Now().Unix()}).Error
308 308
 	if err != nil {
309 309
 		utx.Rollback()