Browse Source

体积小

XMLWAN 3 years ago
parent
commit
b8e421125c

+ 51 - 0
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

@@ -40,6 +40,12 @@ func XcxApiControllersRegisterRouters() {
40 40
 
41 41
 	//获取机构名称
42 42
 	beego.Router("/xcx/api/mobile/getorginfo", &XcxApiController{}, "Get:GetOrgInfo")
43
+
44
+	//获取宣教信息
45
+	beego.Router("/xcx/api/mobile/geteducation", &XcxApiController{}, "Get:GetEducationList")
46
+
47
+	//获取医嘱信息
48
+	beego.Router("/xcx/api/mobile/getdoctoradvice", &XcxApiController{}, "Get:GetDoctorAdvice")
43 49
 }
44 50
 
45 51
 type XcxApiController struct {
@@ -563,3 +569,48 @@ func (this *XcxApiController) GetOrgInfo() {
563 569
 		"orgInfo": orgInfo,
564 570
 	})
565 571
 }
572
+
573
+func (this *XcxApiController) GetEducationList() {
574
+
575
+	start_time := this.GetString("start_time")
576
+	end_time := this.GetString("end_time")
577
+	patient_id, _ := this.GetInt64("patient_id")
578
+	timeLayout := "2006-01-02"
579
+	loc, _ := time.LoadLocation("Local")
580
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
581
+	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
582
+	list, _ := service.GetEducationList(startTime.Unix(), endTime.Unix(), patient_id)
583
+	this.ServeSuccessJSON(map[string]interface{}{
584
+		"list": list,
585
+	})
586
+}
587
+
588
+func (this *XcxApiController) GetDoctorAdvice() {
589
+
590
+	//判断是否开启医嘱同步功能
591
+	start_time := this.GetString("start_time")
592
+	end_time := this.GetString("end_time")
593
+	patient_id, _ := this.GetInt64("patient_id")
594
+	timeLayout := "2006-01-02"
595
+	loc, _ := time.LoadLocation("Local")
596
+	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
597
+	endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
598
+	info, _ := service.GetXcxPatientInfo(patient_id)
599
+	config, _ := service.GetDoctorAdviceConfig(info.UserOrgId)
600
+
601
+	if config.IsOpenRemind == 0 || config.IsOpenRemind == 2 {
602
+
603
+		advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
604
+		this.ServeSuccessJSON(map[string]interface{}{
605
+			"list": advice,
606
+		})
607
+	}
608
+
609
+	if config.IsOpenRemind == 1 {
610
+		advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
611
+		this.ServeSuccessJSON(map[string]interface{}{
612
+			"list": advice,
613
+		})
614
+	}
615
+
616
+}

+ 163 - 0
models/xcx_user_models.go View File

@@ -246,3 +246,166 @@ type XcxSgjUserOrg struct {
246 246
 func (XcxSgjUserOrg) TableName() string {
247 247
 	return "sgj_user_org"
248 248
 }
249
+
250
+type XcxTreatmentSummary struct {
251
+	ID                int64  `gorm:"column:id" json:"id" form:"id"`
252
+	UserOrgId         int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
253
+	PatientId         int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
254
+	AssessmentDate    int64  `gorm:"column:assessment_date" json:"assessment_date" form:"assessment_date"`
255
+	DialysisOrderId   int64  `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
256
+	Mission           string `gorm:"column:mission" json:"mission" form:"mission"`
257
+	DialysisSummary   string `gorm:"column:dialysis_summary" json:"dialysis_summary" form:"dialysis_summary"`
258
+	Change            int64  `gorm:"column:change" json:"change" form:"change"`
259
+	SjNurse           int64  `gorm:"column:sj_nurse" json:"sj_nurse" form:"sj_nurse"`
260
+	ZlNurse           int64  `gorm:"column:zl_nurse" json:"zl_nurse" form:"zl_nurse"`
261
+	HdNurse           int64  `gorm:"column:hd_nurse" json:"hd_nurse" form:"hd_nurse"`
262
+	XjNurse           int64  `gorm:"column:xj_nurse" json:"xj_nurse" form:"xj_nurse"`
263
+	ZlDoctor          int64  `gorm:"column:zl_doctor" json:"zl_doctor" form:"zl_doctor"`
264
+	ChannelImage      string `gorm:"column:channel_image" json:"channel_image" form:"channel_image"`
265
+	Puncture          string `gorm:"column:puncture" json:"puncture" form:"puncture"`
266
+	PunctureNeedle    string `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
267
+	PunctureDirection string `gorm:"column:puncture_direction" json:"puncture_direction" form:"puncture_direction"`
268
+	Status            int64  `gorm:"column:status" json:"status" form:"status"`
269
+	CreatedTime       int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
270
+	UpdatedTime       int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
271
+	Creater           int64  `gorm:"column:creater" json:"creater" form:"creater"`
272
+	Modifier          int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
273
+	NursingRecord     string `gorm:"column:nursing_record" json:"nursing_record" form:"nursing_record"`
274
+	SpecialRecord     string `gorm:"column:special_record" json:"special_record" form:"special_record"`
275
+}
276
+
277
+func (XcxTreatmentSummary) TableName() string {
278
+
279
+	return "xt_treatment_summary"
280
+}
281
+
282
+type XcxDoctorAdviceConfig struct {
283
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
284
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
285
+	CreateTime   int64 `gorm:"column:create_time" json:"create_time" form:"create_time"`
286
+	UpdateTime   int64 `gorm:"column:update_time" json:"update_time" form:"update_time"`
287
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
288
+	IsOpenRemind int64 `gorm:"column:is_open_remind" json:"is_open_remind" form:"is_open_remind"`
289
+}
290
+
291
+func (XcxDoctorAdviceConfig) TableName() string {
292
+	return "xt_doctor_config"
293
+}
294
+
295
+type XcxDoctorAdvice struct {
296
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
297
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
298
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
299
+	AdviceType            int64   `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
300
+	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
301
+	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
302
+	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
303
+	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
304
+	ReminderDate          int64   `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
305
+	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
306
+	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
307
+	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
308
+	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
309
+	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
310
+	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
311
+	AdviceDoctor          int64   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
312
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
313
+	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
314
+	UpdatedTime           int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
315
+	AdviceAffirm          string  `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
316
+	Remark                string  `gorm:"column:remark" json:"remark" form:"remark"`
317
+	StopTime              int64   `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
318
+	StopReason            string  `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
319
+	StopDoctor            int64   `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
320
+	StopState             int64   `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
321
+	ParentId              int64   `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
322
+	ExecutionTime         int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
323
+	ExecutionStaff        int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
324
+	ExecutionState        int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
325
+	Checker               int64   `gorm:"column:checker" json:"checker" form:"checker"`
326
+	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
327
+	DialysisOrderId       int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
328
+	CheckTime             int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
329
+	CheckState            int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
330
+	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
331
+	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
332
+	Groupno               int64   `gorm:"column:groupno" json:"groupno" form:"groupno"`
333
+	FrequencyType         int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
334
+	DayCount              int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
335
+	WeekDay               string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
336
+	RemindType            int64   `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
337
+	TemplateId            string  `gorm:"column:template_id" json:"template_id" form:"template_id"`
338
+	Modifier              int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
339
+	Way                   int64   `gorm:"column:way" json:"way" form:"way"`
340
+	DrugId                int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
341
+	DrugNameId            int64   `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
342
+	SyncAdviceId          int64   `gorm:"column:sync_advice_id" json:"sync_advice_id" form:"sync_advice_id"`
343
+	IsSync                int64   `gorm:"column:is_sync" json:"is_sync" form:"is_sync"`
344
+}
345
+
346
+func (XcxDoctorAdvice) TableName() string {
347
+	return "xt_doctor_advice"
348
+}
349
+
350
+type XcxHisDoctorAdviceInfo struct {
351
+	ID                    int64   `gorm:"column:id" json:"id" form:"id"`
352
+	UserOrgId             int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
353
+	PatientId             int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
354
+	HisPatientId          int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
355
+	AdviceType            int64   `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
356
+	AdviceDate            int64   `gorm:"column:advice_date" json:"advice_date" form:"advice_date"`
357
+	StartTime             int64   `gorm:"column:start_time" json:"start_time" form:"start_time"`
358
+	AdviceName            string  `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
359
+	AdviceDesc            string  `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
360
+	ReminderDate          int64   `gorm:"column:reminder_date" json:"reminder_date" form:"reminder_date"`
361
+	SingleDose            float64 `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
362
+	SingleDoseUnit        string  `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
363
+	PrescribingNumber     float64 `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
364
+	PrescribingNumberUnit string  `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
365
+	DeliveryWay           string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
366
+	ExecutionFrequency    string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
367
+	AdviceDoctor          int64   `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
368
+	Status                int64   `gorm:"column:status" json:"status" form:"status"`
369
+	CreatedTime           int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
370
+	UpdatedTime           int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
371
+	AdviceAffirm          string  `gorm:"column:advice_affirm" json:"advice_affirm" form:"advice_affirm"`
372
+	Remark                string  `gorm:"column:remark" json:"remark" form:"remark"`
373
+	StopTime              int64   `gorm:"column:stop_time" json:"stop_time" form:"stop_time"`
374
+	StopReason            string  `gorm:"column:stop_reason" json:"stop_reason" form:"stop_reason"`
375
+	StopDoctor            int64   `gorm:"column:stop_doctor" json:"stop_doctor" form:"stop_doctor"`
376
+	StopState             int64   `gorm:"column:stop_state" json:"stop_state" form:"stop_state"`
377
+	ParentId              int64   `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
378
+	ExecutionTime         int64   `gorm:"column:execution_time" json:"execution_time" form:"execution_time"`
379
+	ExecutionStaff        int64   `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
380
+	ExecutionState        int64   `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
381
+	Checker               int64   `gorm:"column:checker" json:"checker" form:"checker"`
382
+	RecordDate            int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
383
+	DialysisOrderId       int64   `gorm:"column:dialysis_order_id" json:"dialysis_order_id" form:"dialysis_order_id"`
384
+	CheckTime             int64   `gorm:"column:check_time" json:"check_time" form:"check_time"`
385
+	CheckState            int64   `gorm:"column:check_state" json:"check_state" form:"check_state"`
386
+	DrugSpec              float64 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
387
+	DrugSpecUnit          string  `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
388
+	Groupno               int64   `gorm:"column:groupno" json:"groupno" form:"groupno"`
389
+	RemindType            int64   `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
390
+	FrequencyType         int64   `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
391
+	DayCount              int64   `gorm:"column:day_count" json:"day_count" form:"day_count"`
392
+	WeekDay               string  `gorm:"column:week_day" json:"week_day" form:"week_day"`
393
+	TemplateId            string  `gorm:"column:template_id" json:"template_id" form:"template_id"`
394
+	Modifier              int64   `gorm:"column:modifier" json:"modifier" form:"modifier"`
395
+	DrugId                int64   `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
396
+	Price                 float64 `gorm:"column:price" json:"price" form:"price"`
397
+	PrescriptionId        int64   `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
398
+	MedListCodg           string  `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
399
+	FeedetlSn             string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
400
+	Day                   int64   `gorm:"column:day" json:"day" form:"day"`
401
+	Way                   int64   `gorm:"column:way" json:"way" form:"way"`
402
+	DrugNameId            int64   `gorm:"column:drug_name_id" json:"drug_name_id" form:"drug_name_id"`
403
+	Diagnosis             int64   `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
404
+	HospApprFlag          int64   `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
405
+	LmtUsedFlag           int64   `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
406
+	Mtime                 int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
407
+}
408
+
409
+func (XcxHisDoctorAdviceInfo) TableName() string {
410
+	return "his_doctor_advice_info"
411
+}

+ 25 - 0
service/xcx_mobile_api_service.go View File

@@ -250,3 +250,28 @@ func GetOrgInfo(id int64) (models.XcxSgjUserOrg, error) {
250 250
 	err := UserReadDB().Model(&org).Where("id = ? and status= 1", id).Find(&org).Error
251 251
 	return org, err
252 252
 }
253
+
254
+func GetEducationList(startime int64, endtime int64, patient_id int64) (treatment []*models.XcxTreatmentSummary, err error) {
255
+
256
+	err = XTReadDB().Model(&treatment).Where("assessment_date>=? and assessment_date<=? and patient_id = ? and status  =1", startime, endtime, patient_id).Find(&treatment).Error
257
+	return treatment, err
258
+}
259
+
260
+func GetDoctorAdviceConfig(orgid int64) (models.XcxDoctorAdviceConfig, error) {
261
+
262
+	config := models.XcxDoctorAdviceConfig{}
263
+	err := XTReadDB().Model(&config).Where("org_id = ? and status = 1", orgid).Find(&config).Error
264
+	return config, err
265
+}
266
+
267
+func GetDoctorAdvice(patient_id int64, startime int64, endtime int64) (advice []*models.XcxDoctorAdviceConfig, err error) {
268
+
269
+	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 1", patient_id, startime, endtime).Find(&advice).Error
270
+	return advice, err
271
+}
272
+
273
+func GetHisDoctorAdvice(patient_id int64, startime int64, endtime int64) (advice []*models.XcxHisDoctorAdviceInfo, err error) {
274
+
275
+	err = XTReadDB().Where("patient_id = ? and advice_date >=? and advice_date<=? and status = 1", patient_id, startime, endtime).Find(&advice).Error
276
+	return advice, err
277
+}